|
10 | 10 | except Exception: |
11 | 11 | IS_CI_ENV = True |
12 | 12 |
|
13 | | -# def test_basic_response(unit_test, result, method_name): |
14 | | -# unit_test.assertTrue(result['success'], "{0:s} failed".format(method_name)) |
15 | | -# unit_test.assertTrue(result['message'] is not None, "message not present in response") |
16 | | -# unit_test.assertTrue(result['result'] is not None, "result not present in response") |
17 | | - |
18 | | - |
19 | | -# {'result': {u'error_msg': u'ERROR: Sign is not correct', u'method': u'getBalance', u'success': 0, u'error': u'SIGN_INCORRECT'}, 'success': True} |
20 | | -# {'result': {u'error_msg': u'ERROR: API Key not set', u'method': u'getBalance', u'success': 0, u'error': u'KEY_MISSING'}, 'success': True} |
21 | | -# {'result': {u'error_msg': u'ERROR: Sign is not correct', u'method': u'getBalance', u'success': 0, u'error': u'SIGN_INCORRECT'}, 'success': True} |
22 | | - |
23 | | -def test_auth_basic_failures(unit_test, result, test_type): |
24 | | - pass |
25 | | - |
26 | | - # unit_test.assertFalse(result['success'], "{0:s} failed".format(test_type)) |
27 | | - # unit_test.assertTrue('invalid' in str(result['message']).lower(), "{0:s} failed response message".format(test_type)) |
28 | | - # unit_test.assertIsNone(result['result'], "{0:s} failed response result not None".format(test_type)) |
29 | | - |
| 13 | +def test_basic_response(unit_test, result, method_name): |
| 14 | + unit_test.assertTrue(result['success'], "%s failed" % method_name) |
| 15 | + unit_test.assertTrue(result['result'] is not None, "result not present in response") |
| 16 | + unit_test.assertTrue(isinstance(result['result'], dict), "result is not a dict") |
| 17 | + # unit_test.assertTrue(result['result']['method'] is method_name, "result method is wrong") |
30 | 18 |
|
31 | 19 | @unittest.skipIf(IS_CI_ENV, 'no account secrets uploaded in CI envieonment, TODO') |
32 | | -class TestCoinTrackingAPIBasicTests(unittest.TestCase): |
| 20 | +class TestCTAPIBasicTests(unittest.TestCase): |
33 | 21 | """ |
34 | 22 | Integration tests for the CoinTracking API |
35 | 23 |
|
@@ -72,11 +60,29 @@ def test_handles_invalid_key_or_secret(self): |
72 | 60 | actual = self.api.getBalance() |
73 | 61 | self.assertFalse(actual['success'], 'invalid key, invalid secret') |
74 | 62 |
|
75 | | - # def test_get_balances(self): |
76 | | - # actual = self.bittrex.get_balances() |
77 | | - # test_basic_response(self, actual, "get_balances") |
78 | | - # self.assertTrue(isinstance(actual['result'], list), "result is not a list") |
| 63 | + def test_getTrades(self): |
| 64 | + actual = self.api.getTrades() |
| 65 | + test_basic_response(self, actual, "getTrades") |
| 66 | + |
| 67 | + def test_getBalance(self): |
| 68 | + actual = self.api.getBalance() |
| 69 | + test_basic_response(self, actual, "getBalance") |
| 70 | + |
| 71 | + def test_getHistoricalSummary(self): |
| 72 | + actual = self.api.getHistoricalSummary() |
| 73 | + test_basic_response(self, actual, "getHistoricalSummary") |
| 74 | + |
| 75 | + def test_getHistoricalCurrency(self): |
| 76 | + actual = self.api.getHistoricalCurrency() |
| 77 | + test_basic_response(self, actual, "getHistoricalCurrency") |
| 78 | + |
| 79 | + def test_getGroupedBalance(self): |
| 80 | + actual = self.api.getGroupedBalance() |
| 81 | + test_basic_response(self, actual, "getGroupedBalance") |
79 | 82 |
|
| 83 | + def test_getGains(self): |
| 84 | + actual = self.api.getGains() |
| 85 | + test_basic_response(self, actual, "getGains") |
80 | 86 |
|
81 | 87 | if __name__ == '__main__': |
82 | 88 | unittest.main() |
0 commit comments