mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-09 14:49:49 -04:00
fix more
This commit is contained in:
@@ -1,9 +1,14 @@
|
||||
from sqlalchemy import func, select
|
||||
|
||||
from app import db
|
||||
from app.dao.events_dao import dao_create_event
|
||||
from app.models import Event
|
||||
|
||||
|
||||
def test_create_event(notify_db_session):
|
||||
assert Event.query.count() == 0
|
||||
stmt = select(func.count()).select_from(Event)
|
||||
count = db.session.execute(stmt).scalar() or 0
|
||||
assert count == 0
|
||||
data = {
|
||||
"event_type": "sucessful_login",
|
||||
"data": {"something": "random", "in_fact": "could be anything"},
|
||||
@@ -12,6 +17,8 @@ def test_create_event(notify_db_session):
|
||||
event = Event(**data)
|
||||
dao_create_event(event)
|
||||
|
||||
assert Event.query.count() == 1
|
||||
stmt = select(func.count()).select_from(Event)
|
||||
count = db.session.execute(stmt).scalar() or 0
|
||||
assert count == 1
|
||||
event_from_db = Event.query.first()
|
||||
assert event == event_from_db
|
||||
|
||||
Reference in New Issue
Block a user