Exemplo n.º 1
0
 def test_serialization_without_filters(self):
     connection = Connection("source", "bottom", "destination", "top")
     connection_dict = connection.to_dict()
     restored = Connection.from_dict(connection_dict)
     self.assertEqual(restored.source, "source")
     self.assertEqual(restored.source_position, "bottom")
     self.assertEqual(restored.destination, "destination")
     self.assertEqual(restored.destination_position, "top")
     self.assertFalse(restored.has_filters())
Exemplo n.º 2
0
 def test_serialization_with_filters(self):
     filters = {"label": {"scenario_filter": {13: True}}}
     connection = Connection("source", "bottom", "destination", "top", filters)
     connection_dict = connection.to_dict()
     restored = Connection.from_dict(connection_dict)
     self.assertEqual(restored.source, "source")
     self.assertEqual(restored.source_position, "bottom")
     self.assertEqual(restored.destination, "destination")
     self.assertEqual(restored.destination_position, "top")
     self.assertTrue(restored.has_filters())
     self.assertEqual(restored.resource_filters, filters)