get all inbound sms should default to 7 days, not 6

to be consistent with other checks.
This commit is contained in:
Leo Hemsted
2019-02-28 15:28:13 +00:00
parent b4d1a590b7
commit 7683e340cc
2 changed files with 4 additions and 9 deletions

View File

@@ -14,7 +14,7 @@ def dao_create_inbound_sms(inbound_sms):
db.session.add(inbound_sms) db.session.add(inbound_sms)
def dao_get_inbound_sms_for_service(service_id, limit=None, user_number=None, limit_days=6): def dao_get_inbound_sms_for_service(service_id, limit=None, user_number=None, limit_days=7):
q = InboundSms.query.filter( q = InboundSms.query.filter(
InboundSms.service_id == service_id InboundSms.service_id == service_id
).order_by( ).order_by(

View File

@@ -58,15 +58,10 @@ def test_get_all_inbound_sms_filters_on_service(notify_db_session):
def test_get_all_inbound_sms_filters_on_time(sample_service, notify_db_session): def test_get_all_inbound_sms_filters_on_time(sample_service, notify_db_session):
create_inbound_sms(sample_service, user_number='447700900111', content='111 1', created_at=datetime(2017, 1, 2)) create_inbound_sms(sample_service, created_at=datetime(2017, 8, 6, 22, 59)) # sunday evening
sms_two = create_inbound_sms( sms_two = create_inbound_sms(sample_service, created_at=datetime(2017, 8, 6, 23, 0)) # monday (7th) morning
sample_service,
user_number='447700900111',
content='111 2',
created_at=datetime(2017, 1, 3)
)
with freeze_time('2017-01-09'): with freeze_time('2017-08-14 12:00'):
res = dao_get_inbound_sms_for_service(sample_service.id) res = dao_get_inbound_sms_for_service(sample_service.id)
assert len(res) == 1 assert len(res) == 1