Adding in what metadata_root_name to JWT

This commit is contained in:
Charlton Austin 2017-02-22 14:35:11 -05:00
parent deb2b1b003
commit e87404c327
2 changed files with 40 additions and 0 deletions

View 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)