combine post + get inbound, and make them respect data retention

also removed the limit/limit_days args as they're not used by admin
This commit is contained in:
Leo Hemsted
2019-03-28 15:36:12 +00:00
parent 329fa9ba0d
commit cf248a2af3
5 changed files with 82 additions and 52 deletions

View File

@@ -62,7 +62,7 @@ def test_get_all_inbound_sms_filters_on_time(sample_service, notify_db_session):
sms_two = create_inbound_sms(sample_service, created_at=datetime(2017, 8, 6, 23, 0)) # monday (7th) morning
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, limit_days=7)
assert len(res) == 1
assert res[0] == sms_two
@@ -118,13 +118,13 @@ def test_should_delete_inbound_sms_according_to_data_retention(notify_db_session
# four deleted for the 3-day service, two for the default seven days one, one for the 30 day
assert deleted_count == 7
assert {
x.created_at for x in dao_get_inbound_sms_for_service(short_retention_service.id, limit_days=None)
x.created_at for x in dao_get_inbound_sms_for_service(short_retention_service.id)
} == set(dates[:1])
assert {
x.created_at for x in dao_get_inbound_sms_for_service(no_retention_service.id, limit_days=None)
x.created_at for x in dao_get_inbound_sms_for_service(no_retention_service.id)
} == set(dates[:3])
assert {
x.created_at for x in dao_get_inbound_sms_for_service(long_retention_service.id, limit_days=None)
x.created_at for x in dao_get_inbound_sms_for_service(long_retention_service.id)
} == set(dates[:4])