def test_move_down_processes_end_node_directly(self): traversal = DiagnosisTraversal.objects.create( graph_version='v1', current_node_id='2a', nodes=[ self.mocked_graph.get_node_dict('2a') ] ) serializer = DiagnosisSerializer( instance=traversal, data={ 'current_node_id': '3ab' } ) self.assertTrue(serializer.is_valid()) serializer.save() traversal = DiagnosisTraversal.objects.get(pk=traversal.pk) self.assertEqual(traversal.current_node_id, 'INSCOPE') self.assertItemsEqual(traversal.nodes, [ self.mocked_graph.get_node_dict('2a'), self.mocked_graph.get_node_dict('3ab'), self.mocked_graph.get_node_dict('INSCOPE') ]) self.assertEqual(traversal.category.code, 'debt') self.assertEqual(traversal.state, DIAGNOSIS_SCOPE.INSCOPE)
def test_move_down_processes_end_node_directly(self): traversal = DiagnosisTraversal.objects.create( graph_version="v1", current_node_id="2a", nodes=[self.mocked_graph.get_node_dict("2a")]) serializer = DiagnosisSerializer(instance=traversal, data={"current_node_id": "3ab"}) self.assertTrue(serializer.is_valid()) serializer.save() traversal = DiagnosisTraversal.objects.get(pk=traversal.pk) self.assertEqual(traversal.current_node_id, "INSCOPE") self.assertItemsEqual( traversal.nodes, [ self.mocked_graph.get_node_dict("2a"), self.mocked_graph.get_node_dict("3ab"), self.mocked_graph.get_node_dict("INSCOPE"), ], ) self.assertEqual(traversal.state, DIAGNOSIS_SCOPE.INSCOPE) self.assertEqual(traversal.category.code, self.category.code) self.assertEqual(traversal.matter_type1.code, self.matter_type1.code) self.assertEqual(traversal.matter_type2.code, self.matter_type2.code)
def test_move_down_updates_traversal(self): """ Tests that moving down updates the traversal object """ traversal = DiagnosisTraversal.objects.create( graph_version='v1', current_node_id='2a', nodes=[ self.mocked_graph.get_node_dict('2a') ] ) serializer = DiagnosisSerializer( instance=traversal, data={ 'current_node_id': '3aa' } ) self.assertTrue(serializer.is_valid()) serializer.save() traversal = DiagnosisTraversal.objects.get(pk=traversal.pk) self.assertEqual(traversal.current_node_id, '3aa') self.assertItemsEqual(traversal.nodes, [ self.mocked_graph.get_node_dict('2a'), self.mocked_graph.get_node_dict('3aa') ])
def test_move_down_updates_traversal(self): """ Tests that moving down updates the traversal object """ traversal = DiagnosisTraversal.objects.create( graph_version="v1", current_node_id="2a", nodes=[self.mocked_graph.get_node_dict("2a")] ) serializer = DiagnosisSerializer(instance=traversal, data={"current_node_id": "3aa"}) self.assertTrue(serializer.is_valid()) serializer.save() traversal = DiagnosisTraversal.objects.get(pk=traversal.pk) self.assertEqual(traversal.current_node_id, "3aa") self.assertItemsEqual( traversal.nodes, [self.mocked_graph.get_node_dict("2a"), self.mocked_graph.get_node_dict("3aa")] )
def test_move_down_processes_end_node_directly(self): traversal = DiagnosisTraversal.objects.create( graph_version='v1', current_node_id='2a', nodes=[self.mocked_graph.get_node_dict('2a')]) serializer = DiagnosisSerializer(instance=traversal, data={'current_node_id': '3ab'}) self.assertTrue(serializer.is_valid()) serializer.save() traversal = DiagnosisTraversal.objects.get(pk=traversal.pk) self.assertEqual(traversal.current_node_id, 'INSCOPE') self.assertItemsEqual(traversal.nodes, [ self.mocked_graph.get_node_dict('2a'), self.mocked_graph.get_node_dict('3ab'), self.mocked_graph.get_node_dict('INSCOPE') ]) self.assertEqual(traversal.category.code, 'debt') self.assertEqual(traversal.state, DIAGNOSIS_SCOPE.INSCOPE)
def test_move_down_updates_traversal(self): """ Tests that moving down updates the traversal object """ traversal = DiagnosisTraversal.objects.create( graph_version='v1', current_node_id='2a', nodes=[self.mocked_graph.get_node_dict('2a')]) serializer = DiagnosisSerializer(instance=traversal, data={'current_node_id': '3aa'}) self.assertTrue(serializer.is_valid()) serializer.save() traversal = DiagnosisTraversal.objects.get(pk=traversal.pk) self.assertEqual(traversal.current_node_id, '3aa') self.assertItemsEqual(traversal.nodes, [ self.mocked_graph.get_node_dict('2a'), self.mocked_graph.get_node_dict('3aa') ])
def test_move_down_updates_traversal(self): """ Tests that moving down updates the traversal object """ traversal = DiagnosisTraversal.objects.create( graph_version="v1", current_node_id="2a", nodes=[self.mocked_graph.get_node_dict("2a")]) serializer = DiagnosisSerializer(instance=traversal, data={"current_node_id": "3aa"}) self.assertTrue(serializer.is_valid()) serializer.save() traversal = DiagnosisTraversal.objects.get(pk=traversal.pk) self.assertEqual(traversal.current_node_id, "3aa") self.assertItemsEqual(traversal.nodes, [ self.mocked_graph.get_node_dict("2a"), self.mocked_graph.get_node_dict("3aa") ])
def test_move_down_processes_end_node_directly(self): traversal = DiagnosisTraversal.objects.create( graph_version="v1", current_node_id="2a", nodes=[self.mocked_graph.get_node_dict("2a")] ) serializer = DiagnosisSerializer(instance=traversal, data={"current_node_id": "3ab"}) self.assertTrue(serializer.is_valid()) serializer.save() traversal = DiagnosisTraversal.objects.get(pk=traversal.pk) self.assertEqual(traversal.current_node_id, "INSCOPE") self.assertItemsEqual( traversal.nodes, [ self.mocked_graph.get_node_dict("2a"), self.mocked_graph.get_node_dict("3ab"), self.mocked_graph.get_node_dict("INSCOPE"), ], ) self.assertEqual(traversal.state, DIAGNOSIS_SCOPE.INSCOPE) self.assertEqual(traversal.category.code, self.category.code) self.assertEqual(traversal.matter_type1.code, self.matter_type1.code) self.assertEqual(traversal.matter_type2.code, self.matter_type2.code)