From ca69b3b631b85ffa84cafa05dedb6bb3796d98f5 Mon Sep 17 00:00:00 2001 From: Brian Scholer <1260690+briantist@users.noreply.github.com> Date: Thu, 28 Sep 2023 18:58:06 -0400 Subject: [PATCH] update units for prerelease --- .../utilities/test_collected_collections.py | 24 ++++++++++++++++++- .../utilities/test_discover_collections.py | 4 ++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/tests/unit/utilities/test_collected_collections.py b/tests/unit/utilities/test_collected_collections.py index 3a7d959..67f9533 100644 --- a/tests/unit/utilities/test_collected_collections.py +++ b/tests/unit/utilities/test_collected_collections.py @@ -25,7 +25,7 @@ def test_collected_collections_skip_missing_version(repository, props): @pytest.mark.parametrize('namespace', [None, 'community', 'briantist', 'fake']) -@pytest.mark.parametrize('collection', [None, 'whatever', 'hashi_vault', 'fake']) +@pytest.mark.parametrize('collection', [None, 'whatever', 'hashi_vault', 'fake', 'devel']) @pytest.mark.parametrize('scheme', [None, '', 'https']) def test_collected_collections_any(repository, discover_collections, namespace, collection, scheme, app_request_context): fqcn = None if any([namespace is None, collection is None]) else f"{namespace}.{collection}" @@ -62,3 +62,25 @@ def test_collected_collections_any(repository, discover_collections, namespace, assert ver == vd assert cols <= len(contents) + +@pytest.mark.parametrize('namespace', ['briantist']) +@pytest.mark.parametrize('collection', ['devel']) +def test_collected_collections_pre_only(repository, discover_collections, namespace, collection, app_request_context): + collections = collected_collections(repository, namespace, collection) + + contents = list(repository) + + cols = 0 + + for col, data in collections.items(): + assert col == f"{namespace}.{collection}" + assert 'versions' in data + assert 'latest' in data + assert data['latest']['version'] == '0.1.0-dev1' + + for v, vd in data['versions'].items(): + cols += 1 + # ver = next(discover_collections(repository, namespace=vd['namespace']['name'], name=vd['name'], version=v, scheme=scheme)) + # assert ver == vd + + assert cols <= len(contents) diff --git a/tests/unit/utilities/test_discover_collections.py b/tests/unit/utilities/test_discover_collections.py index ff6a5ef..5df19b5 100644 --- a/tests/unit/utilities/test_discover_collections.py +++ b/tests/unit/utilities/test_discover_collections.py @@ -25,8 +25,8 @@ def test_discover_collections_skip_missing_version(repository, props): @pytest.mark.parametrize('namespace', [None, 'community', 'briantist', 'fake']) -@pytest.mark.parametrize('collection', [None, 'whatever', 'hashi_vault', 'fake']) -@pytest.mark.parametrize('version', [None, '2.5.0', '3.0.0', '0.1.0', '0.2.0', '0.0.0']) +@pytest.mark.parametrize('collection', [None, 'whatever', 'hashi_vault', 'devel', 'fake']) +@pytest.mark.parametrize('version', [None, '2.5.0', '3.0.0', '0.1.0', '0.2.0', '0.0.0', '0.1.0-dev0', '0.1.0-dev1', '0.2.0-dev0']) def test_discover_collections_any(repository, manifest_loader, namespace, collection, version, app_request_context): gen = discover_collections(repository, namespace, collection, version)