Esempio n. 1
0
def test_successful_endpoint_send():
    response = get_successful_response()
    assert response.success is True
    assert response.json == SUCCESSFUL_RESPONSE_BODY
    assert response.status_code == 200
    assert not response.errors
    assert response.errors == SUCCESSFUL_RESPONSE_BODY.get('data').get(
        'failures')
Esempio n. 2
0
def test_send_method_does_not_raise_exception_if_text_present():
    payload = PAYLOAD.copy()
    payload['html'] = None
    assert payload.get('text')
    assert not payload.get('html')
    get_successful_response(payload=payload)
Esempio n. 3
0
def test_send_method_raises_exception_if_text_or_html_not_present():
    payload = PAYLOAD.copy()
    payload['html'] = payload['text'] = None
    with pytest.raises(Smtp2goParameterException):
        get_successful_response(payload=payload)
Esempio n. 4
0
def test_empty_custom_headers():
    payload = PAYLOAD.copy()
    payload['headers'] = {}
    get_successful_response(payload=payload)
Esempio n. 5
0
def test_successful_response_rate_limit_limit():
    response = get_successful_response()
    assert response.rate_limit.limit == int(HEADERS.get('X-Ratelimit-Limit'))
Esempio n. 6
0
def test_successful_response_rate_limit_remaining():
    response = get_successful_response()
    assert response.rate_limit.remaining == int(
        HEADERS.get('X-Ratelimit-Remaining'))
Esempio n. 7
0
def test_successful_response_json():
    response = get_successful_response()
    assert response.json == SUCCESSFUL_RESPONSE_BODY
Esempio n. 8
0
def test_successful_response_request_id():
    response = get_successful_response()
    assert response.request_id == SUCCESSFUL_RESPONSE_BODY['request_id']
Esempio n. 9
0
def test_successful_response_status_code():
    response = get_successful_response()
    assert response.status_code == 200
Esempio n. 10
0
def test_response_errors_on_successful_response():
    response = get_successful_response()
    assert response.errors == []
Esempio n. 11
0
def test_successful_response_success():
    response = get_successful_response()
    assert response.success is True