示例#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