Esempio n. 1
0
 def test_api_with_mock_data_returns_correct_data_from_json(self):
     request = HttpRequest()
     response = api_page(request, data=self.data)
     json_data = json.loads(response.content)
     ids = [i['uuid'] for i in json_data]
     self.assertTrue('id1' in ids)
     self.assertTrue('id2' in ids)
     self.assertTrue('id3' in ids)
Esempio n. 2
0
 def test_get_list_from_real_request_with_min_max_one_age_filter(self):
     request = HttpRequest()
     request.GET = QueryDict('max=21&min=20')
     response = api_page(request)
     json_data = json.loads(response.content)
     self.assertTrue(len(json_data)>0)
Esempio n. 3
0
 def test_get_list_from_real_request_with_min_max_filter(self):
     request = HttpRequest()
     request.GET = QueryDict('min=31&max=21')
     response = api_page(request)
     json_data = json.loads(response.content)
     self.assertEqual(len(json_data),0)
Esempio n. 4
0
 def test_get_list_from_real_request(self):
     request = HttpRequest()
     response = api_page(request)
     json_data = json.loads(response.content)
     self.assertTrue(len(json_data)>0)
Esempio n. 5
0
 def test_api_with_mock_data_returns_data_convert_from_json(self):
     request = HttpRequest()
     response = api_page(request, data=self.data)
     json_data = json.loads(response.content)
     self.assertEqual(len(json_data),3)
Esempio n. 6
0
 def test_api_with_mock_data_returns_json(self):
     request = HttpRequest()
     response = api_page(request, data=self.data)
     self.assertTrue(response.status_code,200)
     self.assertTrue('json' in response['Content-Type'])