mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-08 04:48:24 -04:00
All four http methods working now for user and service restful apis.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import pytest
|
||||
from app.dao.services_dao import (
|
||||
create_model_service, get_model_services, DAOException)
|
||||
save_model_service, get_model_services, DAOException)
|
||||
from tests.app.conftest import sample_service as create_sample_service
|
||||
from app.models import Service
|
||||
|
||||
@@ -15,7 +15,7 @@ def test_create_service(notify_api, notify_db, notify_db_session, sample_user):
|
||||
'active': False,
|
||||
'restricted': False}
|
||||
service = Service(**data)
|
||||
create_model_service(service)
|
||||
save_model_service(service)
|
||||
assert Service.query.count() == 1
|
||||
assert Service.query.first().name == service_name
|
||||
assert Service.query.first().id == service.id
|
||||
@@ -58,7 +58,7 @@ def test_missing_user_attribute(notify_api, notify_db, notify_db_session):
|
||||
'restricted': False}
|
||||
|
||||
service = Service(**data)
|
||||
create_model_service(service)
|
||||
save_model_service(service)
|
||||
pytest.fail("DAOException not thrown")
|
||||
except DAOException as e:
|
||||
assert "Missing data for required attribute" in str(e)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from sqlalchemy.exc import DataError
|
||||
from sqlalchemy.orm.exc import NoResultFound
|
||||
from app.dao.users_dao import (create_model_user, get_model_users)
|
||||
from app.dao.users_dao import (save_model_user, get_model_users)
|
||||
from tests.app.conftest import sample_user as create_sample_user
|
||||
from app.models import User
|
||||
|
||||
@@ -8,7 +8,7 @@ from app.models import User
|
||||
def test_create_user(notify_api, notify_db, notify_db_session):
|
||||
email = 'notify@digital.cabinet-office.gov.uk'
|
||||
user = User(**{'email_address': email})
|
||||
create_model_user(user)
|
||||
save_model_user(user)
|
||||
assert User.query.count() == 1
|
||||
assert User.query.first().email_address == email
|
||||
assert User.query.first().id == user.id
|
||||
|
||||
Reference in New Issue
Block a user