Exemple #1
0
  def testInvalidConnectionTypeRaisesTypeError(self):
    """Test that a type error is raised when connection type is not passed in as a ConnectionType instance."""
    test_connection_dict = {
        'source_entity_guid': self.source_entity_guid,
        'target_entity_guid': self.target_entity_guid,
        'connection_type': 'FEEDS'
    }

    with self.assertRaises(TypeError):
      Connection.FromDict(test_connection_dict)
Exemple #2
0
  def testConnectionInitsFromDict(self):
    """Tests that a Connection instance is correctly initialized using the FromDict() class method."""
    test_connection_dict = {
        'source_entity_guid': self.source_entity_guid,
        'target_entity_guid': self.target_entity_guid,
        'connection_type': self.valid_connection_type
    }
    test_connection_instance = Connection.FromDict(test_connection_dict)

    self.assertIsInstance(test_connection_instance, Connection)
    self.assertEqual(self.valid_connection_type,
                     test_connection_instance.connection_type)
    self.assertEqual(self.source_entity_guid,
                     test_connection_instance.source_entity_guid)
    self.assertEqual(self.target_entity_guid,
                     test_connection_instance.target_entity_guid)