def test_parse_response_error_not_none(self): response = MockResponse( '{"quoteResponse": {"error": "Non-zero error", "result": [{}]}}') with self.assertRaises(yahoo.YahooError): yahoo.parse_response(response)
def test_parse_response_error_status_code(self): response = MockResponse( '{"quoteResponse": {"error": "Not supported", "result": [{}]}}', status_code=400) with self.assertRaises(yahoo.YahooError): yahoo.parse_response(response)
def test_parse_response_error_invalid_format(self): response = MockResponse( """{"quoteResponse": {"error": null, "result": [{}]}, "chart": {"error": null, "result": [{}]}}""") with self.assertRaises(yahoo.YahooError): yahoo.parse_response(response)
def test_parse_response_empty_result(self): response = MockResponse( '{"quoteResponse": {"error": null, "result": []}}') with self.assertRaises(yahoo.YahooError): yahoo.parse_response(response)