예제 #1
0
    def setUpTestData(cls):
        # non-priv user
        cls.user = UserFactory.create(is_staff=True)

        # priv user
        cls.privileged_user = UserFactory.create(is_staff=True)
        perm = Permission.objects.get_by_natural_key("change_applicatie",
                                                     "authorizations",
                                                     "applicatie")
        cls.privileged_user.user_permissions.add(perm)

        cls.applicatie = ApplicatieFactory.create()
    def test_resultaattype_detail_with_read_only_user(self, m):
        user = UserFactory.create(is_staff=True)
        view_resultaattype = Permission.objects.get(codename="view_resultaattype")
        user.user_permissions.add(view_resultaattype)
        self.app.set_user(user)

        selectielijst_api = "https://selectielijst.openzaak.nl/api/v1/"
        procestype_url = (
            f"{selectielijst_api}procestypen/e1b73b12-b2f6-4c4e-8929-94f84dd2a57d"
        )
        resultaat_url = (
            f"{selectielijst_api}resultaten/cc5ae4e3-a9e6-4386-bcee-46be4986a829"
        )
        omschrijving_url = (
            "https://referentielijsten-api.vng.cloud/api/v1/"
            "resultaattypeomschrijvingen/e6a0c939-3404-45b0-88e3-76c94fb80ea7"
        )
        mock_oas_get(m)
        mock_resource_list(m, "resultaattypeomschrijvingen")
        mock_resource_list(m, "resultaten")
        mock_resource_get(m, "procestypen", procestype_url)
        mock_resource_get(m, "resultaten", resultaat_url)
        mock_resource_get(m, "resultaattypeomschrijvingen", omschrijving_url)
        resultaattype = ResultaatTypeFactory.create(
            zaaktype__selectielijst_procestype=procestype_url,
            selectielijstklasse=resultaat_url,
            resultaattypeomschrijving=omschrijving_url,
        )
        url = reverse("admin:catalogi_resultaattype_change", args=(resultaattype.pk,))

        response = self.app.get(url)

        self.assertEqual(response.status_code, 200)
예제 #3
0
    def setUpTestData(cls):
        super().setUpTestData()

        user = UserFactory.create(is_staff=True)
        view_catalogus = Permission.objects.get(codename="view_catalogus")
        user.user_permissions.add(view_catalogus)

        cls.user = user
예제 #4
0
    def setUpTestData(cls):
        super().setUpTestData()

        user = UserFactory.create(is_staff=True)
        view_zaaktype = Permission.objects.get(codename="view_zaaktype")
        view_informatieobjecttype = Permission.objects.get(
            codename="view_informatieobjecttype")
        view_besluittype = Permission.objects.get(codename="view_besluittype")
        user.user_permissions.add(view_zaaktype, view_informatieobjecttype,
                                  view_besluittype)

        cls.user = user
예제 #5
0
    def setUp(self):
        super().setUp()

        site = Site.objects.get_current()
        site.domain = "testserver"
        site.save()

        user = UserFactory.create(is_staff=True)
        perm = Permission.objects.get_by_natural_key("change_applicatie",
                                                     "authorizations",
                                                     "applicatie")
        user.user_permissions.add(perm)
        self.applicatie = ApplicatieFactory.create()
        self.client.force_login(user)
        self.url = reverse(
            "admin:authorizations_applicatie_autorisaties",
            kwargs={"object_id": self.applicatie.pk},
        )
    def setUpTestData(cls):
        site = Site.objects.get_current()
        site.domain = "testserver"
        site.save()

        # priv user
        cls.user = UserFactory.create(is_staff=True)
        _perms = [
            ("change_applicatie", "authorizations", "applicatie"),
            ("view_autorisatie", "authorizations", "autorisatie"),
        ]
        perms = [Permission.objects.get_by_natural_key(*_perm) for _perm in _perms]
        cls.user.user_permissions.add(*perms)

        cls.applicatie = ApplicatieFactory.create()

        cls.url = reverse(
            "admin:authorizations_applicatie_change",
            kwargs={"object_id": cls.applicatie.id},
        )