class TestApiResponse(unittest.TestCase): """ test the base Api response class """ def setUp(self): with MockApiResponse('http://api.unittest'): self.APIResponse = APIResponse() self.APIResponse.response = requests.get('http://api.unittest') def test_get_ratelimits(self): """ the get_ratelimit method should return the X-RateLimit headers in a dictionary """ limits = self.APIResponse.get_ratelimits() self.assertEqual(limits['limit'], '400') self.assertEqual(limits['remaining'], '397') self.assertEqual(limits['reset'], '1436313600')
def setUp(self): with MockApiResponse('http://api.unittest'): self.APIResponse = APIResponse() self.APIResponse.response = requests.get('http://api.unittest')