This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/endpoints/v2/test/test_v2auth.py
2017-02-22 16:59:19 -05:00

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)