Add a test to ensure we don't hit the database when accessing a private catalog with no auth

This commit is contained in:
Joseph Schorr 2018-06-05 19:42:16 -04:00
parent 44bb000fa5
commit 06cb4bddaa

View file

@ -674,6 +674,19 @@ def test_push_disabled_namespace(pusher, basic_images, liveserver_session,
credentials=credentials, expected_failure=Failures.NAMESPACE_DISABLED)
def test_private_catalog_no_access(v2_protocol, liveserver_session, app_reloader, liveserver,
registry_server_executor):
""" Test: Ensure that accessing a private catalog with anonymous access results in no database
connections.
"""
with FeatureFlagValue('PUBLIC_CATALOG', False, registry_server_executor.on(liveserver)):
# Disconnect the server from the database.
registry_server_executor.on(liveserver).break_database()
results = v2_protocol.catalog(liveserver_session)
assert not results
@pytest.mark.parametrize('public_catalog, credentials, expected_repos', [
# No public access and no credentials => No results.
(False, None, None),