mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-15 15:28:02 -04:00
merge from main
This commit is contained in:
@@ -86,8 +86,7 @@ def test_fetch_notification_status_for_service_by_month(notify_db_session):
|
||||
|
||||
assert results[0].month.date() == date(2018, 1, 1)
|
||||
assert results[0].notification_type == NotificationType.EMAIL
|
||||
# TODO fix/investigate
|
||||
# assert results[0].notification_status == NotificationStatus.DELIVERED
|
||||
assert results[0].notification_status == NotificationStatus.DELIVERED
|
||||
assert results[0].count == 1
|
||||
|
||||
assert results[1].month.date() == date(2018, 1, 1)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import pytest
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy.exc import IntegrityError
|
||||
|
||||
from app import db
|
||||
from app.dao.inbound_numbers_dao import (
|
||||
dao_allocate_number_for_service,
|
||||
dao_get_available_inbound_numbers,
|
||||
@@ -35,7 +37,8 @@ def test_set_service_id_on_inbound_number(notify_db_session, sample_inbound_numb
|
||||
|
||||
dao_set_inbound_number_to_service(service.id, numbers[0])
|
||||
|
||||
res = InboundNumber.query.filter(InboundNumber.service_id == service.id).all()
|
||||
stmt = select(InboundNumber).filter(InboundNumber.service_id == service.id)
|
||||
res = db.session.execute(stmt).scalars().all()
|
||||
|
||||
assert len(res) == 1
|
||||
assert res[0].service_id == service.id
|
||||
|
||||
@@ -2,6 +2,7 @@ from datetime import datetime
|
||||
from itertools import product
|
||||
|
||||
from freezegun import freeze_time
|
||||
from sqlalchemy import select
|
||||
|
||||
from app import db
|
||||
from app.dao.inbound_sms_dao import (
|
||||
@@ -141,7 +142,8 @@ def test_should_delete_inbound_sms_according_to_data_retention(notify_db_session
|
||||
|
||||
deleted_count = delete_inbound_sms_older_than_retention()
|
||||
|
||||
history = InboundSmsHistory.query.all()
|
||||
stmt = select(InboundSmsHistory)
|
||||
history = db.session.execute(stmt).scalars().all()
|
||||
assert len(history) == 7
|
||||
|
||||
# four deleted for the 3-day service, two for the default seven days one, one for the 30 day
|
||||
@@ -171,7 +173,8 @@ def test_insert_into_inbound_sms_history_when_deleting_inbound_sms(sample_servic
|
||||
create_inbound_sms(sample_service, created_at=datetime(2019, 12, 19, 20, 19))
|
||||
|
||||
delete_inbound_sms_older_than_retention()
|
||||
history = InboundSmsHistory.query.all()
|
||||
stmt = select(InboundSmsHistory)
|
||||
history = db.session.execute(stmt).scalars().all()
|
||||
assert len(history) == 1
|
||||
|
||||
for key_name in [
|
||||
@@ -226,7 +229,8 @@ def test_delete_inbound_sms_older_than_retention_does_nothing_when_database_conf
|
||||
|
||||
delete_inbound_sms_older_than_retention()
|
||||
|
||||
history = InboundSmsHistory.query.all()
|
||||
stmt = select(InboundSmsHistory)
|
||||
history = db.session.execute(stmt).scalars().all()
|
||||
assert len(history) == 1
|
||||
|
||||
assert history[0].id == inbound_sms_id
|
||||
@@ -391,7 +395,7 @@ def test_most_recent_inbound_sms_only_returns_most_recent_for_each_number(
|
||||
) # noqa
|
||||
|
||||
assert len(res.items) == 2
|
||||
assert res.has_next is False
|
||||
assert res.has_next() is False
|
||||
assert res.per_page == 3
|
||||
assert res.items[0].content == "111 5"
|
||||
assert res.items[1].content == "222 2"
|
||||
@@ -454,7 +458,7 @@ def test_most_recent_inbound_sms_paginates_properly(notify_api, sample_service):
|
||||
sample_service.id, limit_days=7, page=1
|
||||
) # noqa
|
||||
assert len(res.items) == 2
|
||||
assert res.has_next is True
|
||||
assert res.has_next() is True
|
||||
assert res.per_page == 2
|
||||
assert res.items[0].content == "444 2"
|
||||
assert res.items[1].content == "333 2"
|
||||
@@ -464,7 +468,7 @@ def test_most_recent_inbound_sms_paginates_properly(notify_api, sample_service):
|
||||
sample_service.id, limit_days=7, page=2
|
||||
) # noqa
|
||||
assert len(res.items) == 2
|
||||
assert res.has_next is False
|
||||
assert res.has_next() is False
|
||||
assert res.items[0].content == "222 2"
|
||||
assert res.items[1].content == "111 2"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user