Fix broken registry data interface tests

This commit is contained in:
Joseph Schorr 2018-08-20 11:36:04 -04:00
parent ed897626a2
commit 301532279c

View file

@ -12,9 +12,10 @@ def pre_oci_model(initialized_db):
@pytest.mark.parametrize('names, expected', [ @pytest.mark.parametrize('names, expected', [
(['unknown'], None), (['unknown'], None),
(['latest'], 'latest'), (['latest'], {'latest'}),
(['latest', 'prod'], 'latest'), (['latest', 'prod'], {'latest', 'prod'}),
(['foo', 'prod'], 'prod'), (['latest', 'prod', 'another'], {'latest', 'prod'}),
(['foo', 'prod'], {'prod'}),
]) ])
def test_find_matching_tag(names, expected, pre_oci_model): def test_find_matching_tag(names, expected, pre_oci_model):
repo = model.repository.get_repository('devtable', 'simple') repo = model.repository.get_repository('devtable', 'simple')
@ -23,12 +24,12 @@ def test_find_matching_tag(names, expected, pre_oci_model):
if expected is None: if expected is None:
assert found is None assert found is None
else: else:
assert found.name == expected assert found.name in expected
@pytest.mark.parametrize('repo_namespace, repo_name, expected', [ @pytest.mark.parametrize('repo_namespace, repo_name, expected', [
('devtable', 'simple', 'latest'), ('devtable', 'simple', {'latest'}),
('buynlarge', 'orgrepo', 'latest'), ('buynlarge', 'orgrepo', {'latest', 'prod'}),
]) ])
def test_get_most_recent_tag(repo_namespace, repo_name, expected, pre_oci_model): def test_get_most_recent_tag(repo_namespace, repo_name, expected, pre_oci_model):
repo = model.repository.get_repository(repo_namespace, repo_name) repo = model.repository.get_repository(repo_namespace, repo_name)
@ -37,4 +38,4 @@ def test_get_most_recent_tag(repo_namespace, repo_name, expected, pre_oci_model)
if expected is None: if expected is None:
assert found is None assert found is None
else: else:
assert found.name == expected assert found.name in expected