From 4aca9b4771f492697f1442fc879708f2bcf53570 Mon Sep 17 00:00:00 2001 From: Jonathan Green Date: Wed, 1 Nov 2023 13:27:25 -0300 Subject: [PATCH] Add additional test for collection self tests --- .../controller/test_collection_self_tests.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/tests/api/admin/controller/test_collection_self_tests.py b/tests/api/admin/controller/test_collection_self_tests.py index 64e37e444f..f1ec25d5d6 100644 --- a/tests/api/admin/controller/test_collection_self_tests.py +++ b/tests/api/admin/controller/test_collection_self_tests.py @@ -17,14 +17,6 @@ from tests.fixtures.database import DatabaseTransactionFixture -class CollectionSelfTestsControllerFixture: - def __init__(self, db: DatabaseTransactionFixture): - self.db = db - - def controller(self) -> CollectionSelfTestsController: - return CollectionSelfTestsController(self.db.session) - - @pytest.fixture def controller(db: DatabaseTransactionFixture) -> CollectionSelfTestsController: return CollectionSelfTestsController(db.session) @@ -113,6 +105,17 @@ def test_collection_self_tests_failed_post( assert excinfo.value.problem_detail == FAILED_TO_RUN_SELF_TESTS + def test_collection_self_tests_run_self_tests_unsupported_collection( + self, + db: DatabaseTransactionFixture, + ): + registry = LicenseProvidersRegistry() + registry.register(object, canonical="mock_api") # type: ignore[arg-type] + collection = db.collection(protocol="mock_api") + controller = CollectionSelfTestsController(db.session, registry) + response = controller.run_self_tests(collection.integration_configuration) + assert response is None + def test_collection_self_tests_post( self, db: DatabaseTransactionFixture,