Esempio n. 1
0
 def test_type_equal_orover_threshold(self):
     """
     Response containing type field equal to or over CryptoCompare threshold
     should not raise any error
     """
     CryptoCompare._check_request_response_error(
         {'Type': ERROR_TYPE_THRESHOLD})
     CryptoCompare._check_request_response_error(
         {'Type': ERROR_TYPE_THRESHOLD + 1})
Esempio n. 2
0
 def test_error_has_message(self):
     """Raised error should provide message if in response"""
     try:
         CryptoCompare._check_request_response_error({
             'Response':
             'Error',
             'Message':
             'Lorem ipsum dolor sit amet'
         })
     except CryptoCompareApiError as e:
         self.assertEqual(str(e), 'Lorem ipsum dolor sit amet')
     else:
         self.fail("Should have raised")
Esempio n. 3
0
 def test_list(self):
     """No error should raise when provided a list"""
     CryptoCompare._check_request_response_error([])
Esempio n. 4
0
 def test_data(self):
     """Regular response data should not raise error"""
     CryptoCompare._check_request_response_error({'a': 'b'})
Esempio n. 5
0
 def test_empty(self):
     """Empty response should not raise error"""
     CryptoCompare._check_request_response_error({})