Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
greg
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
it-bott-integrasjoner
greg
Commits
6322ba85
Commit
6322ba85
authored
3 years ago
by
Tore.Brede
Browse files
Options
Downloads
Patches
Plain Diff
GREG-123: Fixing test and small refactoring
parent
7fd728e2
No related branches found
No related tags found
1 merge request
!191
GREG-123: Adding option for acronym identifier import from orgreg
Pipeline
#102887
passed
3 years ago
Stage: venv update
Stage: tests and linting
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
greg/management/commands/import_from_orgreg.py
+24
-21
24 additions, 21 deletions
greg/management/commands/import_from_orgreg.py
greg/tests/management/test_import_from_orgreg.py
+2
-2
2 additions, 2 deletions
greg/tests/management/test_import_from_orgreg.py
with
26 additions
and
23 deletions
greg/management/commands/import_from_orgreg.py
+
24
−
21
View file @
6322ba85
...
@@ -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
(
...
...
This diff is collapsed.
Click to expand it.
greg/tests/management/test_import_from_orgreg.py
+
2
−
2
View file @
6322ba85
...
@@ -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_acronym
2
"
},
acronym
=
{
"
nob
"
:
"
foo_acronym
3
"
},
),
),
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_acronym
3
"
},
acronym
=
{
"
nob
"
:
"
foo_acronym
2
"
},
),
),
]
]
)
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment