def test_rate_limiter_handles_IndexError(self): nsinstance = Nationstates("world") nsinstance.rltime = list(range(50)) try: nsinstance.ratelimitcheck() except IndexError as err: self.fail(str(err))
def test_rate_limiting_check_isFalse(self): """This Tests whether or Not the rate limiter catches a rate limit break """ nsinstance = Nationstates("world") ct = time() nsinstance.rltime = [(ct+x) for x in range(50)] self.assertFalse(nsinstance.ratelimitcheck(xrls=50)) nationstates.__rltime__ = []
def test_rate_limiting_check_isTrue(self): nsinstance = Nationstates("world") ct = time() nsinstance.rltime = [(ct+x) for x in range(47)] self.assertTrue(nsinstance.ratelimitcheck(xrls=47))