Esempio n. 1
0
def test_send_email_with_icn(notification_url, service_id,
                             service_test_api_key, template_id):
    service_jwt = encode_jwt(service_id, service_test_api_key)

    email_response = send_email_with_icn(notification_url, service_jwt,
                                         template_id)
    assert email_response.status_code == 201
    notification_id = get_notification_id(email_response)

    desired_status = 'delivered'
    notification_status_response = wait_for_status(notification_id,
                                                   notification_url,
                                                   service_id,
                                                   service_test_api_key,
                                                   desired_status)

    assert notification_status_response['status'] == desired_status
    assert notification_status_response['email_address'] is not None
    assert notification_status_response['sent_by'] is not None

    found_va_profile_ids = [
        identifier
        for identifier in notification_status_response['recipient_identifiers']
        if identifier['id_type'] == 'VAPROFILEID'
    ]
    assert len(found_va_profile_ids) == 1
Esempio n. 2
0
def test_email():
    organizations = get_organizations()
    assert organizations.status_code == 200
    services = get_services()
    assert services.status_code == 200
    service_id = get_services_id(services.json()['data'])
    users = get_users()
    assert users.status_code == 200
    user_id = get_user_id(users.json()['data'], service_id)
    templates = get_templates(service_id)
    template_id = get_template_id(templates.json()['data'], service_id)
    assert templates.status_code == 200
    old_key = get_api_key(service_id)
    assert old_key.status_code == 200
    old_key_id = get_right_api_key(old_key.json()["apiKeys"])
    response = revoke_key(old_key_id, service_id)
    assert response.status_code == 202
    service_key = create_api_key(service_id, user_id)
    assert service_key.status_code == 201
    service_jwt = get_service_jwt(service_key.json()["data"], service_id)
    email_response = send_email(service_jwt, template_id)
    assert email_response.status_code == 201
    notification_id = get_notification_id(email_response)
    time_count = 0
    notification_status = ""
    while notification_status != "sending" and time_count < 30:
        notification_status_response = get_notification_status(
            service_jwt, notification_id)
        assert notification_status_response.status_code == 200
        notification_status = notification_status_response.json()['status']
        time.sleep(1)
        time_count = time_count + 1
    assert notification_status == 'sending'
Esempio n. 3
0
def test_send_email(notification_url, service_id, service_api_key,
                    template_id):
    service_jwt = encode_jwt(service_id, service_api_key)

    email_response = send_email_with_email_address(notification_url,
                                                   service_jwt, template_id)
    assert email_response.status_code == 201
    notification_id = get_notification_id(email_response)

    desired_status = 'sending'
    notification_status_response = wait_for_status(notification_id,
                                                   notification_url,
                                                   service_id, service_api_key,
                                                   desired_status)

    assert notification_status_response['status'] == desired_status
    assert notification_status_response['email_address'] is not None
    assert notification_status_response['sent_by'] == 'govdelivery'
Esempio n. 4
0
def test_send_text_with_profile_id(notification_url, service_test_api_key,
                                   service_id, sms_template_id):
    service_jwt = encode_jwt(service_id, service_test_api_key)

    sms_response = send_sms_with_va_profile_id(notification_url, service_jwt,
                                               sms_template_id)
    assert sms_response.status_code == 201
    notification_id = get_notification_id(sms_response)

    desired_status = 'delivered'
    notification_status_response = wait_for_status(notification_id,
                                                   notification_url,
                                                   service_id,
                                                   service_test_api_key,
                                                   desired_status)

    assert notification_status_response['status'] == desired_status
    assert notification_status_response['phone_number'] is not None
    assert notification_status_response['sent_by'] is not None
Esempio n. 5
0
def test_send_text(notification_url, service_test_api_key, service_id,
                   sms_template_id):
    service_jwt = encode_jwt(service_id, service_test_api_key)

    sms_response = send_sms_with_phone_number(
        notification_url, service_jwt, sms_template_id,
        VALID_TEST_RECIPIENT_PHONE_NUMBER)
    assert sms_response.status_code == 201
    notification_id = get_notification_id(sms_response)

    desired_status = 'delivered'
    notification_status_response = wait_for_status(notification_id,
                                                   notification_url,
                                                   service_id,
                                                   service_test_api_key,
                                                   desired_status)

    assert notification_status_response['status'] == desired_status
    assert notification_status_response[
        'phone_number'] == VALID_TEST_RECIPIENT_PHONE_NUMBER
    assert notification_status_response['sent_by'] is not None
def test_send_email(notification_url, service_id, service_api_key,
                    template_id):
    service_jwt = encode_jwt(service_id, service_api_key)
    email_response = send_email_with_email_address(notification_url,
                                                   service_jwt, template_id)
    assert email_response.status_code == 201
    notification_id = get_notification_id(email_response)
    time_count = 0
    notification_status = ""
    notification_sent_by = None
    while notification_status != "sending" and time_count < 30:
        service_jwt = encode_jwt(service_id, service_api_key)
        notification_status_response = get_notification_status(
            notification_id, notification_url, service_jwt)
        assert notification_status_response.status_code == 200
        notification_status = notification_status_response.json()['status']
        notification_sent_by = notification_status_response.json()['sent_by']
        time.sleep(1)
        time_count = time_count + 1
    assert notification_status == 'sending'
    assert notification_sent_by is not None