def test_update_with_dict_allowed_keys(self): config = Config({'VAR1': 'ORIGINAL'}) config.update_with_object(SOME_DICT, allowed_keys=['VAR1']) self.assertEqual(config, {'VAR1': 'val1'})
def test_update_with_dict(self): config = Config() config.update_with_object(SOME_DICT) self.assertEqual(config, {'VAR1': 'val1', 'VAR2': 'val2'})
def test_update_with_dict_new_keys(self): config = Config({'VAR1': 'ORIGINAL'}) config.update_with_object(SOME_DICT, only_new_keys=True) self.assertEqual(config, {'VAR1': 'ORIGINAL', 'VAR2': 'val2'})
def test_update_with_object_new_keys(self): config = Config({'VAR1': 'ORIGINAL'}) obj = SomeSettings() config.update_with_object(obj, only_new_keys=True) self.assertEqual(config, {'VAR1': 'ORIGINAL', 'VAR2': 'val2'})
def test_update_with_object_allowed_keys(self): config = Config({'VAR1': 'ORIGINAL'}) obj = SomeSettings() config.update_with_object(obj, allowed_keys=['VAR1']) self.assertEqual(config, {'VAR1': 'val1'})
def test_update_with_object(self): config = Config() obj = SomeSettings() config.update_with_object(obj) self.assertEqual(config, {'VAR1': 'val1', 'VAR2': 'val2'})