refactor handling server responses

This commit is contained in:
Alan Hamlett 2017-11-22 14:01:02 -08:00
parent 019b97dfe7
commit aa58524f66
2 changed files with 47 additions and 34 deletions

View file

@ -137,6 +137,7 @@ class LoggingTestCase(utils.TestCase):
logfile = os.path.realpath(os.path.expanduser('~/.wakatime.log'))
self.assertEquals(logfile, logging.getLogger('WakaTime').handlers[0].baseFilename)
output = [u(' ').join(x) for x in logs.actual()]
expected = u('WakaTime WARNING Regex error (unbalanced parenthesis) for include pattern: \\(invalid regex)')
if self.isPy35OrNewer:
expected = u('WakaTime WARNING Regex error (unbalanced parenthesis at position 15) for include pattern: \\(invalid regex)')
@ -147,7 +148,7 @@ class LoggingTestCase(utils.TestCase):
self.assertEquals(output[1], expected)
self.assertEquals(output[2], u('WakaTime DEBUG Sending heartbeats to api at https://api.wakatime.com/api/v1/users/current/heartbeats.bulk'))
self.assertIn('Python', output[3])
self.assertIn('response_code', output[5])
self.assertIn('response_code', output[4])
@log_capture()
def test_exception_traceback_logged_in_debug_mode(self, logs):