mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-05 10:42:41 -05:00
Add api_token model and dao
This commit is contained in:
16
tests/app/dao/test_tokens_dao.py
Normal file
16
tests/app/dao/test_tokens_dao.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import uuid
|
||||
|
||||
from app.dao import api_tokens_dao
|
||||
from app.models import ApiToken
|
||||
|
||||
|
||||
def test_should_create_token(notify_api, notify_db, notify_db_session, sample_service):
|
||||
token = uuid.uuid4()
|
||||
api_token = ApiToken(**{'token': token, 'service_id': sample_service.id})
|
||||
|
||||
api_tokens_dao.save_token_model(api_token)
|
||||
|
||||
all_tokens = api_tokens_dao.get_model_api_tokens()
|
||||
|
||||
assert len(all_tokens) == 1
|
||||
assert all_tokens[0].token == str(token)
|
||||
Reference in New Issue
Block a user