Beispiel #1
0
def test_provider_email_delivery_via_api(client):
    notification_id = send_notification_via_api(
        client, config['service']['templates']['email'],
        config['user']['email'], 'email')
    notification = retry_call(
        get_notification_by_id_via_api,
        fargs=[client, notification_id, NotificationStatuses.DELIVERED],
        tries=config['provider_retry_times'],
        delay=config['provider_retry_interval'])
    assert_notification_body(notification_id, notification)
def test_send_sms_notification_via_api(client):
    notification_id = send_notification_via_api(
        client, config['service']['templates']['sms'],
        config['user']['mobile'], 'sms')

    notification = retry_call(
        get_notification_by_id_via_api,
        fargs=[client, notification_id, NotificationStatuses.SENT],
        tries=config['notification_retry_times'],
        delay=config['notification_retry_interval'])
    assert_notification_body(notification_id, notification)
Beispiel #3
0
def test_send_letter_notification_via_api(seeded_client_using_test_key):
    notification_id = send_notification_via_api(
        seeded_client_using_test_key, config['service']['templates']['letter'],
        config['letter_contact_data'], 'letter')

    notification = retry_call(get_notification_by_id_via_api,
                              fargs=[
                                  seeded_client_using_test_key,
                                  notification_id,
                                  NotificationStatuses.RECEIVED
                              ],
                              tries=config['notification_retry_times'],
                              delay=config['notification_retry_interval'])
    assert_notification_body(notification_id, notification)
def test_send_csv(driver, login_seeded_user, seeded_client,
                  seeded_client_using_test_key, message_type):
    dashboard_page = DashboardPage(driver)
    dashboard_page.go_to_dashboard_for_service(
        service_id=config['service']['id'])

    template_id = {
        'email': config['service']['templates']['email'],
        'sms': config['service']['templates']['sms'],
        'letter': config['service']['templates']['letter'],
    }.get(message_type)

    dashboard_stats_before = get_dashboard_stats(dashboard_page, message_type,
                                                 template_id)

    upload_csv_page = UploadCsvPage(driver)
    notification_id = send_notification_via_csv(upload_csv_page,
                                                message_type,
                                                seeded=True)

    notification = retry_call(get_notification_by_id_via_api,
                              fargs=[
                                  seeded_client_using_test_key if message_type
                                  == 'letter' else seeded_client,
                                  notification_id,
                                  NotificationStatuses.ACCEPTED if message_type
                                  == 'letter' else NotificationStatuses.SENT
                              ],
                              tries=config['notification_retry_times'],
                              delay=config['notification_retry_interval'])
    assert_notification_body(notification_id, notification)

    # test the whole letter creation flow, by checking the PDF has been created
    if message_type == 'letter':
        retry_call(get_pdf_for_letter_via_api,
                   fargs=[seeded_client, notification_id],
                   tries=config['notification_retry_times'],
                   delay=config['notification_retry_interval'])

    dashboard_page.go_to_dashboard_for_service(
        service_id=config['service']['id'])

    dashboard_stats_after = get_dashboard_stats(dashboard_page, message_type,
                                                template_id)

    assert_dashboard_stats(dashboard_stats_before, dashboard_stats_after)
Beispiel #5
0
def test_admin(driver, client, login_user):
    upload_csv_page = UploadCsvPage(driver)

    csv_sms_notification_id = send_notification_via_csv(upload_csv_page, 'sms')
    csv_sms_notification = retry_call(
        get_notification_by_id_via_api,
        fargs=[client, csv_sms_notification_id, NotificationStatuses.SENT],
        tries=config['notification_retry_times'],
        delay=config['notification_retry_interval'])
    assert_notification_body(csv_sms_notification_id, csv_sms_notification)

    csv_email_notification_id = send_notification_via_csv(
        upload_csv_page, 'email')
    csv_email_notification = retry_call(
        get_notification_by_id_via_api,
        fargs=[client, csv_email_notification_id, NotificationStatuses.SENT],
        tries=config['notification_retry_times'],
        delay=config['notification_retry_interval'])

    assert_notification_body(csv_email_notification_id, csv_email_notification)

    upload_csv_page.sign_out()