Esempio n. 1
0
 def hit(self, url):
     with count_queries('url:' + url):
         response = self.client.get(url)
     self.assertEqual(200, response.status_code)
     text = response.content.decode('utf-8')
     if response['Content-Type'] == 'application/json':
         return json.loads(text)
     else:
         return text
Esempio n. 2
0
 def hit(self, url):
     with count_queries('url:' + url):
         response = self.client.get(url)
     self.assertEqual(200, response.status_code)
     text = response.content.decode('utf-8')
     if response['Content-Type'] == 'application/json':
         return json.loads(text)
     else:
         return text
Esempio n. 3
0
 def hit(self, url, expected_status=200):
     with count_queries('url:' + url):
         response = self.client.get(url)
     self.assertEqual(expected_status, response.status_code)
     return response
Esempio n. 4
0
 def get_json(self, url):
     with count_queries('url:' + url):
         response = self.client.get_json(url)
     return response
Esempio n. 5
0
 def hit(self, url, expected_status=200):
     with count_queries('url:' + url):
         response = self.client.get(url)
     self.assertEqual(expected_status, response.status_code)
     return response