@@ -0,0 +1,1165 @@
+class TestShutdown:%0A%0A    async def test(self, mocker, monkeypatch, do_get):%0A        %22%22%22%0A        Test that a %60%60GET /api/lifecycle/shutdown%60%60 results in :meth:%60aiohttp.web.Application.shutdown%60 being called on%0A        the Virtool application object. We check this be seeing if %0A%0A        %22%22%22%0A        await do_get.init_client()%0A%0A        stub = mocker.stub(name=%22shutdown%22)%0A%0A        async def mock_shutdown():%0A            return stub()%0A%0A        monkeypatch.setattr(do_get.server.app, %22shutdown%22, mock_shutdown)%0A%0A        await do_get(%22/api/lifecycle/shutdown%22, authorize=True)%0A%0A        assert stub.called%0A%0A    async def test_job_manager(self, mocker, monkeypatch, do_get):%0A        %22%22%22%0A        Test that a %60%60GET /api/lifecycle/shutdown%60%60 results in :meth:%60virtool.job_manager.Manager.close%60 being called as%0A        part of the shutdown process.%0A%0A        %22%22%22%0A        await do_get.init_client()%0A%0A        stub = mocker.stub(name=%22close%22)%0A%0A        async def mock_close():%0A            return stub()%0A%0A        monkeypatch.setattr(do_get.server.app%5B%22job_manager%22%5D, %22close%22, mock_close)%0A%0A        await do_get(%22/api/lifecycle/shutdown%22, authorize=True)%0A%0A        assert stub.called%0A%0A

Test the lifecycle shutdown API endpoint