def test_decrypt__when_not_decrypted__decrypt_secrets(self): config = UltraConfig([], decrypter=self.encrypter) config['blah'] = 'something' config['SECRETS'] = ['blah'] config.decrypted = False config.decrypt() self.assertEqual('blah', config['blah'])
def test_encrypt__when_already_encrypted__raise_value_error(self): config = UltraConfig([]) config.decrypted = False self.assertRaises(ValueError, config.encrypt)
def test_get_encrypted__when_not_encrypted__return(self): config = UltraConfig([], decrypter=self.encrypter) config.decrypted = True config['blah'] = 'something' resp = config.get_encrypted('blah') self.assertEqual('something', resp)
def test_set_encrypted__when_not_encrypted__set_raw_value(self): config = UltraConfig([], encrypter=self.encrypter) config.decrypted = True config.set_encrypted('blah', 'something') self.assertEqual('something', config['blah'])
def test_decrypt__when_already_decrypted__raise_value_error(self): config = UltraConfig([]) config.decrypted = True self.assertRaises(ValueError, config.decrypt)