def test_changing_besluittype_informatieobjecttype_m2m_invalidates_both_etags( self): """ Changing the M2M should modify both resources, resulting in 200 for when both resources are retrieved """ besluittype = BesluitTypeFactory.create() besluittype._etag = calculate_etag(besluittype) besluittype.save(update_fields=["_etag"]) besluittype_etag = besluittype._etag zaaktype = ZaakTypeFactory.create() zaaktype._etag = calculate_etag(zaaktype) zaaktype.save(update_fields=["_etag"]) zaaktype_etag = zaaktype._etag besluittype.zaaktypen.set([zaaktype]) besluittype.save() response = self.client.get(reverse(besluittype), HTTP_IF_NONE_MATCH=f'"{besluittype_etag}"') self.assertEqual(response.status_code, status.HTTP_200_OK) response = self.client.get(reverse(zaaktype), HTTP_IF_NONE_MATCH=f'"{zaaktype_etag}"') self.assertEqual(response.status_code, status.HTTP_200_OK)
def test_no_changes_gives_304(self): """ Because no changes are made to the besluittype, a code 304 should be returned """ besluittype = BesluitTypeFactory.create(omschrijving="bla") besluittype._etag = calculate_etag(besluittype) besluittype.save(update_fields=["_etag"]) etag = besluittype._etag response = self.client.get(reverse(besluittype), HTTP_IF_NONE_MATCH=f'"{etag}"') self.assertEqual(response.status_code, status.HTTP_304_NOT_MODIFIED)
def test_no_changes_gives_304(self): """ Because no changes are made to the eigenschap, a code 304 should be returned """ eigenschap = EigenschapFactory.create(toelichting="bla") eigenschap._etag = calculate_etag(eigenschap) eigenschap.save(update_fields=["_etag"]) etag = eigenschap._etag response = self.client.get(reverse(eigenschap), HTTP_IF_NONE_MATCH=f'"{etag}"') self.assertEqual(response.status_code, status.HTTP_304_NOT_MODIFIED)
def test_no_changes_gives_304(self): """ Because changes are made to the zaaktype, a code 200 should be returned """ zaaktype = ZaakTypeFactory.create(toelichting="bla") zaaktype._etag = calculate_etag(zaaktype) zaaktype.save(update_fields=["_etag"]) etag = zaaktype._etag response = self.client.get(reverse(zaaktype), HTTP_IF_NONE_MATCH=f'"{etag}"') self.assertEqual(response.status_code, status.HTTP_304_NOT_MODIFIED)
def test_no_changes_gives_304(self): """ Because no changes are made to the catalogus, a code 304 should be returned """ catalogus = CatalogusFactory.create(domein="bla") catalogus._etag = calculate_etag(catalogus) catalogus.save(update_fields=["_etag"]) etag = catalogus._etag response = self.client.get(reverse(catalogus), HTTP_IF_NONE_MATCH=f'"{etag}"') self.assertEqual(response.status_code, status.HTTP_304_NOT_MODIFIED)
def test_no_changes_gives_304(self): """ Because no changes are made to the zaakinformatieobjecttype, a code 304 should be returned """ zaakinformatieobjecttype = ZaakInformatieobjectTypeFactory.create( volgnummer=1) zaakinformatieobjecttype._etag = calculate_etag( zaakinformatieobjecttype) zaakinformatieobjecttype.save(update_fields=["_etag"]) etag = zaakinformatieobjecttype._etag response = self.client.get(reverse(zaakinformatieobjecttype), HTTP_IF_NONE_MATCH=f'"{etag}"') self.assertEqual(response.status_code, status.HTTP_304_NOT_MODIFIED)
def test_invalidate_etag_after_change(self): """ Because changes are made to the zaaktype, a code 200 should be returned """ zaaktype = ZaakTypeFactory.create(toelichting="bla") zaaktype._etag = calculate_etag(zaaktype) zaaktype.save(update_fields=["_etag"]) etag = zaaktype._etag zaaktype.toelichting = "same" zaaktype.save() response = self.client.get(reverse(zaaktype), HTTP_IF_NONE_MATCH=f'"{etag}"') self.assertEqual(response.status_code, status.HTTP_200_OK)
def test_invalidate_etag_after_change(self): """ Because changes are made to the roltype, a code 200 should be returned """ roltype = RolTypeFactory.create(omschrijving="bla", with_etag=True) roltype._etag = calculate_etag(roltype) roltype.save(update_fields=["_etag"]) etag = roltype._etag roltype.omschrijving = "same" roltype.save() response = self.client.get(reverse(roltype), HTTP_IF_NONE_MATCH=f'"{etag}"') self.assertEqual(response.status_code, status.HTTP_200_OK)
def test_invalidate_etag_after_change(self): """ Because changes are made to the catalogus, a code 200 should be returned """ catalogus = CatalogusFactory.create(domein="bla", with_etag=True) catalogus._etag = calculate_etag(catalogus) catalogus.save(update_fields=["_etag"]) etag = catalogus._etag catalogus.domein = "same" catalogus.save() response = self.client.get(reverse(catalogus), HTTP_IF_NONE_MATCH=f'"{etag}"') self.assertEqual(response.status_code, status.HTTP_200_OK)
def test_invalidate_etag_after_change(self): """ Because changes are made to the eigenschap, a code 200 should be returned """ eigenschap = EigenschapFactory.create(toelichting="bla", with_etag=True) eigenschap._etag = calculate_etag(eigenschap) eigenschap.save(update_fields=["_etag"]) etag = eigenschap._etag eigenschap.toelichting = "same" eigenschap.save() response = self.client.get(reverse(eigenschap), HTTP_IF_NONE_MATCH=f'"{etag}"') self.assertEqual(response.status_code, status.HTTP_200_OK)
def test_invalidate_etag_after_change(self): """ Because changes are made to the zaakinformatieobjecttype, a code 200 should be returned """ zaakinformatieobjecttype = ZaakInformatieobjectTypeFactory.create( volgnummer=1, with_etag=True) zaakinformatieobjecttype._etag = calculate_etag( zaakinformatieobjecttype) zaakinformatieobjecttype.save(update_fields=["_etag"]) etag = zaakinformatieobjecttype._etag zaakinformatieobjecttype.volgnummer = 2 zaakinformatieobjecttype.save() response = self.client.get(reverse(zaakinformatieobjecttype), HTTP_IF_NONE_MATCH=f'"{etag}"') self.assertEqual(response.status_code, status.HTTP_200_OK)