Exemplo n.º 1
0
 def test_safe_json_loads(self):
     valid_json = '{"key": "value"}'
     invalid_json = '{"key": "value",}'
     try:
         safe_json_loads(valid_json, Exception)
     except Exception:  # pragma: no cover
         self.fail('Raised error on valid JSON.')
     with self.assertRaises(Exception):
         safe_json_loads(invalid_json, Exception)
Exemplo n.º 2
0
 def test_safe_json_loads(self):
     valid_json = '{"key": "value"}'
     invalid_json = '{"key": "value",}'
     try:
         safe_json_loads(valid_json, Exception)
     except Exception:  # pragma: no cover
         self.fail('Raised error on valid JSON.')
     with self.assertRaises(Exception):
         safe_json_loads(invalid_json, Exception)
Exemplo n.º 3
0
 def _process_response(self, response):
     if response.headers.get('content-type') == 'application/csv':
         return response.content
     else:  # assume json
         return safe_json_loads(response.text, ErrorParsingBambooData)