예제 #1
0
    def test_pagination_page_param(self):
        BesluitFactory.create_batch(2)
        besluit_list_url = get_operation_url("besluit_list")

        response = self.client.get(besluit_list_url, {"page": 1})

        self.assertEqual(response.status_code, status.HTTP_200_OK)

        response_data = response.json()
        self.assertEqual(response_data["count"], 2)
        self.assertIsNone(response_data["previous"])
        self.assertIsNone(response_data["next"])
예제 #2
0
    def test_pagination_default(self):
        """
        Deleting a Besluit causes all related objects to be deleted as well.
        """
        BesluitFactory.create_batch(2)
        besluit_list_url = get_operation_url("besluit_list")

        response = self.client.get(besluit_list_url)

        self.assertEqual(response.status_code, status.HTTP_200_OK)

        response_data = response.json()
        self.assertEqual(response_data["count"], 2)
        self.assertIsNone(response_data["previous"])
        self.assertIsNone(response_data["next"])
예제 #3
0
    def test_opvragen_informatieobjecten_besluit(self):
        besluit1, besluit2 = BesluitFactory.create_batch(2)

        besluit1_uri = reverse(besluit1)
        besluit2_uri = reverse(besluit2)

        BesluitInformatieObjectFactory.create_batch(3, besluit=besluit1)
        BesluitInformatieObjectFactory.create_batch(2, besluit=besluit2)

        base_uri = get_operation_url("besluitinformatieobject_list")

        url1 = f"{base_uri}?besluit={besluit1_uri}"
        response1 = self.client.get(url1)
        self.assertEqual(len(response1.data), 3)

        url2 = f"{base_uri}?besluit={besluit2_uri}"
        response2 = self.client.get(url2)
        self.assertEqual(len(response2.data), 2)