Пример #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')
Пример #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)
Пример #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)
Пример #4
0
def test_empty_custom_headers():
    payload = PAYLOAD.copy()
    payload['headers'] = {}
    get_successful_response(payload=payload)
Пример #5
0
def test_successful_response_rate_limit_limit():
    response = get_successful_response()
    assert response.rate_limit.limit == int(HEADERS.get('X-Ratelimit-Limit'))
Пример #6
0
def test_successful_response_rate_limit_remaining():
    response = get_successful_response()
    assert response.rate_limit.remaining == int(
        HEADERS.get('X-Ratelimit-Remaining'))
Пример #7
0
def test_successful_response_json():
    response = get_successful_response()
    assert response.json == SUCCESSFUL_RESPONSE_BODY
Пример #8
0
def test_successful_response_request_id():
    response = get_successful_response()
    assert response.request_id == SUCCESSFUL_RESPONSE_BODY['request_id']
Пример #9
0
def test_successful_response_status_code():
    response = get_successful_response()
    assert response.status_code == 200
Пример #10
0
def test_response_errors_on_successful_response():
    response = get_successful_response()
    assert response.errors == []
Пример #11
0
def test_successful_response_success():
    response = get_successful_response()
    assert response.success is True