mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
Endpoint for recording events in api.
An event has an id, a type and a blob of json attached.
This commit is contained in:
19
tests/app/dao/test_events_dao.py
Normal file
19
tests/app/dao/test_events_dao.py
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
from app.dao.events_dao import dao_create_event
|
||||
|
||||
from app.models import Event
|
||||
|
||||
|
||||
def test_create_event(notify_db, notify_db_session):
|
||||
assert Event.query.count() == 0
|
||||
data = {
|
||||
'event_type': 'sucessful_login',
|
||||
'data': {'something': 'random', 'in_fact': 'could be anything'}
|
||||
}
|
||||
|
||||
event = Event(**data)
|
||||
dao_create_event(event)
|
||||
|
||||
assert Event.query.count() == 1
|
||||
event_from_db = Event.query.first()
|
||||
assert event == event_from_db
|
||||
Reference in New Issue
Block a user