From 723485d3c9ace93d26e53988bf1890cadf2535a8 Mon Sep 17 00:00:00 2001 From: Christopher Byrd Date: Thu, 14 Nov 2024 08:43:35 -0800 Subject: [PATCH] nit #11570 --- tests/models/graph_tests.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tests/models/graph_tests.py b/tests/models/graph_tests.py index b8a4d8b84c..5991ad651f 100644 --- a/tests/models/graph_tests.py +++ b/tests/models/graph_tests.py @@ -2186,21 +2186,25 @@ def test_placing_node_in_separate_card_does_not_pollute_database(self): ) editable_future_graph = updated_source_graph.create_editable_future_graph() + node = [node for node in editable_future_graph.nodes.values()][2] + + # fixes flaky test + models.NodeGroup.objects.filter(pk=node.pk).delete() + nodegroup_count_before = models.NodeGroup.objects.count() - node = [node for node in editable_future_graph.nodes.values()][2] source_identifier_id = node.source_identifier_id original_nodegroup_id = node.nodegroup_id updated_nodegroup_id = node.pk - models.NodeGroup.objects.update_or_create( - nodegroupid=str(updated_nodegroup_id), - defaults={ + models.NodeGroup.objects.create( + **{ "cardinality": "n", "legacygroupid": "", + "nodegroupid": str(updated_nodegroup_id), "parentnodegroup_id": None, - }, - ) + } + ).save() node.nodegroup_id = updated_nodegroup_id node.save()