From 3992bec0627f00806a8809c6d77dc23a6ca90d45 Mon Sep 17 00:00:00 2001 From: Alan Hamlett Date: Tue, 31 Oct 2017 09:06:52 -0700 Subject: [PATCH] fix tests on python3 --- tests/test_configs.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/tests/test_configs.py b/tests/test_configs.py index 4be3f73..8abd05b 100644 --- a/tests/test_configs.py +++ b/tests/test_configs.py @@ -398,6 +398,7 @@ class ConfigsTestCase(utils.TestCase): self.patched['wakatime.session_cache.SessionCache.get'].assert_called_once_with() self.patched['wakatime.session_cache.SessionCache.delete'].assert_called_once_with() self.patched['wakatime.session_cache.SessionCache.save'].assert_not_called() + self.maxDiff = 10000 heartbeat = { 'language': 'Python', @@ -408,21 +409,16 @@ class ConfigsTestCase(utils.TestCase): 'time': float(now), 'type': 'file', } - stats = { - u('cursorpos'): None, - u('dependencies'): dependencies, - u('language'): u('Python'), - u('lineno'): None, - u('lines'): 37, - } - self.patched['wakatime.offlinequeue.Queue.push'].assert_called_once_with(ANY, ANY, None) - for key, val in self.patched['wakatime.offlinequeue.Queue.push'].call_args[0][0].items(): + self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].assert_called_once_with( + ANY, cert=None, proxies={}, stream=False, timeout=60, verify=True, + ) + body = self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].call_args[0][0].body + for key, val in json.loads(body).items(): if key == 'dependencies': - self.assertEquals(sorted(heartbeat[key]), sorted(val)) + self.assertEquals(sorted(val), sorted(heartbeat[key])) else: - self.assertEquals(heartbeat[key], val) - self.assertEquals(stats, json.loads(self.patched['wakatime.offlinequeue.Queue.push'].call_args[0][1])) + self.assertEquals(val, heartbeat.get(key)) self.patched['wakatime.offlinequeue.Queue.pop'].assert_not_called() @log_capture()