mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-11 02:23:32 -04:00
notify-34 fix skipped tests
This commit is contained in:
@@ -108,10 +108,9 @@ def test_create_nightly_notification_status_triggers_relevant_tasks(
|
|||||||
assert types == expected_types_aggregated
|
assert types == expected_types_aggregated
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skip(reason="Needs updating for TTS: Timezone handling")
|
|
||||||
def test_create_nightly_billing_for_day_checks_history(
|
def test_create_nightly_billing_for_day_checks_history(
|
||||||
sample_service,
|
sample_service,
|
||||||
sample_sms_template,
|
sample_template,
|
||||||
mocker
|
mocker
|
||||||
):
|
):
|
||||||
yesterday = datetime.now() - timedelta(days=1)
|
yesterday = datetime.now() - timedelta(days=1)
|
||||||
@@ -119,13 +118,13 @@ def test_create_nightly_billing_for_day_checks_history(
|
|||||||
|
|
||||||
create_notification(
|
create_notification(
|
||||||
created_at=yesterday,
|
created_at=yesterday,
|
||||||
template=sample_sms_template,
|
template=sample_template,
|
||||||
status='sending',
|
status='sending',
|
||||||
)
|
)
|
||||||
|
|
||||||
create_notification_history(
|
create_notification_history(
|
||||||
created_at=yesterday,
|
created_at=yesterday,
|
||||||
template=sample_sms_template,
|
template=sample_template,
|
||||||
status='delivered',
|
status='delivered',
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -141,7 +140,6 @@ def test_create_nightly_billing_for_day_checks_history(
|
|||||||
assert record.notifications_sent == 2
|
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',
|
@pytest.mark.parametrize('second_rate, records_num, billable_units, multiplier',
|
||||||
[(1.0, 1, 2, [1]),
|
[(1.0, 1, 2, [1]),
|
||||||
(2.0, 2, 1, [1, 2])])
|
(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]
|
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(
|
def test_create_nightly_billing_for_day_different_templates(
|
||||||
sample_service,
|
sample_service,
|
||||||
sample_template,
|
sample_template,
|
||||||
@@ -285,7 +282,6 @@ def test_create_nightly_billing_for_day_different_sent_by(
|
|||||||
assert record.rate_multiplier == 1.0
|
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(
|
def test_create_nightly_billing_for_day_null_sent_by_sms(
|
||||||
sample_service,
|
sample_service,
|
||||||
sample_template,
|
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
|
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):
|
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_service = create_service(service_name='First Service')
|
||||||
first_template = create_template(service=first_service)
|
first_template = create_template(service=first_service)
|
||||||
|
|||||||
@@ -15,9 +15,8 @@ def fake_client(notify_api):
|
|||||||
return fake_client
|
return fake_client
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skip(reason="Needs updating for TTS: New SMS client")
|
|
||||||
def test_send_sms(fake_client, mocker):
|
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(
|
fake_client.send_sms(
|
||||||
to='to',
|
to='to',
|
||||||
@@ -28,14 +27,13 @@ def test_send_sms(fake_client, mocker):
|
|||||||
)
|
)
|
||||||
|
|
||||||
mock_send.assert_called_with(
|
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):
|
def test_send_sms_error(fake_client, mocker):
|
||||||
mocker.patch.object(
|
mocker.patch.object(
|
||||||
fake_client, 'try_send_sms', side_effect=SmsClientResponseException('error')
|
fake_client, 'send_sms', side_effect=SmsClientResponseException('error')
|
||||||
)
|
)
|
||||||
|
|
||||||
with pytest.raises(SmsClientResponseException):
|
with pytest.raises(SmsClientResponseException):
|
||||||
|
|||||||
@@ -211,8 +211,6 @@ def test_fetch_billing_data_for_day_returns_empty_list(notify_db_session):
|
|||||||
assert results == []
|
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):
|
def test_fetch_billing_data_for_day_uses_correct_table(notify_db_session):
|
||||||
service = create_service()
|
service = create_service()
|
||||||
create_service_data_retention(service, notification_type='email', days_of_retention=3)
|
create_service_data_retention(service, notification_type='email', days_of_retention=3)
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ def test_get_jobs_for_service(sample_template):
|
|||||||
assert one_job_from_db != other_job_from_db
|
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):
|
def test_get_jobs_for_service_with_limit_days_param(sample_template):
|
||||||
one_job = create_job(sample_template)
|
one_job = create_job(sample_template)
|
||||||
old_job = create_job(sample_template, created_at=datetime.now() - timedelta(days=8))
|
old_job = create_job(sample_template, created_at=datetime.now() - timedelta(days=8))
|
||||||
|
|||||||
@@ -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')
|
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):
|
def test_dao_fetch_todays_stats_for_all_services_includes_all_services(notify_db_session):
|
||||||
# two services, each with an email and sms notification
|
# two services, each with an email and sms notification
|
||||||
service1 = create_service(service_name='service 1', email_from='service.1')
|
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
|
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):
|
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')
|
service1 = create_service(service_name='service 1', email_from='service.1')
|
||||||
service2 = create_service(service_name='service 2', email_from='service.2')
|
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
|
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):
|
def test_dao_fetch_todays_stats_for_all_services_includes_all_keys_by_default(notify_db_session):
|
||||||
template = create_template(service=create_service())
|
template = create_template(service=create_service())
|
||||||
create_notification(template=template, key_type=KEY_TYPE_NORMAL)
|
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
|
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):
|
def test_dao_fetch_todays_stats_for_all_services_can_exclude_from_test_key(notify_db_session):
|
||||||
template = create_template(service=create_service())
|
template = create_template(service=create_service())
|
||||||
create_notification(template=template, key_type=KEY_TYPE_NORMAL)
|
create_notification(template=template, key_type=KEY_TYPE_NORMAL)
|
||||||
|
|||||||
@@ -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'
|
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):
|
def test_check_if_service_can_send_files_by_email_raises_if_no_contact_link_set(sample_service):
|
||||||
with pytest.raises(BadRequestError) as e:
|
with pytest.raises(BadRequestError) as e:
|
||||||
check_if_service_can_send_files_by_email(
|
check_if_service_can_send_files_by_email(
|
||||||
|
|||||||
@@ -238,7 +238,6 @@ def test_should_cache_template_lookups_in_memory(mocker, client, sample_template
|
|||||||
assert Notification.query.count() == 5
|
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):
|
def test_should_cache_template_and_service_in_redis(mocker, client, sample_template):
|
||||||
|
|
||||||
from app.schemas import service_schema, template_schema
|
from app.schemas import service_schema, template_schema
|
||||||
|
|||||||
Reference in New Issue
Block a user