def test_VakantieVerhuur(self):
        zaak_source = {
            "date6": "2021-07-05T00:00:00",
            "date7": "2021-07-06T00:00:00",
            "document_date": "2021-04-28T00:00:00",
            "mark": "Z/21/67890123",
            "subject1": "Melding Amstel 1  - V Achternaam",
            "text11": "Nvt",
            "text12": "Geen kosten",
            "text45": "Vakantieverhuur",
            "text6": "Amstel 1 1012AA Amsterdam",
            "text7": "Z/11/123456",
            "title": "Ontvangen",
            "id": "zaak-1",
        }
        zaak_transformed = VakantieVerhuur(zaak_source).result()

        self.assertEqual(zaak_transformed["caseType"], "Vakantieverhuur")
        self.assertEqual(zaak_transformed["title"], "Afgelopen verhuur")
        self.assertEqual(zaak_transformed["decision"], None)
        self.assertEqual(zaak_transformed["dateStart"], to_date("2021-07-05"))
        self.assertEqual(zaak_transformed["dateEnd"], to_date("2021-07-06"))
        self.assertEqual(zaak_transformed["dateRequest"],
                         to_date("2021-04-28"))

        zaak_source["date6"] = "2021-07-25T00:00:00"
        zaak_source["date7"] = "2021-07-30T00:00:00"

        zaak_transformed = VakantieVerhuur(zaak_source).result()

        self.assertEqual(zaak_transformed["title"], "Geplande verhuur")
        self.assertEqual(zaak_transformed["dateStart"], to_date("2021-07-25"))
        self.assertEqual(zaak_transformed["dateEnd"], to_date("2021-07-30"))
Ejemplo n.º 2
0
    def test_to_date(self):
        # this comes from the api most likely
        self.assertEqual(to_date("2020-06-16T00:00:00"), date(2020, 6, 16))
        self.assertEqual(to_date("2020-06-16"), date(2020, 6, 16))

        self.assertEqual(to_date(date(2020, 6, 16)), date(2020, 6, 16))
        self.assertEqual(to_date(datetime(2020, 6, 16, 1, 1, 1)),
                         date(2020, 6, 16))

        self.assertEqual(to_date(1), None)
    def get_workflow(self, zaak_id: str, step_title: str):
        all_workflows_response = self.request(
            f"{self.api_url}items/{zaak_id}/workflows"
        )

        if all_workflows_response and all_workflows_response["count"] > 0:
            # Take last workflow key

            if LOG_RAW:
                print("\n\nAll workflows")
                pprint(all_workflows_response)
                print("====\n\n")

            worflow_key = all_workflows_response["content"][-1]["key"]
            single_workflow_url = f"{self.api_url}items/{worflow_key}/workflowlinkinstances?properties=false&fetchParents=false&oDataQuery.select=mark,date1,date2,text7,sequence&oDataQuery.orderBy=sequence"
            single_workflow_response = self.request(single_workflow_url)

            if not single_workflow_response["content"]:
                return None

            date_in_behandeling = None

            for workflow_step in single_workflow_response["content"]:
                if (
                    "text7" in workflow_step["fields"]
                    and workflow_step["fields"]["text7"] == step_title
                ):
                    date_in_behandeling = to_date(workflow_step["fields"]["date1"])

            return date_in_behandeling

        return None
 def test_Diensten(self):
     zaak_source = {
         "mark": "Z/21/99012451",
         "document_date": "2021-05-18T00:00:00",
         "date5": "2022-02-01T00:00:00",
         "text6": "Amstel 12 1012AK AMSTERDAM",
         "date6": "2022-04-21T00:00:00",
         "date7": "2022-04-26T00:00:00",
         "title": "Ontvangen",
         "dfunction": "Verleend",
         "id": "zaak-1",
     }
     zaak_transformed = AanbiedenDiensten(zaak_source).result()
     self.assertEqual(zaak_transformed["caseType"],
                      "Aanbieden van diensten")
     self.assertEqual(zaak_transformed["location"],
                      "Amstel 12 1012AK AMSTERDAM")
     self.assertEqual(zaak_transformed["dateStart"], to_date("2022-04-21"))
     self.assertEqual(zaak_transformed["dateEnd"], to_date("2022-04-26"))
 def test_Flyeren(self):
     zaak_source = {
         "mark": "Z/21/99012350",
         "document_date": "2021-05-18T00:00:00",
         "date5": "2022-02-01T00:00:00",
         "text6": "Amstel 1 1012AK AMSTERDAM",
         "date6": "2022-05-21T00:00:00",
         "date7": "2022-05-26T00:00:00",
         "text7": "10:00",
         "text8": "17:00",
         "title": "Ontvangen",
         "dfunction": "Verleend",
         "id": "zaak-1",
     }
     zaak_transformed = Flyeren(zaak_source).result()
     self.assertEqual(zaak_transformed["caseType"],
                      "Verspreiden reclamemateriaal (sampling)")
     self.assertEqual(zaak_transformed["timeStart"], "10:00")
     self.assertEqual(zaak_transformed["timeEnd"], "17:00")
     self.assertEqual(zaak_transformed["dateStart"], to_date("2022-05-21"))
     self.assertEqual(zaak_transformed["dateEnd"], to_date("2022-05-26"))
    def test_TVM_RVV_Object(self):
        zaak_source = {
            "title": "Ontvangen",
            "mark": "Z/20/1234567",
            "text45": "TVM - RVV - Object",
            "subject1": "Test beschrijving",
            "text11": "Nogniet",
            "text12": "Er is iets misgegaan, controleer online betaling!",
            "text13": "16:00",
            "text6": "Amstel 1 1000AB",
            "date6": "2021-04-27T00:00:00",
            "text7": "TEST MA Decos",
            "text10": "10:00",
            "date7": "2021-04-28T00:00:00",
            "document_date": "2021-04-16T00:00:00",
            "id": "zaak-1",
        }

        zaak_transformed = {
            "id": "zaak-1",
            "caseType": "TVM - RVV - Object",
            "title": "Tijdelijke verkeersmaatregel (TVM-RVV-Object)",
            "identifier": "Z/20/1234567",
            "dateRequest": to_date(zaak_source["document_date"]),
            "dateWorkflowActive": to_date(zaak_source["document_date"]),
            "status": "Ontvangen",
            "decision": None,
            "dateDecision": None,
            "description": "Test beschrijving",
            "kenteken": None,
            "location": "Amstel 1 1000AB",
            "timeEnd": "16:00",
            "timeStart": "10:00",
            "dateStart": to_date(zaak_source["date6"]),
            "dateEnd": to_date(zaak_source["date7"]),
        }

        self.assertEqual(TVM_RVV_Object(zaak_source).zaak, zaak_transformed)
 def test_BZB(self):
     zaak_source = {
         "company": "Achternaam",
         "date6": "2021-05-26T00:00:00",
         "date7": "2022-05-26T00:00:00",
         "document_date": "2021-05-18T00:00:00",
         "mark": "Z/21/99012349",
         "text8": "Uw bedrijfje",
         "text45": "Parkeerontheffingen Blauwe zone bedrijven",
         "title": "Ontvangen",
         "dfunction": "Verleend",
         "id": "zaak-1",
     }
     zaak_transformed = BZB(zaak_source).result()
     self.assertEqual(zaak_transformed["caseType"],
                      "Parkeerontheffingen Blauwe zone bedrijven")
     self.assertEqual(zaak_transformed["companyName"], "Uw bedrijfje")
     self.assertEqual(zaak_transformed["dateStart"], to_date("2021-05-26"))
    def test_transform_bb_vergunning(self):
        def wrap(zaak, key):
            return {
                "key":
                key,
                "fields":
                zaak,
                "links": [{
                    "href":
                    """https://decosdvl.acc.amsterdam.nl/decosweb/aspx/api/v1/items/{key}""",
                    "rel": "self",
                }],
            }

        zaak_bb_vergunning = {
            "company": "Haarlem",
            "date6": "2021-05-19T00:00:00",
            "date7": "2021-12-31T00:00:00",
            "document_date": "2021-05-19T00:00:00",
            "mark": "Z/21/78901234",
            "subject1": "B&B vergunning aanvragen - Amstel 1",
            "text10": "Ja",
            "text11": "Geheel",
            "text12": "Online voldaan",
            "text45": "B&B - vergunning",
            "text6": "Amstel 1 1012AA Amsterdam",
            "text7": "Test veld Adres Locatie",
            "text8": "<nietnodig>",
            "title": "Ontvangen",
            "id": "HEXSTRING17",
        }

        zaken_result = self.connection.transform(
            [
                wrap(zaak_bb_vergunning, "HEXSTRING17"),
            ],
            "test-user-id",
        )

        self.assertEqual(len(zaken_result), 1)
        self.assertEqual(zaken_result[0]["caseType"], "B&B - vergunning")
        self.assertEqual(zaken_result[0]["identifier"], "Z/21/78901234")
        self.assertEqual(zaken_result[0]["dateWorkflowActive"],
                         to_date("2021-09-15"))
 def test_BZP(self):
     zaak_source = {
         "company": "Achternaam",
         "date6": "2021-06-26T00:00:00",
         "date7": "2022-06-26T00:00:00",
         "document_date": "2021-05-18T00:00:00",
         "mark": "Z/21/99012350",
         "text8": "KN-UW-TS",
         "text45": "Parkeerontheffingen Blauwe zone particulieren",
         "title": "Ontvangen",
         "dfunction": "Verleend",
         "id": "zaak-1",
     }
     zaak_transformed = BZP(zaak_source).result()
     self.assertEqual(
         zaak_transformed["caseType"],
         "Parkeerontheffingen Blauwe zone particulieren",
     )
     self.assertEqual(zaak_transformed["kenteken"], "KN-UW-TS")
     self.assertEqual(zaak_transformed["dateStart"], to_date("2021-06-26"))
Ejemplo n.º 10
0
    def test_Omzettingsvergunning(self):
        zaak_source = {
            "id": "zaak-omzettingsvergunning-1",
            "company": "Achternaam",
            "date6": "2021-06-02T00:00:00",
            "document_date": "2021-05-19T00:00:00",
            "mark": "Z/21/99012348",
            "subject1": "Omzettingsvergunning aanvragen",
            "text11": "Geheel",
            "text12": "Online voldaan",
            "text45": "Omzettingsvergunning",
            "text6": "Amstel 1 1012AK AMSTERDAM",
            "text7": "Amstel",
            "title": "Ontvangen",
        }
        zaak_transformed = Omzettingsvergunning(zaak_source).result()
        self.assertEqual(
            zaak_transformed["caseType"],
            "Omzettingsvergunning",
        )
        self.assertEqual(
            zaak_transformed["title"],
            "Vergunning voor kamerverhuur (omzettingsvergunning)",
        )

        class connection_mock:
            get_workflow = MagicMock(return_value=to_date("2021-10-15"))

        zaken_all = []

        Omzettingsvergunning.defer_transform(zaak_transformed, zaken_all,
                                             connection_mock())

        self.assertEqual(zaak_transformed["dateWorkflowActive"],
                         to_date("2021-10-15"))

        connection_mock.get_workflow.assert_called_once_with(
            "zaak-omzettingsvergunning-1",
            Omzettingsvergunning.date_workflow_active_step_title,
        )
    def test_get_workflow(self):
        workflow_date = self.connection.get_workflow(
            "HEXSTRING17", BBVergunning.date_workflow_active_step_title)

        self.assertEqual(workflow_date, to_date("2021-09-15"))
Ejemplo n.º 12
0
 def to_date_decision(self) -> str:  # Datum afhandeling
     return to_date(to_string_if_exists(self.zaak_source, "date5"))
Ejemplo n.º 13
0
 def to_date_request(self):  # Startdatum zaak
     return to_date(to_string_if_exists(self.zaak_source, "document_date"))
Ejemplo n.º 14
0
 class connection_mock:
     get_workflow = MagicMock(return_value=to_date("2021-10-15"))