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')
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)
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)
def test_empty_custom_headers(): payload = PAYLOAD.copy() payload['headers'] = {} get_successful_response(payload=payload)
def test_successful_response_rate_limit_limit(): response = get_successful_response() assert response.rate_limit.limit == int(HEADERS.get('X-Ratelimit-Limit'))
def test_successful_response_rate_limit_remaining(): response = get_successful_response() assert response.rate_limit.remaining == int( HEADERS.get('X-Ratelimit-Remaining'))
def test_successful_response_json(): response = get_successful_response() assert response.json == SUCCESSFUL_RESPONSE_BODY
def test_successful_response_request_id(): response = get_successful_response() assert response.request_id == SUCCESSFUL_RESPONSE_BODY['request_id']
def test_successful_response_status_code(): response = get_successful_response() assert response.status_code == 200
def test_response_errors_on_successful_response(): response = get_successful_response() assert response.errors == []
def test_successful_response_success(): response = get_successful_response() assert response.success is True