Skip to content

Commit

Permalink
Add additional test for collection self tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathangreen committed Nov 1, 2023
1 parent bc7f3c0 commit 4aca9b4
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions tests/api/admin/controller/test_collection_self_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 4aca9b4

Please sign in to comment.