class TestLogResponse(unittest.TestCase): def setUp(self): self.url = "http://localhost:80/update/00:0f:54:18:10:35/" self.update = UpdateThread( self.url, Queue.Queue(), "updatetest" ) def test_logging(self): url = self.url + 'ear' update = json.loads('{"ear": "L", "moved": 1}') response = json.loads('{"status": 200, "message": "OK"}') with LogCapture() as l: self.update.log_update_reponse(update, response, url) l.check(('root', 'INFO', 'updatetest - POSTed ' + json.dumps(update) + ' to ' + url), ('root', 'INFO', 'updatetest - Response: ' + json.dumps(response)))