2016-07-20 16:18:04 +01:00
import json
2020-01-16 16:58:26 +00:00
from datetime import datetime , timezone
2019-06-18 15:52:29 +01:00
2019-06-18 18:00:36 +01:00
import pytest
2018-02-20 11:22:17 +00:00
from flask import url_for
from freezegun import freeze_time
2018-04-25 14:12:58 +01:00
from app . main . views . jobs import get_time_left
2022-11-28 15:53:56 -05:00
from tests import job_json , sample_uuid , user_json
2018-02-20 11:22:17 +00:00
from tests . conftest import (
SERVICE_ONE_ID ,
2019-12-19 16:59:07 +00:00
create_active_caseworking_user ,
create_active_user_with_permissions ,
2018-02-20 11:22:17 +00:00
normalize_spaces ,
)
2016-07-20 16:18:04 +01:00
2015-12-17 16:21:34 +00:00
2020-03-02 13:48:32 +00:00
def test_old_jobs_hub_redirects (
2018-07-30 17:40:32 +01:00
client_request ,
2016-10-05 17:45:04 +01:00
) :
2020-03-02 13:48:32 +00:00
client_request . get (
2023-08-25 09:12:23 -07:00
" main.view_jobs " ,
2020-03-02 13:48:32 +00:00
service_id = SERVICE_ONE_ID ,
_expected_status = 302 ,
_expected_redirect = url_for (
2023-08-25 09:12:23 -07:00
" main.uploads " ,
2020-03-02 13:48:32 +00:00
service_id = SERVICE_ONE_ID ,
2023-08-25 09:12:23 -07:00
) ,
2020-03-02 13:48:32 +00:00
)
2018-07-30 17:40:32 +01:00
2016-06-08 16:34:26 +01:00
@pytest.mark.parametrize (
2023-08-25 09:12:23 -07:00
" user " ,
[
create_active_user_with_permissions ( ) ,
create_active_caseworking_user ( ) ,
] ,
)
@pytest.mark.parametrize (
2023-09-11 16:51:30 -04:00
( " status_argument " , " expected_api_call " ) ,
2023-08-25 09:12:23 -07:00
[
2016-06-08 16:34:26 +01:00
(
2023-08-25 09:12:23 -07:00
" " ,
2017-01-30 17:27:09 +00:00
[
2023-08-25 09:12:23 -07:00
" created " ,
" pending " ,
" sending " ,
" delivered " ,
" sent " ,
" failed " ,
" temporary-failure " ,
" permanent-failure " ,
" technical-failure " ,
" validation-failed " ,
] ,
2016-06-08 16:34:26 +01:00
) ,
2023-08-25 09:12:23 -07:00
( " sending " , [ " sending " , " created " , " pending " ] ) ,
( " delivered " , [ " delivered " , " sent " ] ) ,
2016-06-08 16:34:26 +01:00
(
2023-08-25 09:12:23 -07:00
" failed " ,
2019-01-10 15:54:31 +00:00
[
2023-08-25 09:12:23 -07:00
" failed " ,
" temporary-failure " ,
" permanent-failure " ,
" technical-failure " ,
" validation-failed " ,
] ,
) ,
] ,
2016-06-08 16:34:26 +01:00
)
2023-06-12 15:49:48 -04:00
@freeze_time ( " 2016-01-01 11:09:00.061258 " )
2016-03-02 17:36:20 +00:00
def test_should_show_page_for_one_job (
2018-07-30 17:40:32 +01:00
client_request ,
2016-03-02 17:36:20 +00:00
mock_get_service_template ,
2016-05-24 12:34:29 +01:00
mock_get_job ,
2016-05-11 11:57:31 +01:00
mocker ,
2016-05-24 12:34:29 +01:00
mock_get_notifications ,
2018-12-03 17:19:38 +00:00
mock_get_service_data_retention ,
2016-06-08 16:34:26 +01:00
fake_uuid ,
status_argument ,
2017-02-03 10:42:01 +00:00
expected_api_call ,
2018-07-30 17:40:32 +01:00
user ,
2016-03-02 17:36:20 +00:00
) :
2018-07-30 17:40:32 +01:00
page = client_request . get (
2023-08-25 09:12:23 -07:00
" main.view_job " ,
2018-07-30 17:40:32 +01:00
service_id = SERVICE_ONE_ID ,
2017-02-03 12:07:21 +00:00
job_id = fake_uuid ,
2023-08-25 09:12:23 -07:00
status = status_argument ,
2018-07-30 17:40:32 +01:00
)
2017-02-03 12:07:21 +00:00
2024-02-23 13:26:46 -08:00
assert page . h1 . text . strip ( ) == " Message status "
2023-08-25 09:12:23 -07:00
assert " " . join ( page . find ( " tbody " ) . find ( " tr " ) . text . split ( ) ) == (
2024-02-29 08:24:53 -08:00
" 2021234567 template content Delivered 01-01-2016 at 06:09 AM "
2017-02-03 12:07:21 +00:00
)
2023-08-25 09:12:23 -07:00
assert page . find ( " div " , { " data-key " : " notifications " } ) [ " data-resource " ] == url_for (
" main.view_job_updates " ,
2018-07-30 17:40:32 +01:00
service_id = SERVICE_ONE_ID ,
2017-02-03 12:07:21 +00:00
job_id = fake_uuid ,
status = status_argument ,
)
2023-08-25 09:12:23 -07:00
csv_link = page . select_one ( " a[download] " )
assert csv_link [ " href " ] == url_for (
" main.view_job_csv " ,
2018-07-30 17:40:32 +01:00
service_id = SERVICE_ONE_ID ,
2017-02-03 12:07:21 +00:00
job_id = fake_uuid ,
2023-08-25 09:12:23 -07:00
status = status_argument ,
2017-02-03 12:07:21 +00:00
)
2023-08-25 09:12:23 -07:00
assert csv_link . text == " Download this report (CSV) "
assert page . find ( " span " , { " id " : " time-left " } ) . text == " Data available for 7 days "
2019-05-09 17:33:22 +01:00
2023-08-25 09:12:23 -07:00
assert normalize_spaces ( page . select_one ( " tbody tr " ) . text ) == normalize_spaces (
2024-02-29 08:24:53 -08:00
" 2021234567 " " template content " " Delivered 01-01-2016 at 06:09 AM "
2019-05-09 17:33:22 +01:00
)
2023-08-25 09:12:23 -07:00
assert page . select_one ( " tbody tr a " ) [ " href " ] == url_for (
" main.view_notification " ,
2019-05-09 17:33:22 +01:00
service_id = SERVICE_ONE_ID ,
notification_id = sample_uuid ( ) ,
from_job = fake_uuid ,
)
2017-02-03 12:07:21 +00:00
mock_get_notifications . assert_called_with (
2023-08-25 09:12:23 -07:00
SERVICE_ONE_ID , fake_uuid , status = expected_api_call
2017-05-04 11:28:45 +01:00
)
2016-03-02 17:36:20 +00:00
2018-11-26 15:28:09 +00:00
@freeze_time ( " 2016-01-01 11:09:00.061258 " )
def test_should_show_page_for_one_job_with_flexible_data_retention (
client_request ,
active_user_with_permissions ,
mock_get_service_template ,
mock_get_job ,
mocker ,
mock_get_notifications ,
2018-12-03 17:19:38 +00:00
mock_get_service_data_retention ,
2018-11-26 15:28:09 +00:00
fake_uuid ,
) :
2023-08-25 09:12:23 -07:00
mock_get_service_data_retention . side_effect = [
[ { " days_of_retention " : 10 , " notification_type " : " sms " } ]
]
2018-11-26 15:28:09 +00:00
page = client_request . get (
2023-08-25 09:12:23 -07:00
" main.view_job " , service_id = SERVICE_ONE_ID , job_id = fake_uuid , status = " delivered "
2018-11-26 15:28:09 +00:00
)
2023-08-25 09:12:23 -07:00
assert page . find ( " span " , { " id " : " time-left " } ) . text == " Data available for 10 days "
2019-06-24 17:57:04 +01:00
assert " Cancel sending these letters " not in page
2018-11-26 15:28:09 +00:00
2017-01-13 11:37:14 +00:00
def test_get_jobs_should_tell_user_if_more_than_one_page (
2019-03-26 12:35:32 +00:00
client_request ,
2017-01-13 11:37:14 +00:00
fake_uuid ,
service_one ,
mock_get_job ,
mock_get_service_template ,
2017-02-03 10:42:01 +00:00
mock_get_notifications_with_previous_next ,
2018-12-03 17:19:38 +00:00
mock_get_service_data_retention ,
2017-01-13 11:37:14 +00:00
) :
2019-03-26 12:35:32 +00:00
page = client_request . get (
2023-08-25 09:12:23 -07:00
" main.view_job " ,
service_id = service_one [ " id " ] ,
2017-01-13 11:37:14 +00:00
job_id = fake_uuid ,
2023-08-25 09:12:23 -07:00
status = " " ,
)
assert (
page . find ( " p " , { " class " : " table-show-more-link " } ) . text . strip ( )
== " Only showing the first 50 rows "
2019-03-26 12:35:32 +00:00
)
2017-01-13 11:37:14 +00:00
2016-08-02 21:27:23 +01:00
def test_should_show_job_in_progress (
2019-03-26 12:35:32 +00:00
client_request ,
2016-08-02 21:27:23 +01:00
service_one ,
active_user_with_permissions ,
mock_get_service_template ,
mock_get_job_in_progress ,
mocker ,
mock_get_notifications ,
2018-12-03 17:19:38 +00:00
mock_get_service_data_retention ,
2017-02-03 10:42:01 +00:00
fake_uuid ,
2016-08-02 21:27:23 +01:00
) :
2019-03-26 12:35:32 +00:00
page = client_request . get (
2023-08-25 09:12:23 -07:00
" main.view_job " ,
service_id = service_one [ " id " ] ,
2019-03-26 12:35:32 +00:00
job_id = fake_uuid ,
)
2019-12-30 16:53:45 +00:00
assert [
normalize_spaces ( link . text )
2023-08-25 09:12:23 -07:00
for link in page . select ( " .pill a:not(.pill-item--selected) " )
2019-12-30 16:53:45 +00:00
] == [
2023-08-25 09:12:23 -07:00
" 10 pending text messages " ,
" 0 delivered text messages " ,
" 0 failed text messages " ,
2019-12-30 16:53:45 +00:00
]
2023-08-25 09:12:23 -07:00
assert page . select_one ( " p.hint " ) . text . strip ( ) == " Report is 50 % c omplete… "
2020-01-03 14:14:38 +00:00
def test_should_show_job_without_notifications (
client_request ,
service_one ,
active_user_with_permissions ,
mock_get_service_template ,
mock_get_job_in_progress ,
mocker ,
mock_get_notifications_with_no_notifications ,
mock_get_service_data_retention ,
fake_uuid ,
) :
page = client_request . get (
2023-08-25 09:12:23 -07:00
" main.view_job " ,
service_id = service_one [ " id " ] ,
2020-01-03 14:14:38 +00:00
job_id = fake_uuid ,
)
2019-12-30 16:53:45 +00:00
assert [
normalize_spaces ( link . text )
2023-08-25 09:12:23 -07:00
for link in page . select ( " .pill a:not(.pill-item--selected) " )
2019-12-30 16:53:45 +00:00
] == [
2023-08-25 09:12:23 -07:00
" 10 pending text messages " ,
" 0 delivered text messages " ,
" 0 failed text messages " ,
2019-12-30 16:53:45 +00:00
]
2023-08-25 09:12:23 -07:00
assert page . select_one ( " p.hint " ) . text . strip ( ) == " Report is 50 % c omplete… "
assert page . select_one ( " tbody " ) . text . strip ( ) == " No messages to show yet… "
2016-08-02 21:27:23 +01:00
2021-07-05 14:13:20 +01:00
def test_should_show_job_with_sending_limit_exceeded_status (
client_request ,
service_one ,
active_user_with_permissions ,
mock_get_service_template ,
mock_get_job_with_sending_limits_exceeded ,
mock_get_notifications_with_no_notifications ,
mock_get_service_data_retention ,
fake_uuid ,
) :
page = client_request . get (
2023-08-25 09:12:23 -07:00
" main.view_job " ,
service_id = service_one [ " id " ] ,
2021-07-05 14:13:20 +01:00
job_id = fake_uuid ,
)
2021-07-14 09:54:28 +01:00
2024-02-13 17:48:06 -08:00
assert normalize_spaces ( page . select ( " main p " ) [ 2 ] . text ) == (
2023-10-26 12:05:26 -07:00
" Notify cannot send these messages because you have reached a limit. "
" You can only send 1,000 messages per day and 250,000 messages in total. "
2021-07-14 09:54:28 +01:00
)
2024-02-13 17:48:06 -08:00
assert normalize_spaces ( page . select ( " main p " ) [ 3 ] . text ) == (
2023-07-28 11:12:46 -04:00
" Upload this spreadsheet again tomorrow or contact the Notify.gov team to raise the limit. "
2021-07-05 14:13:20 +01:00
)
2020-01-21 14:09:54 +00:00
@freeze_time ( " 2020-01-10 1:0:0 " )
2023-08-25 09:12:23 -07:00
@pytest.mark.parametrize (
2023-09-11 16:51:30 -04:00
( " created_at " , " processing_started " , " expected_message " ) ,
[
2023-08-25 09:12:23 -07:00
# Recently created, not yet started
( datetime ( 2020 , 1 , 10 , 0 , 0 , 0 ) , None , ( " No messages to show yet… " ) ) ,
# Just started
(
datetime ( 2020 , 1 , 10 , 0 , 0 , 0 ) ,
datetime ( 2020 , 1 , 10 , 0 , 0 , 1 ) ,
( " No messages to show yet… " ) ,
) ,
# Created a while ago, just started
(
datetime ( 2020 , 1 , 1 , 0 , 0 , 0 ) ,
datetime ( 2020 , 1 , 10 , 0 , 0 , 1 ) ,
( " No messages to show yet… " ) ,
) ,
# Created a while ago, started just within the last 24h
# TODO -- fails locally, should pass, tech debt due to timezone changes, re-evaluate after UTC changes
pytest . param (
datetime ( 2020 , 1 , 1 , 0 , 0 , 0 ) ,
datetime ( 2020 , 1 , 9 , 6 , 0 , 1 ) ,
( " No messages to show yet… " ) ,
) ,
# Created a while ago, started exactly 24h ago
# ---
# It doesn’ t matter that 24h (1 day) and 7 days (the service’ s data
# retention) don’ t match up. We’ re testing the case of no
# notifications existing more than 1 day after the job started
# processing. In this case we assume it’ s because the service’ s
# data retention has kicked in.
(
datetime ( 2020 , 1 , 1 , 0 , 0 , 0 ) ,
datetime ( 2020 , 1 , 9 , 1 , 0 , 0 ) ,
(
" These messages have been deleted because they were sent more than 7 days ago "
) ,
) ,
2023-09-11 16:51:30 -04:00
] ,
2023-08-25 09:12:23 -07:00
)
2019-12-30 16:25:09 +00:00
def test_should_show_old_job (
client_request ,
service_one ,
active_user_with_permissions ,
mock_get_service_template ,
mocker ,
mock_get_notifications_with_no_notifications ,
mock_get_service_data_retention ,
fake_uuid ,
2020-01-16 16:58:26 +00:00
created_at ,
processing_started ,
expected_message ,
2019-12-30 16:25:09 +00:00
) :
2023-08-25 09:12:23 -07:00
mocker . patch (
" app.job_api_client.get_job " ,
return_value = {
" data " : job_json (
SERVICE_ONE_ID ,
active_user_with_permissions ,
created_at = created_at . replace ( tzinfo = timezone . utc ) . isoformat ( ) ,
processing_started = (
processing_started . replace ( tzinfo = timezone . utc ) . isoformat ( )
if processing_started
else None
) ,
2020-01-16 16:58:26 +00:00
) ,
2023-08-25 09:12:23 -07:00
} ,
)
2019-12-30 16:25:09 +00:00
page = client_request . get (
2023-08-25 09:12:23 -07:00
" main.view_job " ,
2020-01-16 16:58:26 +00:00
service_id = SERVICE_ONE_ID ,
2019-12-30 16:25:09 +00:00
job_id = fake_uuid ,
)
2023-08-25 09:12:23 -07:00
assert not page . select ( " p.hint " )
assert not page . select ( " a[download] " )
assert page . select_one ( " tbody " ) . text . strip ( ) == expected_message
2021-06-03 09:39:31 +01:00
assert [
2024-03-26 16:06:13 -04:00
normalize_spaces ( column . text ) for column in page . select ( " main .pill .pill-item " )
2021-06-03 09:39:31 +01:00
] == [
2023-08-25 09:12:23 -07:00
" 1 total text messages " ,
2024-03-26 16:06:13 -04:00
" 1 pending text message " ,
2023-08-25 09:12:23 -07:00
" 0 delivered text messages " ,
" 0 failed text messages " ,
2021-06-03 09:39:31 +01:00
]
2016-08-02 21:27:23 +01:00
2023-11-16 12:24:27 -08:00
@freeze_time ( " 2016-01-01T06:00:00.061258 " )
2016-08-25 16:49:31 +01:00
def test_should_show_scheduled_job (
2019-03-26 12:35:32 +00:00
client_request ,
2016-08-25 16:49:31 +01:00
mock_get_service_template ,
mock_get_scheduled_job ,
2018-12-03 17:19:38 +00:00
mock_get_service_data_retention ,
2016-08-25 16:49:31 +01:00
mock_get_notifications ,
2017-02-03 10:42:01 +00:00
fake_uuid ,
2016-08-25 16:49:31 +01:00
) :
2019-03-26 12:35:32 +00:00
page = client_request . get (
2023-08-25 09:12:23 -07:00
" main.view_job " ,
2017-06-24 17:12:45 +01:00
service_id = SERVICE_ONE_ID ,
2019-03-26 12:35:32 +00:00
job_id = fake_uuid ,
)
2016-08-25 16:49:31 +01:00
2024-01-16 11:28:58 -08:00
assert normalize_spaces ( page . select ( " main div p " ) [ 1 ] . text ) == (
2024-02-23 13:26:46 -08:00
" Example template - service one was scheduled on January 02, 2016 at 12:00 AM US/Eastern by Test User "
2017-06-24 17:12:45 +01:00
)
2024-01-16 11:28:58 -08:00
2023-08-25 09:12:23 -07:00
assert page . select ( " main p a " ) [ 0 ] [ " href " ] == url_for (
2024-07-30 14:24:02 -04:00
" main.message_status " ,
2017-06-24 17:12:45 +01:00
)
2023-08-25 09:12:23 -07:00
assert page . select_one ( " main button[type=submit] " ) . text . strip ( ) == " Cancel sending "
2016-09-01 15:40:49 +01:00
def test_should_cancel_job (
2019-03-26 12:35:32 +00:00
client_request ,
2016-09-01 15:40:49 +01:00
fake_uuid ,
2020-01-08 12:23:09 +00:00
mock_get_job ,
mock_get_service_template ,
2017-02-03 10:42:01 +00:00
mocker ,
2016-09-01 15:40:49 +01:00
) :
2023-08-25 09:12:23 -07:00
mock_cancel = mocker . patch ( " app.job_api_client.cancel_job " )
2019-03-26 12:35:32 +00:00
client_request . post (
2023-08-25 09:12:23 -07:00
" main.cancel_job " ,
2019-03-26 12:35:32 +00:00
service_id = SERVICE_ONE_ID ,
job_id = fake_uuid ,
_expected_status = 302 ,
_expected_redirect = url_for (
2023-08-25 09:12:23 -07:00
" main.service_dashboard " ,
2019-03-26 12:35:32 +00:00
service_id = SERVICE_ONE_ID ,
2023-08-25 09:12:23 -07:00
) ,
2019-03-26 12:35:32 +00:00
)
2016-09-01 15:40:49 +01:00
2019-03-26 12:35:32 +00:00
mock_cancel . assert_called_once_with ( SERVICE_ONE_ID , fake_uuid )
2016-08-25 16:49:31 +01:00
2016-09-01 15:46:16 +01:00
def test_should_not_show_cancelled_job (
2019-03-26 12:35:32 +00:00
client_request ,
2016-09-01 15:46:16 +01:00
active_user_with_permissions ,
mock_get_cancelled_job ,
2017-02-03 10:42:01 +00:00
fake_uuid ,
2016-09-01 15:46:16 +01:00
) :
2019-03-26 12:35:32 +00:00
client_request . get (
2023-08-25 09:12:23 -07:00
" main.view_job " ,
2019-03-26 12:35:32 +00:00
service_id = SERVICE_ONE_ID ,
job_id = fake_uuid ,
_expected_status = 404 ,
)
2016-09-01 15:46:16 +01:00
2022-11-22 22:50:47 -05:00
@freeze_time ( " 2016-01-01 05:00:00.000001 " )
2016-03-02 17:36:20 +00:00
def test_should_show_updates_for_one_job_as_json (
2021-12-31 12:08:14 +00:00
client_request ,
2016-03-02 17:36:20 +00:00
service_one ,
2016-05-11 11:57:31 +01:00
active_user_with_permissions ,
2016-03-23 12:15:57 +00:00
mock_get_notifications ,
2017-06-24 17:12:45 +01:00
mock_get_service_template ,
2016-05-24 12:34:29 +01:00
mock_get_job ,
2018-12-03 17:19:38 +00:00
mock_get_service_data_retention ,
2016-05-24 12:34:29 +01:00
mocker ,
2017-02-03 10:42:01 +00:00
fake_uuid ,
2016-03-02 17:36:20 +00:00
) :
2021-12-31 12:16:12 +00:00
response = client_request . get_response (
2023-08-25 09:12:23 -07:00
" main.view_job_updates " ,
service_id = service_one [ " id " ] ,
2021-12-31 12:08:14 +00:00
job_id = fake_uuid ,
)
2017-02-03 12:07:21 +00:00
content = json . loads ( response . get_data ( as_text = True ) )
2023-08-25 09:12:23 -07:00
assert " pending " in content [ " counts " ]
assert " delivered " in content [ " counts " ]
assert " failed " in content [ " counts " ]
assert " Recipient " in content [ " notifications " ]
assert " 2021234567 " in content [ " notifications " ]
2024-07-30 14:24:02 -04:00
assert " Message status " in content [ " notifications " ]
2023-08-25 09:12:23 -07:00
assert " Delivered " in content [ " notifications " ]
2024-03-26 12:37:06 -07:00
assert " 01-01-2016 at 12:00 AM " in content [ " notifications " ]
2016-03-16 16:57:10 +00:00
2022-11-22 22:50:47 -05:00
@freeze_time ( " 2016-01-01 05:00:00.000001 " )
2020-01-28 10:32:21 +00:00
def test_should_show_updates_for_scheduled_job_as_json (
2021-12-31 12:08:14 +00:00
client_request ,
2020-01-28 10:32:21 +00:00
service_one ,
active_user_with_permissions ,
mock_get_notifications ,
mock_get_service_template ,
mock_get_service_data_retention ,
mocker ,
fake_uuid ,
) :
2023-08-25 09:12:23 -07:00
mocker . patch (
" app.job_api_client.get_job " ,
return_value = {
" data " : job_json (
service_one [ " id " ] ,
created_by = user_json ( ) ,
job_id = fake_uuid ,
scheduled_for = " 2016-06-01T18:00:00+00:00 " ,
processing_started = " 2016-06-01T20:00:00+00:00 " ,
)
} ,
)
2020-01-28 10:32:21 +00:00
2021-12-31 12:16:12 +00:00
response = client_request . get_response (
2023-08-25 09:12:23 -07:00
" main.view_job_updates " ,
service_id = service_one [ " id " ] ,
2021-12-31 12:08:14 +00:00
job_id = fake_uuid ,
)
2020-01-28 10:32:21 +00:00
content = response . json
2023-08-25 09:12:23 -07:00
assert " pending " in content [ " counts " ]
assert " delivered " in content [ " counts " ]
assert " failed " in content [ " counts " ]
assert " Recipient " in content [ " notifications " ]
assert " 2021234567 " in content [ " notifications " ]
2024-07-30 14:24:02 -04:00
assert " Message status " in content [ " notifications " ]
2023-08-25 09:12:23 -07:00
assert " Delivered " in content [ " notifications " ]
2024-03-26 12:37:06 -07:00
assert " 01-01-2016 at 12:00 AM " in content [ " notifications " ]
2020-01-28 10:32:21 +00:00
2016-07-20 11:50:22 +01:00
@pytest.mark.parametrize (
2023-09-11 16:51:30 -04:00
( " job_created_at " , " expected_message " ) ,
2023-08-25 09:12:23 -07:00
[
2016-07-20 11:50:22 +01:00
( " 2016-01-10 11:09:00.000000+00:00 " , " Data available for 7 days " ) ,
( " 2016-01-04 11:09:00.000000+00:00 " , " Data available for 1 day " ) ,
2018-11-26 15:15:06 +00:00
( " 2016-01-03 11:09:00.000000+00:00 " , " Data available for 12 hours " ) ,
2023-08-25 09:12:23 -07:00
( " 2016-01-02 23:59:59.000000+00:00 " , " Data no longer available " ) ,
] ,
2016-07-20 11:50:22 +01:00
)
@freeze_time ( " 2016-01-10 12:00:00.000000 " )
def test_time_left ( job_created_at , expected_message ) :
assert get_time_left ( job_created_at ) == expected_message
2024-01-16 11:28:58 -08:00
2024-01-16 12:01:39 -08:00
2024-01-16 11:28:58 -08:00
def test_should_show_message_note (
client_request ,
mock_get_service_template ,
mock_get_scheduled_job ,
mock_get_service_data_retention ,
mock_get_notifications ,
fake_uuid ,
) :
page = client_request . get (
" main.view_job " ,
service_id = SERVICE_ONE_ID ,
job_id = fake_uuid ,
)
assert normalize_spaces ( page . select_one ( " main p.notification-status " ) . text ) == (
2024-07-30 14:24:02 -04:00
' Messages are sent immediately to the cell phone carrier, but will remain in " pending " status until we hear back from the carrier they have received it and attempted deliver. More information on delivery status. '
2024-01-16 11:28:58 -08:00
)