def test_get_unsigned_secret_returns_key(notify_api, notify_db, notify_db_session, 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 test_secret_is_signed_and_can_be_read_again(notify_api): import uuid with notify_api.test_request_context(): token = str(uuid.uuid4()) signed_secret = _generate_secret(token=token) assert token == _get_secret(signed_secret) assert signed_secret != token
def test_should_return_unsigned_api_keys_for_service_id(notify_api, notify_db, notify_db_session, 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)