Example #1
0
 def test_should_return_env_value_if_config_has_no_matching_key(self):
     assert get_app_config_value('key1',
                                 default_value='default value 1',
                                 config={'other': 'config value 1'
                                         }) == 'env value 1'
Example #2
0
 def test_should_return_env_value_if_config_is_none(self):
     assert get_app_config_value('key1',
                                 default_value='default value 1',
                                 config=None) == 'env value 1'
Example #3
0
 def test_should_return_config_value_if_present(self):
     assert get_app_config_value('key1',
                                 default_value='default value 1',
                                 config={'key1': 'config value 1'
                                         }) == 'config value 1'
Example #4
0
 def test_should_raise_error_if_required(self):
     with pytest.raises(KeyError):
         get_app_config_value('key1', required=True)
Example #5
0
 def test_should_return_none_without_default_value(self):
     assert get_app_config_value('key1') is None
Example #6
0
 def test_should_return_default_value_otherwise(self):
     assert get_app_config_value('key1',
                                 default_value='default value 1',
                                 config=None) == 'default value 1'
Example #7
0
def get_grobid_trainer_image(config: dict = None):
    return get_app_config_value('grobid_trainer_image',
                                config=config,
                                default_value=DEFAULT_GROBID_TRAINER_IMAGE,
                                required=True)