18 lines
671 B
Python
18 lines
671 B
Python
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)
|