@@ -277,3 +277,48 @@ async def test_merge_proposed_change_permission_failure(
277277 )
278278
279279 assert not update_status .errors
280+
281+
282+ async def test_create_thread (
283+ db : InfrahubDatabase ,
284+ register_core_models_schema : None ,
285+ session_first_account : AccountSession ,
286+ session_admin : AccountSession ,
287+ ):
288+ service = await InfrahubServices .new (
289+ database = db , message_bus = BusRecorder (), workflow = WorkflowLocalExecution (), cache = MemoryCache ()
290+ )
291+ branch_name = "branch-1234"
292+ proposed_change = await Node .init (db = db , schema = InfrahubKind .PROPOSEDCHANGE )
293+ await proposed_change .new (db = db , name = "pc-1234" , destination_branch = "main" , source_branch = branch_name , state = "open" )
294+ await proposed_change .save (db = db )
295+
296+ CREATE_THREAD = """
297+ mutation CoreChangeThreadCreate($proposed_change: String!) {
298+ CoreChangeThreadCreate(
299+ data: {
300+ change: { id: $proposed_change }
301+ label: { value: "Conversation" }
302+ created_at: { value: "2025-03-05T18:01:52+01:00" }
303+ resolved: { value: false }
304+ }
305+ ) {
306+ object {
307+ id
308+ display_label
309+ __typename
310+ }
311+ ok
312+ __typename
313+ }
314+ }
315+ """
316+ response = await graphql_mutation (
317+ query = CREATE_THREAD ,
318+ db = db ,
319+ variables = {"proposed_change" : proposed_change .id },
320+ account_session = session_first_account ,
321+ service = service ,
322+ )
323+ assert not response .errors
324+ assert response .data
0 commit comments