示例#1
0
def test_requests_body_provider_fail_low(status):
    """Ensure low end non-2xx responses evaluate to None."""
    url = 'https://coolsite.com/pages/3'
    body = '<html></html>'
    responses.add(
        responses.GET,
        url,
        body=body,
        status=status,
        content_type='text/html'
    )
    assert href.requests_body_provider(url) is None
示例#2
0
def test_requests_body_provider_success():
    """Ensure the provider returns a content body on success."""
    url = 'https://coolsite.com/pages/3'
    body = '<html></html>'
    responses.add(
        responses.GET,
        url,
        body=body,
        status=200,
        content_type='text/html'
    )
    content_body = href.requests_body_provider(url)
    assert content_body == body