def test_build_attributes(self, meta_schema):
     meta, _, mock_getters = meta_schema
     value_def = mock.create_autospec(schema.ValueTypeDefinition)
     attributes = {'not_a_token': None, 'a_token': value_def}
     namespace = mock.create_autospec(config.ConfigNamespace)
     attributes = meta.build_attributes(attributes, namespace)
     assert_equal(attributes['not_a_token'], None)
     assert_equal(list(attributes['_tokens'].keys()), ['a_token'])
     token = attributes['_tokens']['a_token']
     assert_equal(token.config_key, value_def.config_key)
     assert_equal(token.default, value_def.default)
     assert isinstance(attributes['a_token'], property)
     mock_getters.register_value_proxy.assert_called_with(
         namespace, token, value_def.help)
 def test_build_attributes(self, meta_schema):
     meta, _, mock_getters = meta_schema
     value_def = mock.create_autospec(schema.ValueTypeDefinition)
     attributes = {
         'not_a_token': None,
         'a_token': value_def
     }
     namespace = mock.create_autospec(config.ConfigNamespace)
     attributes = meta.build_attributes(attributes, namespace)
     assert_equal(attributes['not_a_token'], None)
     assert_equal(list(attributes['_tokens'].keys()), ['a_token'])
     token = attributes['_tokens']['a_token']
     assert_equal(token.config_key, value_def.config_key)
     assert_equal(token.default, value_def.default)
     assert isinstance(attributes['a_token'], property)
     mock_getters.register_value_proxy.assert_called_with(
         namespace, token, value_def.help)
Example #3
0
 def setup_factory(self):
     self.factory = getters.ProxyFactory()
     self.validator = mock.Mock()
     self.namespace = mock.create_autospec(config.ConfigNamespace)
     self.config_key = 'some_key'
     self.default = 'bad_default'
     self.help = 'some help message no one reads'
     self.args = (self.validator, self.namespace, self.config_key,
                  self.default, self.help)
 def setup_factory(self):
     self.factory = getters.ProxyFactory()
     self.validator = mock.Mock()
     self.namespace = mock.create_autospec(config.ConfigNamespace)
     self.config_key = 'some_key'
     self.default = 'bad_default'
     self.help = 'some help message no one reads'
     self.args = (
         self.validator,
         self.namespace,
         self.config_key,
         self.default,
         self.help)
 def a_scope():
     mock_proxy = mock.create_autospec(proxy.ValueProxy)
     self.namespace.register_proxy(mock_proxy)
 def setup_facade(self):
     self.mock_watcher = mock.create_autospec(config.ConfigurationWatcher)
     self.mock_watcher.get_reloader.return_value = mock.create_autospec(
         config.ReloadCallbackChain)
     self.facade = config.ConfigFacade(self.mock_watcher)
 def namespace(self):
     self.namespace = mock.create_autospec(config.ConfigNamespace)
Example #8
0
 def a_scope():
     mock_proxy = mock.create_autospec(proxy.ValueProxy)
     self.namespace.register_proxy(mock_proxy)
Example #9
0
 def setup_facade(self):
     self.mock_watcher = mock.create_autospec(config.ConfigurationWatcher)
     self.mock_watcher.get_reloader.return_value = mock.create_autospec(
         config.ReloadCallbackChain)
     self.facade = config.ConfigFacade(self.mock_watcher)
 def namespace(self):
     self.namespace = mock.create_autospec(config.ConfigNamespace)