Skip to content

Commit 35c40cb

Browse files
committed
minor fixes
1 parent c1a4bb6 commit 35c40cb

File tree

6 files changed

+12
-39
lines changed

6 files changed

+12
-39
lines changed

backend/infrahub/api/query.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from infrahub.graphql.utils import extract_data
2727
from infrahub.groups.models import RequestGraphQLQueryGroupUpdate
2828
from infrahub.log import get_logger
29-
from infrahub.workflows.catalogue import REQUEST_GRAPHQL_QUERY_GROUP_UPDATE
29+
from infrahub.workflows.catalogue import UPDATE_GRAPHQL_QUERY_GROUP
3030

3131
if TYPE_CHECKING:
3232
from infrahub.auth import AccountSession
@@ -115,7 +115,7 @@ async def execute_query(
115115
subscribers=sorted(subscribers),
116116
params=params,
117117
)
118-
await service.workflow.submit_workflow(workflow=REQUEST_GRAPHQL_QUERY_GROUP_UPDATE, parameters={"model": model})
118+
await service.workflow.submit_workflow(workflow=UPDATE_GRAPHQL_QUERY_GROUP, parameters={"model": model})
119119

120120
return response_payload
121121

backend/infrahub/graphql/tasks.py

Lines changed: 0 additions & 28 deletions
This file was deleted.

backend/infrahub/groups/tasks.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1+
from infrahub_sdk.groups import group_add_subscriber
12
from infrahub_sdk.utils import dict_hash
3+
from prefect import flow
24

35
from infrahub.core.constants import InfrahubKind
4-
from infrahub.graphql.tasks import _group_add_subscriber
56
from infrahub.groups.models import RequestGraphQLQueryGroupUpdate
67
from infrahub.services import services
78
from infrahub.workflows.utils import add_branch_tag
89

910

10-
# @flow(name="update_graphql_query_group")
11+
@flow(name="update_graphql_query_group")
1112
async def update_graphql_query_group(model: RequestGraphQLQueryGroupUpdate) -> None:
1213
"""Create or Update a GraphQLQueryGroup."""
1314

@@ -30,6 +31,6 @@ async def update_graphql_query_group(model: RequestGraphQLQueryGroupUpdate) -> N
3031
await group.save(allow_upsert=True)
3132

3233
if model.subscribers:
33-
await _group_add_subscriber(
34+
await group_add_subscriber(
3435
client=service.client, group=group, subscribers=model.subscribers, branch=model.branch
3536
)

backend/infrahub/workflows/catalogue.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
function="cancel_proposed_changes_branch",
188188
)
189189

190-
REQUEST_GRAPHQL_QUERY_GROUP_UPDATE = WorkflowDefinition(
190+
UPDATE_GRAPHQL_QUERY_GROUP = WorkflowDefinition(
191191
name="update_graphql_query_group",
192192
type=WorkflowType.INTERNAL,
193193
module="infrahub.graphql.tasks",
@@ -221,5 +221,5 @@
221221
TRIGGER_GENERATOR_DEFINITION_RUN,
222222
BRANCH_CANCEL_PROPOSED_CHANGES,
223223
REQUEST_GENERATOR_DEFINITION_RUN,
224-
REQUEST_GRAPHQL_QUERY_GROUP_UPDATE,
224+
UPDATE_GRAPHQL_QUERY_GROUP,
225225
]

backend/tests/unit/api/test_05_query_api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from infrahub.core.initialization import create_branch
99
from infrahub.groups.models import RequestGraphQLQueryGroupUpdate
10-
from infrahub.workflows.catalogue import REQUEST_GRAPHQL_QUERY_GROUP_UPDATE
10+
from infrahub.workflows.catalogue import UPDATE_GRAPHQL_QUERY_GROUP
1111

1212
if TYPE_CHECKING:
1313
from fastapi.testclient import TestClient
@@ -72,7 +72,7 @@ async def test_query_endpoint_group_no_params(
7272

7373
expected_calls = [
7474
call(
75-
workflow=REQUEST_GRAPHQL_QUERY_GROUP_UPDATE,
75+
workflow=UPDATE_GRAPHQL_QUERY_GROUP,
7676
parameters={"model": model},
7777
),
7878
]
@@ -113,7 +113,7 @@ async def test_query_endpoint_group_params(
113113

114114
expected_calls = [
115115
call(
116-
workflow=REQUEST_GRAPHQL_QUERY_GROUP_UPDATE,
116+
workflow=UPDATE_GRAPHQL_QUERY_GROUP,
117117
parameters={"model": model},
118118
),
119119
]

python_sdk

0 commit comments

Comments
 (0)