Ejemplo n.º 1
0
    def test_properties(self):
        property_manager = properties.PropertyManager(self.collection_mock)

        self.assertEqual(property_manager.properties, {
            'fake1': 'FAKE_VALUE',
            'fake2': 'FAKE_VALUE'
        })
Ejemplo n.º 2
0
    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)
Ejemplo n.º 3
0
    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)
Ejemplo n.º 4
0
    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)
Ejemplo n.º 5
0
 def __init__(self, **kwargs):
     self.properties = properties.PropertyManager(self.properties, **kwargs)