@@ -0,0 +1,2620 @@
+import pytest%0Aimport mock%0A%0Afrom tests.app.helpers import BaseApplicationTest%0Afrom app.service_utils import index_service%0Afrom app.models import Service, Framework%0A%0A%0A@mock.patch('app.service_utils.search_api_client')%0Aclass TestIndexServices(BaseApplicationTest):%0A%0A    @pytest.mark.parametrize('update_framework_status', %5B('live', 'g-cloud-8')%5D, indirect=True)%0A    def test_live_g_cloud_8_published_service_is_indexed(%0A            self, search_api_client, add_g_cloud_8, update_framework_status%0A    ):%0A        with self.app.app_context():%0A            g8 = Framework.query.filter(Framework.slug == 'g-cloud-8').first()%0A%0A            with mock.patch.object(Service, %22serialize%22) as serialize_mock:%0A                service = Service(status='published', framework=g8)%0A                index_service(service)%0A%0A            assert search_api_client.index.called%0A%0A    @pytest.mark.parametrize('update_framework_status', %5B('live', 'g-cloud-8')%5D, indirect=True)%0A    def test_live_g_cloud_8_enabled_service_is_not_indexed(%0A            self, search_api_client, add_g_cloud_8, update_framework_status%0A    ):%0A        with self.app.app_context():%0A            g8 = Framework.query.filter(Framework.slug == 'g-cloud-8').first()%0A%0A            with mock.patch.object(Service, %22serialize%22) as serialize_mock:%0A                service = Service(status='enabled', framework=g8)%0A                index_service(service)%0A%0A            assert not search_api_client.index.called%0A%0A    @pytest.mark.parametrize('update_framework_status', %5B('live', 'digital-outcomes-and-specialists')%5D, indirect=True)%0A    def test_live_dos_published_service_is_not_indexed(self, search_api_client, update_framework_status):%0A        with self.app.app_context():%0A            dos = Framework.query.filter(Framework.slug == 'digital-outcomes-and-specialists').first()%0A%0A            with mock.patch.object(Service, %22serialize%22) as serialize_mock:%0A                service = Service(status='published', framework=dos)%0A                index_service(service)%0A%0A            assert not search_api_client.index.called%0A%0A    @pytest.mark.parametrize('update_framework_status', %5B('expired', 'g-cloud-6')%5D, indirect=True)%0A    def test_expired_g_cloud_6_published_service_is_not_indexed(self, search_api_client, update_framework_status):%0A        with self.app.app_context():%0A            g6 = Framework.query.filter(Framework.slug == 'g-cloud-6').first()%0A%0A            with mock.patch.object(Service, %22serialize%22) as serialize_mock:%0A                service = Service(status='published', framework=g6)%0A                index_service(service)%0A%0A            assert not search_api_client.index.called%0A

Add index_service tests