Skip to content

Commit 5a220b3

Browse files
committed
remove tasks and adjust unit tests and http mock is in use
1 parent 74d945a commit 5a220b3

File tree

4 files changed

+3
-12
lines changed

4 files changed

+3
-12
lines changed

backend/infrahub/message_bus/operations/requests/graphql_query_group.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
log = get_logger()
1313

1414

15-
@flow(name="graphql-query-add-subscriber")
1615
async def group_add_subscriber(
1716
client: InfrahubClient, group: InfrahubNode, subscribers: List[str], branch: str
1817
) -> dict:

backend/infrahub/message_bus/operations/requests/proposed_change.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import pytest
1111
from infrahub_sdk.protocols import CoreGeneratorDefinition, CoreProposedChange
12-
from prefect import flow, task
12+
from prefect import flow
1313
from pydantic import BaseModel
1414

1515
from infrahub import config, lock
@@ -718,7 +718,6 @@ class Repository(BaseModel):
718718
internal_status: str
719719

720720

721-
@task
722721
def _parse_proposed_change_repositories(
723722
message: messages.RequestProposedChangePipeline, source: list[dict], destination: list[dict]
724723
) -> list[ProposedChangeRepository]:
@@ -764,7 +763,6 @@ def _parse_proposed_change_repositories(
764763
return list(pc_repos.values())
765764

766765

767-
@task
768766
def _parse_repositories(repositories: list[dict]) -> list[Repository]:
769767
"""This function assumes that the repos is a list of the edges
770768
@@ -787,7 +785,6 @@ def _parse_repositories(repositories: list[dict]) -> list[Repository]:
787785
return parsed
788786

789787

790-
@task
791788
def _parse_artifact_definitions(definitions: list[dict]) -> list[ProposedChangeArtifactDefinition]:
792789
"""This function assumes that definitions is a list of the edges
793790
@@ -818,7 +815,6 @@ def _parse_artifact_definitions(definitions: list[dict]) -> list[ProposedChangeA
818815
return parsed
819816

820817

821-
@task
822818
async def _get_proposed_change_repositories(
823819
message: messages.RequestProposedChangePipeline, service: InfrahubServices
824820
) -> list[ProposedChangeRepository]:
@@ -838,7 +834,6 @@ async def _get_proposed_change_repositories(
838834
return _parse_proposed_change_repositories(message=message, source=source_all, destination=destination_all)
839835

840836

841-
@task
842837
async def _validate_repository_merge_conflicts(repositories: list[ProposedChangeRepository]) -> bool:
843838
conflicts = False
844839
for repo in repositories:
@@ -854,7 +849,6 @@ async def _validate_repository_merge_conflicts(repositories: list[ProposedChange
854849
return conflicts
855850

856851

857-
@task
858852
async def _gather_repository_repository_diffs(repositories: list[ProposedChangeRepository]) -> None:
859853
for repo in repositories:
860854
if repo.has_diff and repo.source_commit and repo.destination_commit:
@@ -877,7 +871,6 @@ async def _gather_repository_repository_diffs(repositories: list[ProposedChangeR
877871
repo.files_changed = files_changed
878872

879873

880-
@task
881874
async def _populate_subscribers(branch_diff: ProposedChangeBranchDiff, service: InfrahubServices, branch: str) -> None:
882875
result = await service.client.execute_graphql(
883876
query=GATHER_GRAPHQL_QUERY_SUBSCRIBERS,
@@ -892,7 +885,6 @@ async def _populate_subscribers(branch_diff: ProposedChangeBranchDiff, service:
892885
)
893886

894887

895-
@task
896888
async def _get_proposed_change_schema_integrity_constraints(
897889
message: messages.RequestProposedChangeSchemaIntegrity, schema: SchemaBranch
898890
) -> list[SchemaUpdateConstraintInfo]:

backend/tests/unit/message_bus/operations/requests/test_graphql_query_group.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,4 @@ async def test_graphql_group_update(db: InfrahubDatabase, httpx_mock: HTTPXMock,
6363
match_headers={"X-Infrahub-Tracker": "mutation-relationshipadd"},
6464
)
6565

66-
await update(message=message, service=service)
66+
await update.fn(message=message, service=service)

backend/tests/unit/message_bus/operations/requests/test_proposed_change.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ async def test_schema_integrity(
289289

290290
# Ignore creation of Task Report response
291291
httpx_mock.add_response(method="POST", url="http://mock/graphql/main", json={"data": {}})
292-
await proposed_change.schema_integrity(message=schema_integrity_01, service=service_all)
292+
await proposed_change.schema_integrity.fn(message=schema_integrity_01, service=service_all)
293293

294294
checks = await registry.manager.query(db=db, schema=InfrahubKind.SCHEMACHECK)
295295
assert len(checks) == 1

0 commit comments

Comments
 (0)