def test_secret_is_signed_and_can_be_read_again(notify_api): with notify_api.test_request_context(): signed_secret = generate_secret('some_uuid') assert signed_secret != 'some_uuid' assert 'some_uuid' == get_secret(signed_secret)
def test_should_return_unsigned_api_keys_for_service_id(sample_api_key): unsigned_api_key = get_unsigned_secrets(sample_api_key.service_id) assert len(unsigned_api_key) == 1 assert sample_api_key.secret != unsigned_api_key[0] assert unsigned_api_key[0] == get_secret(sample_api_key.secret)
def test_get_unsigned_secret_returns_key(sample_api_key): unsigned_api_key = get_unsigned_secret(sample_api_key.id) assert sample_api_key.secret != unsigned_api_key assert unsigned_api_key == get_secret(sample_api_key.secret)
def unsigned_secret(self): return get_secret(self.secret)