From 17d7a9e4643b51a9b83953c929011591c6221ad0 Mon Sep 17 00:00:00 2001 From: Damien Garros Date: Thu, 6 Mar 2025 09:35:18 +0100 Subject: [PATCH] Fix support for Offset Datetime --- .../graphql/mutations/test_proposed_change.py | 45 +++++++++++++++++++ python_sdk | 2 +- 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/backend/tests/unit/graphql/mutations/test_proposed_change.py b/backend/tests/unit/graphql/mutations/test_proposed_change.py index e41ac8cf5f..e378bb8af8 100644 --- a/backend/tests/unit/graphql/mutations/test_proposed_change.py +++ b/backend/tests/unit/graphql/mutations/test_proposed_change.py @@ -277,3 +277,48 @@ async def test_merge_proposed_change_permission_failure( ) assert not update_status.errors + + +async def test_create_thread( + db: InfrahubDatabase, + register_core_models_schema: None, + session_first_account: AccountSession, + session_admin: AccountSession, +): + service = await InfrahubServices.new( + database=db, message_bus=BusRecorder(), workflow=WorkflowLocalExecution(), cache=MemoryCache() + ) + branch_name = "branch-1234" + proposed_change = await Node.init(db=db, schema=InfrahubKind.PROPOSEDCHANGE) + await proposed_change.new(db=db, name="pc-1234", destination_branch="main", source_branch=branch_name, state="open") + await proposed_change.save(db=db) + + CREATE_THREAD = """ + mutation CoreChangeThreadCreate($proposed_change: String!) { + CoreChangeThreadCreate( + data: { + change: { id: $proposed_change } + label: { value: "Conversation" } + created_at: { value: "2025-03-05T18:01:52+01:00" } + resolved: { value: false } + } + ) { + object { + id + display_label + __typename + } + ok + __typename + } + } + """ + response = await graphql_mutation( + query=CREATE_THREAD, + db=db, + variables={"proposed_change": proposed_change.id}, + account_session=session_first_account, + service=service, + ) + assert not response.errors + assert response.data diff --git a/python_sdk b/python_sdk index fc93bfe731..e59e6a52dc 160000 --- a/python_sdk +++ b/python_sdk @@ -1 +1 @@ -Subproject commit fc93bfe731c91311e048499f32c3acbc8e273baa +Subproject commit e59e6a52dcd810415888328b4ac64767c757ed50