Ejemplo n.º 1
0
def test_parse_urlencoded():
    response = MagicMock()
    response.headers = {'Content-Type': URLENCODED_MIME_TYPE}
    response.text = 'key=value&multi=a&multi=b'
    content = parse_response(response)
    assert content == {'key': 'value', 'multi': ['a', 'b']}
Ejemplo n.º 2
0
def test_parse_urlencoded():
    response = MagicMock()
    response.headers = {'Content-Type': URLENCODED_MIME_TYPE}
    response.text = 'key=value&multi=a&multi=b'
    content = parse_response(response)
    assert content == {'key': 'value', 'multi': ['a', 'b']}
Ejemplo n.º 3
0
def test_parse_json():
    response = MagicMock()
    response.headers = {'Content-Type': JSON_MIME_TYPE}
    response.json.return_value = sentinel.json_content
    content = parse_response(response)
    assert content == sentinel.json_content
Ejemplo n.º 4
0
def test_parse_json():
    response = MagicMock()
    response.headers = {'Content-Type': JSON_MIME_TYPE}
    response.json.return_value = sentinel.json_content
    content = parse_response(response)
    assert content == sentinel.json_content