Skip to content
Snippets Groups Projects
Commit 6322ba85 authored by Tore.Brede's avatar Tore.Brede
Browse files

GREG-123: Fixing test and small refactoring

parent 7fd728e2
No related branches found
No related tags found
1 merge request!191GREG-123: Adding option for acronym identifier import from orgreg
Pipeline #102887 passed
...@@ -46,27 +46,30 @@ class Command(BaseCommand): ...@@ -46,27 +46,30 @@ class Command(BaseCommand):
# Acronyms can also be used as identifiers # Acronyms can also be used as identifiers
for acronym in settings.ORGREG_ACRONYMS: for acronym in settings.ORGREG_ACRONYMS:
if acronym == "nob" and ou.acronym.nob is not None: self.handle_acronym_identifier(acronym, ou)
self._upsert_identifier(
settings.ORGREG_SOURCE, def handle_acronym_identifier(self, acronym, ou):
"acronym_" + acronym, if acronym == "nob" and ou.acronym.nob is not None:
ou.acronym.nob, self._upsert_identifier(
ou.ou_id, settings.ORGREG_SOURCE,
) "acronym_" + acronym,
if acronym == "eng" and ou.acronym.eng is not None: ou.acronym.nob,
self._upsert_identifier( ou.ou_id,
settings.ORGREG_SOURCE, )
"acronym_" + acronym, if acronym == "eng" and ou.acronym.eng is not None:
ou.acronym.eng, self._upsert_identifier(
ou.ou_id, settings.ORGREG_SOURCE,
) "acronym_" + acronym,
if acronym == "nno" and ou.acronym.nno is not None: ou.acronym.eng,
self._upsert_identifier( ou.ou_id,
settings.ORGREG_SOURCE, )
"acronym_" + acronym, if acronym == "nno" and ou.acronym.nno is not None:
ou.acronym.nno, self._upsert_identifier(
ou.ou_id, settings.ORGREG_SOURCE,
) "acronym_" + acronym,
ou.acronym.nno,
ou.ou_id,
)
@staticmethod @staticmethod
def _get_external_key_from_ou( def _get_external_key_from_ou(
......
...@@ -43,7 +43,7 @@ def orgreg_response(): ...@@ -43,7 +43,7 @@ def orgreg_response():
parent=2, parent=2,
name={"nob": "bar"}, name={"nob": "bar"},
external_keys=[], external_keys=[],
acronym={"nob": "foo_acronym2"}, acronym={"nob": "foo_acronym3"},
), ),
OrgUnit( OrgUnit(
ou_id=2, ou_id=2,
...@@ -51,7 +51,7 @@ def orgreg_response(): ...@@ -51,7 +51,7 @@ def orgreg_response():
parent=1, parent=1,
name={"eng": "baz"}, name={"eng": "baz"},
external_keys=[], external_keys=[],
acronym={"nob": "foo_acronym3"}, acronym={"nob": "foo_acronym2"},
), ),
] ]
) )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment