Add api_token model and dao

This commit is contained in:
Rebecca Law
2016-01-13 09:25:46 +00:00
parent 25f9d85f04
commit 3a3f9becec
5 changed files with 54 additions and 1 deletions

View 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)