#90 feat(ReconcilaitionJar): create api view with pagination.
This commit is contained in:
		| @@ -197,6 +197,34 @@ class TestJarReconcliation(TestCase): | ||||
|         purchases = Sale.objects.filter(reconciliation_id=content['id']) | ||||
|         self.assertEqual(len(purchases), 3) | ||||
|  | ||||
|     def test_list_reconciliations(self): | ||||
|         self._create_simple_reconciliation() | ||||
|         self._create_simple_reconciliation() | ||||
|  | ||||
|         url = '/don_confiao/api/reconciliate_jar/' | ||||
|  | ||||
|         response = self.client.get(url) | ||||
|         self.assertEqual(response.status_code, 200) | ||||
|  | ||||
|         content = json.loads(response.content.decode('utf-8')) | ||||
|         self.assertEqual(2, len(content['results'])) | ||||
|         self.assertEqual('2024-07-30T00:00:00Z', | ||||
|                          content['results'][0]['date_time']) | ||||
|  | ||||
|     def test_list_reconciliations_pagination(self): | ||||
|         self._create_simple_reconciliation() | ||||
|         self._create_simple_reconciliation() | ||||
|  | ||||
|         url = '/don_confiao/api/reconciliate_jar/?page=2&page_size=1' | ||||
|  | ||||
|         response = self.client.get(url) | ||||
|         self.assertEqual(response.status_code, 200) | ||||
|  | ||||
|         content = json.loads(response.content.decode('utf-8')) | ||||
|         self.assertEqual(1, len(content['results'])) | ||||
|         self.assertEqual('2024-07-30T00:00:00Z', | ||||
|                          content['results'][0]['date_time']) | ||||
|  | ||||
|     def _create_simple_reconciliation(self): | ||||
|         reconciliation = ReconciliationJar() | ||||
|         reconciliation.date_time = "2024-07-30" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user