Exemplo n.º 1
0
    def setUp(self):
        super().setUp()

        mapping = TaskMappingFactory.create(topic_name="some-topic")
        DefaultServiceFactory.create(
            task_mapping=mapping,
            service__api_root=DRC_URL,
            service__api_type="drc",
            alias="drc",
        )
        DefaultServiceFactory.create(
            task_mapping=mapping,
            service__api_root=ZRC_URL,
            service__api_type="zrc",
            alias="ZRC",
        )

        self.fetched_task = ExternalTask.objects.create(
            topic_name="some-topic",
            worker_id="test-worker-id",
            task_id="test-task-id",
            variables={
                "zaakUrl": serialize_variable(ZAAK),
                "bptlAppId": serialize_variable("some-app-id"),
            },
        )
    def setUpTestData(cls):
        super().setUpTestData()

        mapping = TaskMappingFactory.create(topic_name="some-topic")
        DefaultServiceFactory.create(
            task_mapping=mapping,
            service__api_root=ZRC_URL,
            service__api_type="zrc",
            alias="ZRC",
        )
        DefaultServiceFactory.create(
            task_mapping=mapping,
            service__api_root=ZTC_URL,
            service__api_type="ztc",
            alias="ZTC",
        )
        cls.fetched_task = ExternalTask.objects.create(
            topic_name="some-topic",
            worker_id="test-worker-id",
            task_id="test-task-id",
            variables={
                "zaakUrl": serialize_variable(ZAAK),
                "statustype": serialize_variable(STATUSTYPE),
                "services": serialize_variable({"ZRC": {"jwt": "Bearer 12345"}}),
                "toelichting": serialize_variable("some description"),
            },
        )
Exemplo n.º 3
0
    def setUpTestData(cls):
        super().setUpTestData()

        mapping = TaskMappingFactory.create(topic_name="some-topic")
        DefaultServiceFactory.create(
            task_mapping=mapping,
            service__api_root=DRC_URL,
            service__api_type="drc",
            alias="drc",
        )

        cls.fetched_task = ExternalTask.objects.create(
            topic_name="some-topic",
            worker_id="test-worker-id",
            task_id="test-task-id",
            variables={
                "informatieobject":
                serialize_variable(DOCUMENT_URL),
                "lockId":
                serialize_variable("bacbaeaf-600d-4b79-9414-3e1a668addd3"),
                "services":
                serialize_variable({
                    "drc": {
                        "jwt": "Bearer 12345"
                    },
                }),
            },
        )
Exemplo n.º 4
0
    def setUpTestData(cls):
        super().setUpTestData()

        mapping = TaskMappingFactory.create(topic_name="some-topic")
        DefaultServiceFactory.create(
            task_mapping=mapping,
            service__api_root=ZRC_URL,
            service__api_type="zrc",
            alias="ZRC",
        )
        cls.fetched_task = ExternalTask.objects.create(
            topic_name="some-topic",
            worker_id="test-worker-id",
            task_id="test-task-id",
            variables={
                "zaakUrl": {"type": "String", "value": ZAAK, "valueInfo": {}},
                "objectUrl": {"type": "String", "value": OBJECT, "valueInfo": {}},
                "objectType": {"type": "String", "value": "adres", "valueInfo": {}},
                "services": {
                    "type": "json",
                    "value": json.dumps(
                        {
                            "ZRC": {"jwt": "Bearer 12345"},
                        }
                    ),
                },
            },
        )
Exemplo n.º 5
0
    def setUpTestData(cls):
        super().setUpTestData()

        cls.mapping = TaskMappingFactory.create(topic_name="some-topic")
        cls.task = ExternalTaskFactory.create(topic_name="some-topic")
        cls.work_unit = ZGWWorkUnit(cls.task)
        cls.service = Service.objects.create(
            api_type=APITypes.zrc, api_root=ZRC_URL, label="zrc_service"
        )
Exemplo n.º 6
0
    def setUpTestData(cls):
        super().setUpTestData()

        mapping = TaskMappingFactory.create(topic_name="some-topic")
        DefaultServiceFactory.create(
            task_mapping=mapping,
            service__api_root=ZRC_URL,
            service__api_type="zrc",
            alias="ZRC",
        )
        DefaultServiceFactory.create(
            task_mapping=mapping,
            service__api_root=ZTC_URL,
            service__api_type="ztc",
            alias="ZTC",
        )
Exemplo n.º 7
0
    def setUpTestData(cls):
        super().setUpTestData()

        mapping = TaskMappingFactory.create(topic_name="some-topic")
        DefaultServiceFactory.create(
            task_mapping=mapping,
            service__api_root=ZRC_URL,
            service__api_type="zrc",
            alias="ZRC",
        )
        DefaultServiceFactory.create(
            task_mapping=mapping,
            service__api_root=ZTC_URL,
            service__api_type="ztc",
            alias="ZTC",
        )
        cls.fetched_task = ExternalTask.objects.create(
            topic_name="some-topic",
            worker_id="test-worker-id",
            task_id="test-task-id",
            variables={
                "zaakUrl":
                serialize_variable(ZAAK),
                "omschrijving":
                serialize_variable("roltype omschrijving"),
                "betrokkene":
                serialize_variable({
                    "betrokkene": "http://some.api.nl/betrokkenen/12345",
                    "betrokkeneType": "natuurlijk_persoon",
                    "roltoelichting": "A test roltoelichting",
                }),
                "services":
                serialize_variable({
                    "ZRC": {
                        "jwt": "Bearer 12345"
                    },
                    "ZTC": {
                        "jwt": "Bearer 789"
                    }
                }),
            },
        )
Exemplo n.º 8
0
    def setUpTestData(cls):
        super().setUpTestData()

        mapping = TaskMappingFactory.create(topic_name="some-topic")
        DefaultServiceFactory.create(
            task_mapping=mapping,
            service__api_root=ZRC_URL,
            service__api_type="zrc",
            alias="ZRC",
        )
        DefaultServiceFactory.create(
            task_mapping=mapping,
            service__api_root=ZTC_URL,
            service__api_type="ztc",
            alias="ZTC",
        )
        cls.fetched_task = ExternalTask.objects.create(
            topic_name="some-topic",
            worker_id="test-worker-id",
            task_id="test-task-id",
            variables={
                "services":
                serialize_variable({
                    "ZRC": {
                        "jwt": "Bearer 12345"
                    },
                    "ZTC": {
                        "jwt": "Bearer 12345"
                    },
                }),
                "zaakUrl":
                serialize_variable(ZAAK),
                "eigenschap":
                serialize_variable({
                    "naam": "start",
                    "waarde": "2020-05-01",
                }),
            },
        )
Exemplo n.º 9
0
    def setUpClass(cls):
        super().setUpClass()

        cls.mapping = TaskMappingFactory.create(topic_name="some-topic")
        DefaultServiceFactory.create(
            task_mapping=cls.mapping,
            service__api_type=APITypes.zrc,
            service__api_root=ZRC_URL,
            alias="ZRC",
        )
        cls.task = ExternalTaskFactory.create(
            topic_name="some-topic",
            variables={
                "services": {
                    "type": "json",
                    "value": json.dumps({"ZRC": {
                        "jwt": "Bearer 12345"
                    }}),
                }
            },
        )
        cls.work_unit = ZGWWorkUnit(cls.task)
Exemplo n.º 10
0
    def setUpTestData(cls):
        super().setUpTestData()

        mapping = TaskMappingFactory.create(topic_name="some-topic")
        DefaultServiceFactory.create(
            task_mapping=mapping,
            service__api_root=ZRC_URL,
            service__api_type="zrc",
            alias="ZRC",
        )
        cls.fetched_task = ExternalTask.objects.create(
            topic_name="some-topic",
            worker_id="test-worker-id",
            task_id="test-task-id",
            variables={
                "identificatie": serialize_variable("ZAAK-001122"),
                "bronorganisatie": serialize_variable("123456782"),
                "services":
                serialize_variable({"ZRC": {
                    "jwt": "Bearer 12345"
                }}),
            },
        )
Exemplo n.º 11
0
    def setUpTestData(cls):
        super().setUpTestData()

        mapping = TaskMappingFactory.create(topic_name="some-topic")
        DefaultServiceFactory.create(
            task_mapping=mapping,
            service__api_root=ZRC_URL,
            service__api_type="zrc",
            alias="ZRC",
        )
        cls.fetched_task = ExternalTask.objects.create(
            topic_name="some-topic",
            worker_id="test-worker-id",
            task_id="test-task-id",
            variables={
                "zaakUrl": serialize_variable(BIJDRAGE_ZAAK),
                "hoofdZaakUrl": serialize_variable(ZAAK),
                "bijdrageAard": serialize_variable("bijdrage"),
                "services":
                serialize_variable({"ZRC": {
                    "jwt": "Bearer 12345"
                }}),
            },
        )
Exemplo n.º 12
0
    def test_multiple_services(self, m):
        task_mapping = TaskMappingFactory.create(
            topic_name="some-different-topic")
        another_xential_api_root = "http://another.xential.nl/api/"
        xential_service = ServiceFactory.create(
            api_root=another_xential_api_root, api_type=APITypes.orc)
        DefaultServiceFactory.create(alias=XENTIAL_ALIAS,
                                     service=xential_service,
                                     task_mapping=task_mapping)

        user = SuperUserFactory.create()

        # First Xential API
        m.post(
            f"{XENTIAL_API_ROOT}auth/whoami",
            json={
                "user": {
                    "uuid": "a4664ccb-259e-4107-b800-d8e5a764b9dd",
                    "userName": "******",
                },
                "XSessionId": "f7f588eb-b7c9-4d23-babd-4a98a9326367",
            },
        )
        m.post(
            f"{XENTIAL_API_ROOT}template_utils/getUsableTemplates",
            json={
                "objects": [{
                    "uuid": "uuid-1",
                    "objectTypeId": "templategroup",
                    "fields": [{
                        "name": "name",
                        "value": "Sjablonen"
                    }],
                }]
            },
        )
        m.post(
            f"{XENTIAL_API_ROOT}template_utils/getUsableTemplates?parentGroupUuid=uuid-1",
            json={
                "objects": [{
                    "uuid":
                    "uuid-2",
                    "objectTypeId":
                    "ooxmltexttemplate",
                    "fields": [{
                        "name": "name",
                        "value": "TestSjabloon"
                    }],
                }]
            },
        )

        # Second Xential api
        m.post(
            f"{another_xential_api_root}auth/whoami",
            json={
                "user": {
                    "uuid": "a4664ccb-259e-4107-b800-d8e5a764b9dd",
                    "userName": "******",
                },
                "XSessionId": "f7f588eb-b7c9-4d23-babd-4a98a9326367",
            },
        )
        m.post(
            f"{another_xential_api_root}template_utils/getUsableTemplates",
            json={
                "objects": [{
                    "uuid": "uuid-1",
                    "objectTypeId": "templategroup",
                    "fields": [{
                        "name": "name",
                        "value": "Sjablonen"
                    }],
                }]
            },
        )
        m.post(
            f"{another_xential_api_root}template_utils/getUsableTemplates?parentGroupUuid=uuid-1",
            json={
                "objects": [{
                    "uuid":
                    "uuid-2",
                    "objectTypeId":
                    "ooxmltexttemplate",
                    "fields": [{
                        "name": "name",
                        "value": "TestSjabloon"
                    }],
                }]
            },
        )

        page = self.app.get(self.url, user=user)

        self.assertEqual(page.status_code, 200)
        self.assertIn("template_groups", page.context)

        template_group_context = page.context["template_groups"]

        self.assertEqual(2, len(template_group_context))