Move extends validation into ServiceLoader class
This refactoring allows us to raise an error when there is no 'file' key specified in the .yml and no self.filename set. This error was specific to the tests, as the tests are the only place that constructs service dicts without sometimes setting a filename. Moving the function within the class as well as it is code that is exclusively for the use of validating properties for the ServiceLoader class. Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
This commit is contained in:
parent
24c1d95869
commit
254bc4908c
2 changed files with 27 additions and 15 deletions
|
|
@ -459,6 +459,14 @@ class ExtendsTest(unittest.TestCase):
|
|||
|
||||
self.assertRaisesRegexp(config.ConfigurationError, 'what', load_config)
|
||||
|
||||
def test_extends_validation_no_file_key_no_filename_set(self):
|
||||
dictionary = {'extends': {'service': 'web'}}
|
||||
|
||||
def load_config():
|
||||
return config.make_service_dict('myweb', dictionary, working_dir='tests/fixtures/extends')
|
||||
|
||||
self.assertRaisesRegexp(config.ConfigurationError, 'file', load_config)
|
||||
|
||||
def test_extends_validation_valid_config(self):
|
||||
dictionary = {'extends': {'service': 'web', 'file': 'common.yml'}}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue