def test_pagination_page_param(self): ZaakTypeFactory.create_batch(2, concept=False) zaaktype_list_url = get_operation_url('zaaktype_list') response = self.client.get(zaaktype_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'])
def test_filter_on_zaaktype(self): zt1, zt2 = ZaakTypeFactory.create_batch(2, concept=False) rt1 = ResultaatTypeFactory.create(zaaktype=zt1) rt1_url = f'http://testserver{reverse(rt1)}' rt2 = ResultaatTypeFactory.create(zaaktype=zt2) rt2_url = f'http://testserver{reverse(rt2)}' zt1_url = 'http://testserver{}'.format(reverse('zaaktype-detail', kwargs={ 'uuid': zt1.uuid, })) zt2_url = 'http://testserver{}'.format(reverse('zaaktype-detail', kwargs={ 'uuid': zt2.uuid, })) list_url = reverse('resultaattype-list') response = self.client.get(list_url, {'zaaktype': zt1_url}) self.assertEqual(response.status_code, status.HTTP_200_OK) response_data = response.json()['results'] self.assertEqual(len(response_data), 1) self.assertEqual(response_data[0]['url'], rt1_url) self.assertEqual(response_data[0]['zaaktype'], zt1_url) self.assertNotEqual(response_data[0]['url'], rt2_url) self.assertNotEqual(response_data[0]['zaaktype'], zt2_url)