def test_keyring_client(self): kr_client = secret_settings.KeyringClient() for sec_name, pwd in KV_SECRETS.items(): self.assertEqual(pwd, kr_client.get_secret(sec_name)) self.assertIsNone(kr_client.get_secret("DoesntExist")) kr_client.set_secret("new_secret", "secret_value") self.assertEqual("secret_value", kr_client.get_secret("new_secret")) self.assertEqual("secret_value", kr_client["new_secret"]) with self.assertRaises(KeyError): kr_client["DoesntExist"]
def test_keyring_client(self): """Test keyring client.""" kr_client = secret_settings.KeyringClient() for sec_name, pwd in KV_SECRETS.items(): self.assertEqual(pwd, kr_client.get_secret(sec_name)) self.assertIsNone(kr_client.get_secret("DoesntExist")) kr_client.set_secret("new_secret", "secret_value") self.assertEqual("secret_value", kr_client.get_secret("new_secret")) self.assertEqual("secret_value", kr_client["new_secret"]) # pylint: disable=pointless-statement with self.assertRaises(KeyError): kr_client["DoesntExist"]