def testDefaultPollTimeout(self): old_env = os.environ.get('APPURIFY_API_TIMEOUT', None) try: os.environ['APPURIFY_API_TIMEOUT'] = '0.2' mockRequestGet.count = -20 client = AppurifyClient(access_token="authenticated", poll_every=0.1) with self.assertRaises(AppurifyClientError): client.pollTestResult("test_test_run_id", 0.2) finally: if old_env: os.environ['APPURIFY_API_TIMEOUT'] = str(old_env)
def testPollTimeout(self): mockRequestGet.count = -20 client = AppurifyClient(access_token="authenticated", timeout_sec=0.2, poll_every=0.1) with self.assertRaises(AppurifyClientError): client.pollTestResult("test_test_run_id", 0.2)
def testPollTestResult(self): mockRequestGet.count = 0 client = AppurifyClient(access_token="authenticated", timeout_sec=2, poll_every=0.1) test_status_response = client.pollTestResult("test_test_run_id", 2) self.assertEqual(test_status_response['status'], "complete", "Should poll until complete")