コード例 #1
0
ファイル: test_api.py プロジェクト: True-Demon/smtp2go-python
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
ファイル: test_api.py プロジェクト: True-Demon/smtp2go-python
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
ファイル: test_api.py プロジェクト: True-Demon/smtp2go-python
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
ファイル: test_api.py プロジェクト: True-Demon/smtp2go-python
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