from plone import api
from ploneintranet.network.testing import IntegrationTestCase


class TestNetworkTool(IntegrationTestCase):
    def setUp(self) -> None:
        self.portal = self.layer["portal"]
        self.request = self.layer["request"]
        return super().setUp()

    def test_event_searchable(self):
        """Test event searchable."""
        event = api.content.create(
            container=self.portal,
            type="Event",
            id="event",
            title="Supercalifragilisticexpialidocious",
            start="2020-01-01",
            end="2021-01-02",
        )

        brains = api.content.find(
            portal_type="Event",
            SearchableText="Super*",
        )
        self.assertListEqual(
            [event.UID()],
            [brain.UID for brain in brains],
        )
