def test_properties(self): property_manager = properties.PropertyManager(self.collection_mock) self.assertEqual(property_manager.properties, { 'fake1': 'FAKE_VALUE', 'fake2': 'FAKE_VALUE' })
def test_change_properties_dict(self): property_manager = properties.PropertyManager(self.collection_mock) def set_item(d, key, value): d[key] = value self.assertRaises(TypeError, set_item, property_manager.properties, 'fake1', 2)
def test_init_manager(self): res = properties.PropertyManager(self.collection_mock) instantiate_property_calls = [ mock.call('fake1', None), mock.call('fake2', None) ] self.assertIsInstance(res, properties.PropertyManager) self.collection_mock.instantiate_property.assert_has_calls( instantiate_property_calls, any_order=True)
def test_init_manager_with_correct_kwargs(self): res = properties.PropertyManager(self.collection_mock, fake1=FAKE_VALUE2, fake2=FAKE_VALUE3) instantiate_property_calls = [ mock.call('fake1', FAKE_VALUE2), mock.call('fake2', FAKE_VALUE3) ] self.assertIsInstance(res, properties.PropertyManager) self.collection_mock.instantiate_property.assert_has_calls( instantiate_property_calls, any_order=True)
def __init__(self, **kwargs): self.properties = properties.PropertyManager(self.properties, **kwargs)