fix tests on python3

This commit is contained in:
Alan Hamlett 2017-10-31 09:06:52 -07:00
parent e0fa82e2c9
commit 3992bec062

View file

@ -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.get'].assert_called_once_with()
self.patched['wakatime.session_cache.SessionCache.delete'].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.patched['wakatime.session_cache.SessionCache.save'].assert_not_called()
self.maxDiff = 10000
heartbeat = { heartbeat = {
'language': 'Python', 'language': 'Python',
@ -408,21 +409,16 @@ class ConfigsTestCase(utils.TestCase):
'time': float(now), 'time': float(now),
'type': 'file', '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) self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].assert_called_once_with(
for key, val in self.patched['wakatime.offlinequeue.Queue.push'].call_args[0][0].items(): 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': if key == 'dependencies':
self.assertEquals(sorted(heartbeat[key]), sorted(val)) self.assertEquals(sorted(val), sorted(heartbeat[key]))
else: else:
self.assertEquals(heartbeat[key], val) self.assertEquals(val, heartbeat.get(key))
self.assertEquals(stats, json.loads(self.patched['wakatime.offlinequeue.Queue.push'].call_args[0][1]))
self.patched['wakatime.offlinequeue.Queue.pop'].assert_not_called() self.patched['wakatime.offlinequeue.Queue.pop'].assert_not_called()
@log_capture() @log_capture()