Skip to content

Commit 0f86c19

Browse files
committed
linting and formatting
1 parent 30ab332 commit 0f86c19

File tree

4 files changed

+19
-55
lines changed

4 files changed

+19
-55
lines changed

infrahub_sdk/ctl/repository.py

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ async def list(
109109
debug: bool = False,
110110
_: str = CONFIG_PARAM,
111111
) -> None:
112-
113112
init_logging(debug=debug)
114113

115114
client = initialize_client()
@@ -119,24 +118,15 @@ async def list(
119118
"edges": {
120119
"node": {
121120
"__typename": None,
122-
"name": {
123-
"value": None
124-
},
125-
"operational_status": {
126-
"value": None
127-
},
128-
"sync_status": {
129-
"value": None
130-
},
131-
"internal_status": {
132-
"value": None
133-
}
121+
"name": {"value": None},
122+
"operational_status": {"value": None},
123+
"sync_status": {"value": None},
124+
"internal_status": {"value": None},
134125
}
135126
}
136127
},
137128
}
138129

139-
BRANCH_DATA_FILTER = {"@filters": {"name": "$branch_name"}}
140130
query = Query(name="GetRepositoryStatus", query=repo_status_query)
141131
resp = await client.execute_graphql(query=query.render(), branch_name="main", tracker="query-repository-list")
142132

@@ -148,17 +138,15 @@ async def list(
148138
table.add_column("Sync status")
149139
table.add_column("Internal status")
150140

151-
152141
for repository_node in resp["CoreGenericRepository"]["edges"]:
153-
154142
repository = repository_node["node"]
155143

156144
table.add_row(
157145
repository["name"]["value"],
158146
repository["__typename"],
159147
repository["operational_status"]["value"],
160148
repository["sync_status"]["value"],
161-
repository["internal_status"]["value"]
149+
repository["internal_status"]["value"],
162150
)
163151

164152
console.print(table)

tests/unit/ctl/conftest.py

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
import tempfile
21
import shutil
3-
4-
from pathlib import Path
2+
import tempfile
53

64
import pytest
7-
85
from git import Repo
96
from pytest_httpx import HTTPXMock
107

118
from tests.helpers.fixtures import get_fixtures_dir
129
from tests.helpers.utils import change_directory
1310

11+
1412
@pytest.fixture
1513
async def mock_branches_list_query(httpx_mock: HTTPXMock) -> HTTPXMock:
1614
response = {
@@ -124,37 +122,21 @@ def mock_repositories_list(httpx_mock: HTTPXMock) -> HTTPXMock:
124122
{
125123
"node": {
126124
"__typename": "CoreReadOnlyRepository",
127-
"name": {
128-
"value": "Demo Edge Repo"
129-
},
130-
"operational_status": {
131-
"value": "unknown"
132-
},
133-
"sync_status": {
134-
"value": "in-sync"
135-
},
136-
"internal_status": {
137-
"value": "active"
138-
}
125+
"name": {"value": "Demo Edge Repo"},
126+
"operational_status": {"value": "unknown"},
127+
"sync_status": {"value": "in-sync"},
128+
"internal_status": {"value": "active"},
139129
}
140130
},
141131
{
142132
"node": {
143133
"__typename": "CoreRepository",
144-
"name": {
145-
"value": "My Own Repo"
146-
},
147-
"operational_status": {
148-
"value": "in-sync"
149-
},
150-
"sync_status": {
151-
"value": "in-sync"
152-
},
153-
"internal_status": {
154-
"value": "active"
155-
}
134+
"name": {"value": "My Own Repo"},
135+
"operational_status": {"value": "in-sync"},
136+
"sync_status": {"value": "in-sync"},
137+
"internal_status": {"value": "active"},
156138
}
157-
}
139+
},
158140
]
159141
}
160142
}

tests/unit/ctl/test_repository_app.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@
77

88
from infrahub_sdk.client import InfrahubClient
99
from infrahub_sdk.ctl.cli_commands import app
10-
1110
from tests.helpers.fixtures import read_fixture
1211
from tests.helpers.utils import strip_color
1312

14-
1513
runner = CliRunner()
1614

1715

@@ -121,7 +119,6 @@ def test_repo_username(self, mock_init_client, mock_client) -> None:
121119
mock_cred.save.assert_called_with(allow_upsert=True)
122120
mock_client.execute_graphql.assert_called_once()
123121
mock_client.execute_graphql.assert_called_with(
124-
125122
query="""
126123
mutation {
127124
CoreRepositoryCreate(
@@ -244,7 +241,6 @@ def test_repo_description_commit_branch(self, mock_init_client, mock_client) ->
244241
mock_client.create.assert_called_with(
245242
name="Gitlab",
246243
kind="CorePasswordCredential",
247-
248244
password="mySup3rSecureP@ssw0rd",
249245
username="opsmill",
250246
)
@@ -281,7 +277,6 @@ def test_repo_description_commit_branch(self, mock_init_client, mock_client) ->
281277
tracker="mutation-repository-create",
282278
)
283279

284-
285280
def test_repo_list(self, mock_repositories_list) -> None:
286281
result = runner.invoke(app, ["repository", "list"])
287282
assert result.exit_code == 0

tests/unit/ctl/test_transform_app.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""Integration tests for infrahubctl commands."""
22

33
import json
4-
import os
54
import sys
65
from pathlib import Path
76

@@ -16,8 +15,6 @@
1615
runner = CliRunner()
1716

1817

19-
20-
2118
# ---------------------------------------------------------
2219
# infrahubctl transform command tests
2320
# ---------------------------------------------------------
@@ -96,5 +93,7 @@ def test_infrahubctl_transform_cmd_success(httpx_mock: HTTPXMock, tags_transform
9693

9794
with change_directory(tags_transform_dir):
9895
output = runner.invoke(app, ["transform", "tags_transform", "tag=red"])
99-
assert strip_color(output.stdout) == read_fixture("case_success_output.txt", "integration/test_infrahubctl/transform_cmd")
96+
assert strip_color(output.stdout) == read_fixture(
97+
"case_success_output.txt", "integration/test_infrahubctl/transform_cmd"
98+
)
10099
assert output.exit_code == 0

0 commit comments

Comments
 (0)