def test_parse_for_errors_error(self, httplib_response): soap_error = ('<document>' '<errorCode>500</errorCode>' '<errorDescription>Bad request</errorDescription>' '</document>') rsp = httplib_response(status=500, body=soap_error) with pytest.raises(upnp.IGDError) as exc: upnp._parse_for_errors(rsp) assert 'SOAP request error' in exc.value.message
def test_parse_for_errors_good_rsp(self, httplib_response): rsp = httplib_response(status=200) assert rsp == upnp._parse_for_errors(rsp)
def test_parse_for_errors_bad_rsp(self, httplib_response): rsp = httplib_response(status=500) with pytest.raises(upnp.IGDError) as exc: upnp._parse_for_errors(rsp) assert 'Unable to parse' in exc.value.message