Пример #1
0
    def test_zaak_heropen_reset_einddatum(self):
        self.autorisatie.scopes = self.autorisatie.scopes + [
            SCOPEN_ZAKEN_HEROPENEN
        ]
        self.autorisatie.save()

        zaak = ZaakFactory.create(einddatum='2019-01-07', zaaktype=ZAAKTYPE)
        StatusFactory.create(
            zaak=zaak,
            status_type=
            'http://example.com/ztc/api/v1/catalogussen/1/zaaktypen/1/statustypen/2',
            datum_status_gezet='2019-01-07T12:51:41+0000',
        )
        zaak_url = reverse('zaak-detail', kwargs={'uuid': zaak.uuid})
        status_list_url = reverse('status-list')

        # Set status other than eindstatus
        datum_status_gezet = utcdatetime(2019, 1, 7, 12, 53, 25)
        response = self.client.post(
            status_list_url, {
                'zaak': zaak_url,
                'statusType':
                'http://example.com/ztc/api/v1/catalogussen/1/zaaktypen/1/statustypen/1',
                'datumStatusGezet': datum_status_gezet.isoformat(),
            })
        self.assertEqual(response.status_code, status.HTTP_201_CREATED,
                         response.content)

        zaak.refresh_from_db()
        self.assertIsNone(zaak.einddatum)
Пример #2
0
    def test_zaak_heropen_reset_einddatum(self):
        token = generate_jwt([SCOPE_STATUSSEN_TOEVOEGEN])
        self.client.credentials(HTTP_AUTHORIZATION=token)
        zaak = ZaakFactory.create(einddatum='2019-01-07')
        StatusFactory.create(
            zaak=zaak,
            status_type=
            'http://example.com/ztc/api/v1/catalogussen/1/zaaktypen/1/statustypen/2',
            datum_status_gezet='2019-01-07T12:51:41+0000',
        )
        zaak_url = reverse('zaak-detail', kwargs={'uuid': zaak.uuid})
        status_list_url = reverse('status-list')

        # Set status other than eindstatus
        datum_status_gezet = utcdatetime(2019, 1, 7, 12, 53, 25)
        response = self.client.post(
            status_list_url, {
                'zaak': zaak_url,
                'statusType':
                'http://example.com/ztc/api/v1/catalogussen/1/zaaktypen/1/statustypen/1',
                'datumStatusGezet': datum_status_gezet.isoformat(),
            })
        self.assertEqual(response.status_code, status.HTTP_201_CREATED,
                         response.content)

        zaak.refresh_from_db()
        self.assertIsNone(zaak.einddatum)
Пример #3
0
    def test_zaak_afsluiten(self):
        zaak = ZaakFactory.create()
        zaak_url = reverse('zaak-detail', kwargs={'uuid': zaak.uuid})
        status_list_url = reverse('status-list')
        token = generate_jwt([SCOPE_STATUSSEN_TOEVOEGEN])
        self.client.credentials(HTTP_AUTHORIZATION=token)

        # Validate StatusTypes from Mock client
        ztc_mock_client = ZTCMockClient()

        status_type_1 = ztc_mock_client.retrieve('statustype', uuid=1)
        self.assertFalse(status_type_1['isEindstatus'])

        status_type_2 = ztc_mock_client.retrieve('statustype', uuid=2)
        self.assertTrue(status_type_2['isEindstatus'])

        # Set initial status
        response = self.client.post(
            status_list_url, {
                'zaak': zaak_url,
                'statusType':
                'http://example.com/ztc/api/v1/catalogussen/1/zaaktypen/1/statustypen/1',
                'datumStatusGezet': isodatetime(2018, 10, 1, 10, 00, 00),
            })
        self.assertEqual(response.status_code, status.HTTP_201_CREATED,
                         response.content)

        zaak.refresh_from_db()
        self.assertIsNone(zaak.einddatum)

        # Set eindstatus
        datum_status_gezet = utcdatetime(2018, 10, 22, 10, 00, 00)
        response = self.client.post(
            status_list_url, {
                'zaak': zaak_url,
                'statusType':
                'http://example.com/ztc/api/v1/catalogussen/1/zaaktypen/1/statustypen/2',
                'datumStatusGezet': datum_status_gezet.isoformat(),
            })
        self.assertEqual(response.status_code, status.HTTP_201_CREATED,
                         response.content)

        zaak.refresh_from_db()
        self.assertEqual(zaak.einddatum, datum_status_gezet.date())
Пример #4
0
    def test_zaak_afsluiten(self):
        zaak = ZaakFactory.create(zaaktype=ZAAKTYPE)
        zaak_url = reverse('zaak-detail', kwargs={'uuid': zaak.uuid})

        responses = {
            RESULTAATTYPE: {
                'url': RESULTAATTYPE,
                'archiefactietermijn': 'P10Y',
                'archiefnominatie': Archiefnominatie.blijvend_bewaren,
                'brondatumArchiefprocedure': {
                    'afleidingswijze':
                    BrondatumArchiefprocedureAfleidingswijze.afgehandeld,
                    'datumkenmerk': None,
                    'objecttype': None,
                    'procestermijn': None,
                }
            },
            STATUSTYPE: {
                'url': STATUSTYPE,
                'volgnummer': 1,
                'isEindstatus': False,
            },
            STATUSTYPE2: {
                'url': STATUSTYPE2,
                'volgnummer': 2,
                'isEindstatus': True,
            }
        }

        # Set initial status
        status_list_url = reverse('status-list')
        with mock_client(responses):
            response = self.client.post(
                status_list_url, {
                    'zaak': zaak_url,
                    'statusType': STATUSTYPE,
                    'datumStatusGezet': isodatetime(2018, 10, 1, 10, 00, 00),
                })
        self.assertEqual(response.status_code, status.HTTP_201_CREATED,
                         response.content)

        zaak.refresh_from_db()
        self.assertIsNone(zaak.einddatum)

        # add a result for the case
        resultaat_create_url = get_operation_url('resultaat_create')
        data = {
            'zaak': zaak_url,
            'resultaatType': RESULTAATTYPE,
            'toelichting': '',
        }

        response = self.client.post(resultaat_create_url, data)

        self.assertEqual(response.status_code, status.HTTP_201_CREATED,
                         response.data)

        # Set eindstatus
        datum_status_gezet = utcdatetime(2018, 10, 22, 10, 00, 00)

        with mock_client(responses):
            response = self.client.post(
                status_list_url, {
                    'zaak': zaak_url,
                    'statusType': STATUSTYPE2,
                    'datumStatusGezet': datum_status_gezet.isoformat(),
                })
        self.assertEqual(response.status_code, status.HTTP_201_CREATED,
                         response.content)

        zaak.refresh_from_db()
        self.assertEqual(zaak.einddatum, datum_status_gezet.date())
        self.assertEqual(zaak.archiefactiedatum,
                         zaak.einddatum + relativedelta(years=10))