dipex 7.2.2__tar.gz → 7.2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dipex-7.2.2 → dipex-7.2.3}/PKG-INFO +1 -1
- {dipex-7.2.2 → dipex-7.2.3}/integrations/opus/opus_diff_import.py +20 -2
- {dipex-7.2.2 → dipex-7.2.3}/integrations/opus/tests/test_opus_diff_import.py +47 -1
- {dipex-7.2.2 → dipex-7.2.3}/pyproject.toml +1 -1
- {dipex-7.2.2 → dipex-7.2.3}/exporters/sql_export/__init__.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/exporters/sql_export/config.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/exporters/sql_export/gql_lora_cache_async.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/exporters/sql_export/lc_for_jobs_db.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/exporters/sql_export/lora_cache.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/exporters/sql_export/main.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/exporters/sql_export/sql_export.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/exporters/sql_export/sql_table_defs.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/exporters/sql_export/sql_url.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/exporters/sql_export/trigger.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/exporters/utils/priority_by_class.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/__init__.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/__init__.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/ad_common.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/ad_exceptions.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/ad_jinja_filters.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/ad_life_cycle.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/ad_logger.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/ad_reader.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/ad_sync.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/ad_template_engine.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/ad_templates.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/ad_writer.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/mo_to_ad_sync.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/payloads.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/read_ad_conf_settings.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/sync_mo_uuid_to_ad.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/test_connectivity.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/tests/__init__.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/tests/mocks.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/tests/name_simulator.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/tests/test_ad_common.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/tests/test_ad_jinja_filters.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/tests/test_ad_life_cycle.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/tests/test_ad_logger.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/tests/test_ad_reader.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/tests/test_ad_sync.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/tests/test_ad_writer.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/tests/test_dot_mapping.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/tests/test_first_included.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/tests/test_location_element.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/tests/test_mo_data_source.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/tests/test_mo_to_ad_sync.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/tests/test_morestsource.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/tests/test_read_ad_conf_settings.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/tests/test_recursive_dict_update.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/tests/test_sync_mo_uuid_to_ad.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/tests/test_usernames.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/tests/test_utils.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/user_names.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/username_rules/method_2.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/ad_integration/utils.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/dawa_helper.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/opus/clear_and_import_opus.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/opus/opus_check_dar_adresses.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/opus/opus_exceptions.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/opus/opus_file_reader.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/opus/opus_helpers.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/opus/opus_reimport_one.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/opus/org_tree_print/main.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/opus/payloads.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/opus/tests/test_opus_file_reader.py +0 -0
- {dipex-7.2.2 → dipex-7.2.3}/integrations/opus/tests/test_opus_helpers.py +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import asyncio
|
|
2
2
|
import logging
|
|
3
3
|
import sys
|
|
4
|
+
from datetime import date
|
|
4
5
|
from datetime import datetime
|
|
5
6
|
from datetime import timedelta
|
|
6
7
|
from operator import itemgetter
|
|
@@ -668,8 +669,25 @@ class OpusDiffImport(object):
|
|
|
668
669
|
item_datetime = datetime.strptime(item, "%Y-%m-%d")
|
|
669
670
|
return item_datetime
|
|
670
671
|
|
|
672
|
+
def _manager_effective_date(self, employee) -> date:
|
|
673
|
+
"""
|
|
674
|
+
The date at which the manager function should be looked up and edited.
|
|
675
|
+
|
|
676
|
+
New manager functions are created from the employee's entryDate, which
|
|
677
|
+
can be later than the date of the Opus file. Looking up managers at the
|
|
678
|
+
file date would then miss the future manager function and create a
|
|
679
|
+
duplicate on every run until the entryDate is reached. Use the latest
|
|
680
|
+
of the two dates to ensure lookups and creations agree.
|
|
681
|
+
"""
|
|
682
|
+
xml_date = self.xml_date.date()
|
|
683
|
+
if employee["entryDate"] is None:
|
|
684
|
+
return xml_date
|
|
685
|
+
entry_date = date.fromisoformat(employee["entryDate"])
|
|
686
|
+
return max(xml_date, entry_date)
|
|
687
|
+
|
|
671
688
|
def update_manager_status(self, employee_mo_uuid, employee):
|
|
672
|
-
|
|
689
|
+
effective_date = self._manager_effective_date(employee).isoformat()
|
|
690
|
+
url = "e/{}/details/manager?at=" + effective_date
|
|
673
691
|
all_manager_functions = self.helper._mo_lookup(employee_mo_uuid, url)
|
|
674
692
|
manager_functions = [
|
|
675
693
|
manager_function
|
|
@@ -709,7 +727,7 @@ class OpusDiffImport(object):
|
|
|
709
727
|
"manager_type": str(manager_type_uuid),
|
|
710
728
|
"level": str(manager_level_uuid),
|
|
711
729
|
"responsibility": str(responsibility_uuid),
|
|
712
|
-
"validity":
|
|
730
|
+
"validity": {"from": effective_date, "to": employee["leaveDate"]},
|
|
713
731
|
}
|
|
714
732
|
if manager_functions:
|
|
715
733
|
logger.info("Attempt manager update of {}:".format(employee_mo_uuid))
|
|
@@ -490,7 +490,7 @@ class TestUpdateEmployeeManagerFunctions(_GetInstanceMixin):
|
|
|
490
490
|
"@id": "1",
|
|
491
491
|
"isManager": "true",
|
|
492
492
|
"leaveDate": None,
|
|
493
|
-
"entryDate": datetime.now(),
|
|
493
|
+
"entryDate": datetime.now().strftime("%Y-%m-%d"),
|
|
494
494
|
"superiorLevel": "ledertype",
|
|
495
495
|
"subordinateLevel": "niveau 1",
|
|
496
496
|
"position": "stillingsbetegnelse",
|
|
@@ -606,6 +606,52 @@ class TestUpdateEmployeeManagerFunctions(_GetInstanceMixin):
|
|
|
606
606
|
},
|
|
607
607
|
)
|
|
608
608
|
|
|
609
|
+
def test_future_entry_date_does_not_duplicate_manager(self):
|
|
610
|
+
"""A manager created with a future entryDate must be found on later runs.
|
|
611
|
+
|
|
612
|
+
Regression test: the manager function was created from entryDate but
|
|
613
|
+
looked up at the file date, so every run before entryDate created a
|
|
614
|
+
new duplicate, and the first run on/after entryDate failed the
|
|
615
|
+
`len(manager_functions) == 1` assertion.
|
|
616
|
+
"""
|
|
617
|
+
# Arrange
|
|
618
|
+
employee = {**self.opus_employee, "entryDate": "2020-01-03"}
|
|
619
|
+
mo_managers: list[dict] = []
|
|
620
|
+
|
|
621
|
+
def mo_lookup(uuid, url):
|
|
622
|
+
# Emulate MO: only return manager functions active at the `at` date
|
|
623
|
+
at = url.split("at=")[1]
|
|
624
|
+
return [
|
|
625
|
+
m
|
|
626
|
+
for m in mo_managers
|
|
627
|
+
if m["validity"]["from"] <= at
|
|
628
|
+
and (m["validity"]["to"] is None or at <= m["validity"]["to"])
|
|
629
|
+
]
|
|
630
|
+
|
|
631
|
+
def mo_post(url, payload):
|
|
632
|
+
if url == "details/create":
|
|
633
|
+
mo_managers.append({**payload, "uuid": str(uuid4())})
|
|
634
|
+
return MagicMock(status_code=201)
|
|
635
|
+
return MagicMock(status_code=200)
|
|
636
|
+
|
|
637
|
+
# Act
|
|
638
|
+
for xml_date in ["2020-01-01", "2020-01-02", "2020-01-03", "2020-01-04"]:
|
|
639
|
+
instance = self.get_instance({})
|
|
640
|
+
instance.xml_date = datetime.fromisoformat(xml_date)
|
|
641
|
+
instance.helper._mo_lookup = MagicMock(side_effect=mo_lookup)
|
|
642
|
+
instance.helper._mo_post = MagicMock(side_effect=mo_post)
|
|
643
|
+
with patch.object(instance, "ensure_class_in_facet") as ensure_class:
|
|
644
|
+
ensure_class.side_effect = [
|
|
645
|
+
self.manager_level,
|
|
646
|
+
self.manager_type,
|
|
647
|
+
self.manager_responsibility,
|
|
648
|
+
]
|
|
649
|
+
instance.update_manager_status("mo_uuid", employee)
|
|
650
|
+
|
|
651
|
+
# Assert
|
|
652
|
+
assert len(mo_managers) == 1
|
|
653
|
+
assert mo_managers[0]["validity"] == {"from": "2020-01-03", "to": None}
|
|
654
|
+
|
|
609
655
|
def test_terminate_manager(self):
|
|
610
656
|
# Arrange
|
|
611
657
|
self.opus_employee["isManager"] = "false"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|