Adding in what metadata_root_name to JWT
This commit is contained in:
parent
deb2b1b003
commit
e87404c327
2 changed files with 40 additions and 0 deletions
18
endpoints/v2/test/test_v2auth.py
Normal file
18
endpoints/v2/test/test_v2auth.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
import pytest
|
||||
|
||||
from endpoints.v2.v2auth import attach_metadata_root_name, CLAIM_APOSTILLE_ROOT
|
||||
|
||||
|
||||
@pytest.mark.parametrize('context,access,expected', [
|
||||
({}, None, {}),
|
||||
({}, [], {}),
|
||||
({}, [{}], {}),
|
||||
({}, [{"actions": None}], {}),
|
||||
({}, [{"actions": []}], {}),
|
||||
({}, [{"actions": ["pull"]}], {CLAIM_APOSTILLE_ROOT: 'quay'}),
|
||||
({}, [{"actions": ["push"]}], {CLAIM_APOSTILLE_ROOT: 'signer'}),
|
||||
({}, [{"actions": ["pull", "push"]}], {CLAIM_APOSTILLE_ROOT: 'signer'}),
|
||||
])
|
||||
def test_attach_metadata_root_name(context, access, expected):
|
||||
actual = attach_metadata_root_name(context, access)
|
||||
assert actual == expected, "should be %s, but was %s" % (expected, actual)
|
Reference in a new issue