示例#1
0
 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)
示例#2
0
 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)
示例#3
0
 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)
示例#4
0
 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)
示例#5
0
 def test_parse_response_error_invalid_format(self):
     response = MockResponse(
         {'quoteResponse': {'error': None, 'result': [{}]},
          'chart': {'error': None, 'result': [{}]}})
     with self.assertRaises(yahoo.YahooError):
         yahoo.parse_response(response)
示例#6
0
 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)