mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-21 16:01:15 -05:00
Building the methods around async stats work
This commit is contained in:
9
app/celery/statistics_tasks.py
Normal file
9
app/celery/statistics_tasks.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from app import notify_celery
|
||||
from app.statsd_decorators import statsd
|
||||
|
||||
|
||||
@notify_celery.task(bind=True, name='record_initial_job_statistics')
|
||||
@statsd(namespace="tasks")
|
||||
def record_initial_job_statistics(notification):
|
||||
pass
|
||||
|
||||
4
app/dao/statistics_dao.py
Normal file
4
app/dao/statistics_dao.py
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
|
||||
def persist_initial_job_statistics(notification):
|
||||
pass
|
||||
19
tests/app/dao/test_statistics_dao.py
Normal file
19
tests/app/dao/test_statistics_dao.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from app.dao.statistics_dao import persist_initial_job_statistics
|
||||
from app.models import JobStatistics
|
||||
from tests.app.conftest import sample_notification
|
||||
|
||||
|
||||
def test_should_create_a_stats_entry_for_a_job(
|
||||
notify_db, notify_db_session, sample_service, sample_template, sample_job
|
||||
):
|
||||
assert not len(JobStatistics.query.all())
|
||||
|
||||
notification = sample_notification(
|
||||
notify_db, notify_db_session, service=sample_service, template=sample_template, job=sample_job
|
||||
)
|
||||
|
||||
persist_initial_job_statistics(notification)
|
||||
|
||||
stats = JobStatistics.query.all()
|
||||
|
||||
assert len(stats) == 1
|
||||
Reference in New Issue
Block a user