Beispiel #1
0
    def test_rate_limit_max_wait(self):
        global http_attempts
        client = Client('cfexampleapi',
                        'b4c0n73n7fu1',
                        content_type_cache=False)

        http_attempts = 0
        self.assertRaises(RateLimitExceededError,
                          retry_request(client)(mock_http_call), '/foo',
                          {'reset': 100})
Beispiel #2
0
    def test_rate_limit_retries(self):
        global http_attempts
        client = Client('cfexampleapi',
                        'b4c0n73n7fu1',
                        content_type_cache=False)

        http_attempts = 0
        result = retry_request(client)(mock_http_call)('/foo', {})

        self.assertEqual(http_attempts, 1)
        self.assertEqual(result, 'succeed')