def test_done(self): response = ResponseAsync() self.assertFalse(response.done(), 'response does not start done') std_response = Response(200) response.fulfill(std_response) self.assertTrue(response.done(), 'response is done after call to fulfill')
def test_callback(self): def callback(response): response.called = True self.assertEqual(response.status, 200) response = ResponseAsync(callback=callback) response.fulfill(Response(200)) self.assertEqual(response.status, 200) self.assertTrue(response.called)