示例#1
0
    def test_live_dos_published_service_is_not_indexed(self, index_object, live_dos_framework):
        dos = Framework.query.filter(Framework.slug == 'digital-outcomes-and-specialists').first()

        with mock.patch.object(Service, "serialize"):
            service = Service(status='published', framework=dos)
            index_service(service)

        assert not index_object.called
示例#2
0
    def test_expired_g_cloud_6_published_service_is_not_indexed(self, index_object, expired_g6_framework):
        g6 = Framework.query.filter(Framework.slug == 'g-cloud-6').first()

        with mock.patch.object(Service, "serialize"):
            service = Service(status='published', framework=g6)
            index_service(service)

        assert not index_object.called
    def test_expired_g_cloud_6_published_service_is_not_indexed(self, index_object, expired_g6_framework):
        g6 = Framework.query.filter(Framework.slug == 'g-cloud-6').first()

        with mock.patch.object(Service, "serialize"):
            service = Service(status='published', framework=g6)
            index_service(service)

        assert not index_object.called
    def test_live_dos_published_service_is_not_indexed(self, index_object, live_dos_framework):
        dos = Framework.query.filter(Framework.slug == 'digital-outcomes-and-specialists').first()

        with mock.patch.object(Service, "serialize"):
            service = Service(status='published', framework=dos)
            index_service(service)

        assert not index_object.called
    def test_live_g_cloud_8_enabled_service_is_not_indexed(
            self, index_object, live_g8_framework):
        g8 = Framework.query.filter(Framework.slug == 'g-cloud-8').first()

        with mock.patch.object(Service, "serialize"):
            service = Service(status='enabled', framework=g8)
            index_service(service)

        assert not index_object.called
    def test_expired_g_cloud_6_published_service_is_not_indexed(
            self, search_api_client, expired_g6_framework):
        with self.app.app_context():
            g6 = Framework.query.filter(Framework.slug == 'g-cloud-6').first()

            with mock.patch.object(Service, "serialize") as serialize_mock:
                service = Service(status='published', framework=g6)
                index_service(service)

            assert not search_api_client.index.called
    def test_live_g_cloud_8_enabled_service_is_not_indexed(
            self, search_api_client, live_g8_framework):
        with self.app.app_context():
            g8 = Framework.query.filter(Framework.slug == 'g-cloud-8').first()

            with mock.patch.object(Service, "serialize") as serialize_mock:
                service = Service(status='enabled', framework=g8)
                index_service(service)

            assert not search_api_client.index.called
    def test_live_g_cloud_8_enabled_service_is_not_indexed(
            self, index_object, live_g8_framework
    ):
        g8 = Framework.query.filter(Framework.slug == 'g-cloud-8').first()

        with mock.patch.object(Service, "serialize"):
            service = Service(status='enabled', framework=g8)
            index_service(service)

        assert not index_object.called
    def test_live_dos_published_service_is_not_indexed(self, search_api_client,
                                                       live_dos_framework):
        with self.app.app_context():
            dos = Framework.query.filter(
                Framework.slug == 'digital-outcomes-and-specialists').first()

            with mock.patch.object(Service, "serialize") as serialize_mock:
                service = Service(status='published', framework=dos)
                index_service(service)

            assert not search_api_client.index.called
示例#10
0
    def test_live_g_cloud_8_published_service_is_indexed(
            self, index_object, live_g8_framework
    ):
        g8 = Framework.query.filter(Framework.slug == 'g-cloud-8').first()

        with mock.patch.object(Service, "serialize", return_value={'serialized': 'object'}):
            service = Service(status='published', framework=g8)
            index_service(service)

        index_object.assert_called_once_with(
            framework='g-cloud-8',
            doc_type='services',
            object_id=None,
            serialized_object={'serialized': 'object'},
        )
示例#11
0
    def test_live_g_cloud_8_published_service_is_indexed(
            self, index_object, live_g8_framework, wait_for_response,
    ):
        g8 = Framework.query.filter(Framework.slug == 'g-cloud-8').first()

        with mock.patch.object(Service, "serialize", return_value={'serialized': 'object'}):
            service = Service(status='published', framework=g8)
            index_service(service, wait_for_response=wait_for_response)

        assert index_object.mock_calls == [
            mock.call(
                framework='g-cloud-8',
                doc_type='services',
                object_id=None,
                serialized_object={'serialized': 'object'},
                wait_for_response=wait_for_response,
            ),
        ]