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
Merge requests
!283
Add more tests of hierarchical_access to OUs
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Add more tests of hierarchical_access to OUs
GREG-210-test-hierarchical-access
into
master
Overview
0
Commits
1
Pipelines
1
Changes
2
Merged
Andreas Ellewsen
requested to merge
GREG-210-test-hierarchical-access
into
master
3 years ago
Overview
0
Commits
1
Pipelines
1
Changes
2
Expand
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
80793d70
1 commit,
3 years ago
2 files
+
51
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
greg/tests/models/test_sponsor.py
+
16
−
0
Options
@@ -71,3 +71,19 @@ def test_get_allowed_loop(loop_sponsor, looped_units, unit_foo):
units
=
loop_sponsor
.
get_allowed_units
()
expected
=
[
i
.
id
for
i
in
looped_units
]
+
[
unit_foo
.
id
]
assert
[
x
.
id
for
x
in
units
]
==
expected
@pytest.mark.django_db
def
test_get_allowed
(
sponsor_foo
,
unit1
,
unit2
):
"""
Verify that hierarchical_access controls access to allowed units
"""
spu
=
sponsor_ou_relation
(
sponsor
=
sponsor_foo
,
organizational_unit
=
unit1
)
unit2
.
parent
=
unit1
unit2
.
save
()
# Without hier access only get unit connected to
assert
sponsor_foo
.
get_allowed_units
()
==
{
unit1
}
# With hier access also get units below
spu
.
hierarchical_access
=
True
spu
.
save
()
assert
sponsor_foo
.
get_allowed_units
()
==
{
unit1
,
unit2
}
Loading