Example #1
0
 def test_call_requests_get_with_cache(self, mock_time, requests_get):
     mock_time.return_value = 0
     rm = RequestMaker(api_path='/', host='host', token='f4k3')
     requests_get.return_value = MockResponse(200, '')
     rm.get('/nowhere', cache=True)
     self.assertEqual(requests_get.call_count, 1)
     rm.get('/nowhere', cache=True)
     self.assertEqual(requests_get.call_count, 1)
     rm.get('/nowhere', cache=False)
     self.assertEqual(requests_get.call_count, 2)
     rm.get('/nowhere', cache=True)
     self.assertEqual(requests_get.call_count, 2)
     mock_time.return_value = 61
     rm.get('/nowhere', cache=True)
     self.assertEqual(requests_get.call_count, 3)
Example #2
0
 def test_call_requests_get_with_cache(self, mock_time, requests_get):
     mock_time.return_value = 0
     rm = RequestMaker(api_path='/', host='host', token='f4k3')
     requests_get.return_value = MockResponse(200, '')
     rm.get('/nowhere', cache=True)
     self.assertEqual(requests_get.call_count, 1)
     rm.get('/nowhere', cache=True)
     self.assertEqual(requests_get.call_count, 1)
     rm.get('/nowhere', cache=False)
     self.assertEqual(requests_get.call_count, 2)
     rm.get('/nowhere', cache=True)
     self.assertEqual(requests_get.call_count, 2)
     mock_time.return_value = 61
     rm.get('/nowhere', cache=True)
     self.assertEqual(requests_get.call_count, 3)
Example #3
0
 def test_call_requests_get_with_cache(self, mock_time, requests_get):
     mock_time.return_value = 0
     rm = RequestMaker(api_path="/", host="host", token="f4k3")
     requests_get.return_value = MockResponse(200, "")
     rm.get("/nowhere", cache=True)
     self.assertEqual(requests_get.call_count, 1)
     rm.get("/nowhere", cache=True)
     self.assertEqual(requests_get.call_count, 1)
     rm.get("/nowhere", cache=False)
     self.assertEqual(requests_get.call_count, 2)
     rm.get("/nowhere", cache=True)
     self.assertEqual(requests_get.call_count, 2)
     mock_time.return_value = 61
     rm.get("/nowhere", cache=True)
     self.assertEqual(requests_get.call_count, 3)
 def test_call_requests_get(self, requests_get):
     rm = RequestMaker(api_path="/", host="host", token="f4k3")
     requests_get.return_value = MockResponse(200, "")
     rm.get("/nowhere")
     self.assertTrue(requests_get.called)
 def test_call_requests_get(self, requests_get):
     rm = RequestMaker(api_path='/', host='host', token='f4k3')
     requests_get.return_value = MockResponse(200, '')
     rm.get('/nowhere')
     self.assertTrue(requests_get.called)
Example #6
0
 def test_call_requests_get(self, requests_get):
     rm = RequestMaker(api_path='/', host='host', token='f4k3')
     requests_get.return_value = MockResponse(200, '')
     rm.get('/nowhere')
     self.assertTrue(requests_get.called)