notify-34 fix skipped tests

This commit is contained in:
Kenneth Kehl
2023-05-18 09:46:36 -07:00
parent 49a73a2238
commit 6e597aafad
7 changed files with 7 additions and 22 deletions

View File

@@ -108,10 +108,9 @@ def test_create_nightly_notification_status_triggers_relevant_tasks(
assert types == expected_types_aggregated
@pytest.mark.skip(reason="Needs updating for TTS: Timezone handling")
def test_create_nightly_billing_for_day_checks_history(
sample_service,
sample_sms_template,
sample_template,
mocker
):
yesterday = datetime.now() - timedelta(days=1)
@@ -119,13 +118,13 @@ def test_create_nightly_billing_for_day_checks_history(
create_notification(
created_at=yesterday,
template=sample_sms_template,
template=sample_template,
status='sending',
)
create_notification_history(
created_at=yesterday,
template=sample_sms_template,
template=sample_template,
status='delivered',
)
@@ -141,7 +140,6 @@ def test_create_nightly_billing_for_day_checks_history(
assert record.notifications_sent == 2
@pytest.mark.skip(reason="Needs updating for TTS: Timezone handling")
@pytest.mark.parametrize('second_rate, records_num, billable_units, multiplier',
[(1.0, 1, 2, [1]),
(2.0, 2, 1, [1, 2])])
@@ -193,7 +191,6 @@ def test_create_nightly_billing_for_day_sms_rate_multiplier(
assert record.rate_multiplier == multiplier[i]
@pytest.mark.skip(reason="Needs updating for TTS: Timezone handling")
def test_create_nightly_billing_for_day_different_templates(
sample_service,
sample_template,
@@ -285,7 +282,6 @@ def test_create_nightly_billing_for_day_different_sent_by(
assert record.rate_multiplier == 1.0
@pytest.mark.skip(reason="Needs updating for TTS: Timezone handling")
def test_create_nightly_billing_for_day_null_sent_by_sms(
sample_service,
sample_template,
@@ -497,7 +493,6 @@ def test_create_nightly_notification_status_for_service_and_day(notify_db_sessio
assert sms_delivered_row.key_type == KEY_TYPE_NORMAL
@pytest.mark.skip(reason="Needs updating for TTS: Timezone handling")
def test_create_nightly_notification_status_for_service_and_day_overwrites_old_data(notify_db_session):
first_service = create_service(service_name='First Service')
first_template = create_template(service=first_service)

View File

@@ -15,9 +15,8 @@ def fake_client(notify_api):
return fake_client
@pytest.mark.skip(reason="Needs updating for TTS: New SMS client")
def test_send_sms(fake_client, mocker):
mock_send = mocker.patch.object(fake_client, 'try_send_sms')
mock_send = mocker.patch.object(fake_client, 'send_sms')
fake_client.send_sms(
to='to',
@@ -28,14 +27,13 @@ def test_send_sms(fake_client, mocker):
)
mock_send.assert_called_with(
'to', 'content', 'reference', False, 'testing'
to='to', content='content', reference='reference', international=False, sender='testing'
)
@pytest.mark.skip(reason="Needs updating for TTS: New SMS client")
def test_send_sms_error(fake_client, mocker):
mocker.patch.object(
fake_client, 'try_send_sms', side_effect=SmsClientResponseException('error')
fake_client, 'send_sms', side_effect=SmsClientResponseException('error')
)
with pytest.raises(SmsClientResponseException):

View File

@@ -211,8 +211,6 @@ def test_fetch_billing_data_for_day_returns_empty_list(notify_db_session):
assert results == []
# TODO: ready for reactivation?
@pytest.mark.skip(reason="Needs updating for TTS: Timezone handling")
def test_fetch_billing_data_for_day_uses_correct_table(notify_db_session):
service = create_service()
create_service_data_retention(service, notification_type='email', days_of_retention=3)

View File

@@ -116,7 +116,7 @@ def test_get_jobs_for_service(sample_template):
assert one_job_from_db != other_job_from_db
@pytest.mark.skip(reason="Needs updating for TTS: Timezone handling")
# @pytest.mark.skip(reason="Needs updating for TTS: Timezone handling")
def test_get_jobs_for_service_with_limit_days_param(sample_template):
one_job = create_job(sample_template)
old_job = create_job(sample_template, created_at=datetime.now() - timedelta(days=8))

View File

@@ -871,7 +871,6 @@ def test_dao_fetch_todays_stats_for_service_only_includes_during_utc(notify_db_s
assert not stats.get('permanent-failure')
@pytest.mark.skip(reason="Needs updating for TTS: Timezone handling")
def test_dao_fetch_todays_stats_for_all_services_includes_all_services(notify_db_session):
# two services, each with an email and sms notification
service1 = create_service(service_name='service 1', email_from='service.1')
@@ -910,7 +909,6 @@ def test_dao_fetch_todays_stats_for_all_services_only_includes_today(notify_db_s
assert stats['failed'] == 1
@pytest.mark.skip(reason="Needs updating for TTS: Timezone handling")
def test_dao_fetch_todays_stats_for_all_services_groups_correctly(notify_db_session):
service1 = create_service(service_name='service 1', email_from='service.1')
service2 = create_service(service_name='service 2', email_from='service.2')
@@ -937,7 +935,6 @@ def test_dao_fetch_todays_stats_for_all_services_groups_correctly(notify_db_sess
service2.created_at, 'sms', 'created', 1) in stats
@pytest.mark.skip(reason="Needs updating for TTS: Timezone handling")
def test_dao_fetch_todays_stats_for_all_services_includes_all_keys_by_default(notify_db_session):
template = create_template(service=create_service())
create_notification(template=template, key_type=KEY_TYPE_NORMAL)
@@ -950,7 +947,6 @@ def test_dao_fetch_todays_stats_for_all_services_includes_all_keys_by_default(no
assert stats[0].count == 3
@pytest.mark.skip(reason="Needs updating for TTS: Timezone handling")
def test_dao_fetch_todays_stats_for_all_services_can_exclude_from_test_key(notify_db_session):
template = create_template(service=create_service())
create_notification(template=template, key_type=KEY_TYPE_NORMAL)

View File

@@ -587,7 +587,6 @@ def test_check_reply_to_sms_type(sample_service):
assert check_reply_to(sample_service.id, sms_sender.id, SMS_TYPE) == '123456'
@pytest.mark.skip(reason="Needs updating for TTS: Failing for unknown reason")
def test_check_if_service_can_send_files_by_email_raises_if_no_contact_link_set(sample_service):
with pytest.raises(BadRequestError) as e:
check_if_service_can_send_files_by_email(

View File

@@ -238,7 +238,6 @@ def test_should_cache_template_lookups_in_memory(mocker, client, sample_template
assert Notification.query.count() == 5
@pytest.mark.skip(reason="Needs updating for TTS: cloud.gov redis fails, local docker works, mock redis fails")
def test_should_cache_template_and_service_in_redis(mocker, client, sample_template):
from app.schemas import service_schema, template_schema