def test_api_rate_limit_exceeded_no_previous_call(): # When I make an API request with a rate limit and I am have no previous requests def foobar(): pass c = Client(account_id="foo", api_key="bar") # Then I should not receive a API Rate Limit Timeout c._api_rate_limit_exceeded(foobar).should.be.false
def test_api_rate_limit_exceeded_outside_window(): # When I make an API request with a rate limit and I am have a previous # request outside of the time window def foobar(): pass c = Client(account_id="foo", api_key="bar") c.foobar_window = datetime.datetime.now() - datetime.timedelta(seconds=61) # Then I should not receive a API Rate Limit Timeout c._api_rate_limit_exceeded(foobar, window=60).should.be.false