def test_page_placeholder_metadata(self):
        """
        The ``page_placeholder`` tag should expose metadata, which ``fluent_contents.analyzer`` can read.
        """
        template = Template(
            """{% load fluent_contents_tags %}{% page_placeholder page "slot1" title="SlotTest1" role="s" %}"""
        )

        # Test raw Placeholder extraction
        raw_placeholders = get_node_instances(template, PagePlaceholderNode)
        self.assertEqual(len(raw_placeholders), 1)
        self.assertEqual(raw_placeholders[0].get_slot(), "slot1")
        self.assertEqual(raw_placeholders[0].get_title(), "SlotTest1")
        self.assertEqual(raw_placeholders[0].get_role(), "s")

        # Now test the public API, that returns PlaceholderData objects.
        data = get_template_placeholder_data(template)
        self.assertEqual(len(data), 1)
        self.assertEqual(data[0].slot, "slot1")
        self.assertEqual(data[0].title, "SlotTest1")
        self.assertEqual(data[0].role, "s")

        # Test2: fallback code
        template = Template(
            """{% load fluent_contents_tags %}{% page_placeholder page "slot_test2" %}"""
        )

        # Test raw Placeholder extraction
        raw_placeholders = get_node_instances(template, PagePlaceholderNode)
        self.assertEqual(len(raw_placeholders), 1)
        self.assertEqual(raw_placeholders[0].get_slot(), "slot_test2")
        self.assertEqual(raw_placeholders[0].get_title(), "Slot Test2")
        self.assertEqual(raw_placeholders[0].get_role(), None)

        # Test the public API
        data = get_template_placeholder_data(template)
        self.assertEqual(len(data), 1)
        self.assertEqual(data[0].slot, "slot_test2")
        self.assertEqual(data[0].title, "Slot Test2")
        self.assertEqual(data[0].role, "m")  # Defaults to "main"
    def test_page_placeholder_metadata(self):
        """
        The ``page_placeholder`` tag should expose metadata, which ``fluent_contents.analyzer`` can read.
        """
        template = Template("""{% load placeholder_tags %}{% page_placeholder page "slot1" title="SlotTest1" role="s" %}""")

        # Test raw Placeholder extraction
        raw_placeholders = get_node_instances(template, PagePlaceholderNode)
        self.assertEqual(len(raw_placeholders), 1)
        self.assertEqual(raw_placeholders[0].get_slot(), 'slot1')
        self.assertEqual(raw_placeholders[0].get_title(), 'SlotTest1')
        self.assertEqual(raw_placeholders[0].get_role(), 's')

        # Now test the public API, that returns PlaceholderData objects.
        data = get_template_placeholder_data(template)
        self.assertEqual(len(data), 1)
        self.assertEqual(data[0].slot, 'slot1')
        self.assertEqual(data[0].title, 'SlotTest1')
        self.assertEqual(data[0].role, 's')


        # Test2: fallback code
        template = Template("""{% load placeholder_tags %}{% page_placeholder page "slot_test2" %}""")

        # Test raw Placeholder extraction
        raw_placeholders = get_node_instances(template, PagePlaceholderNode)
        self.assertEqual(len(raw_placeholders), 1)
        self.assertEqual(raw_placeholders[0].get_slot(), 'slot_test2')
        self.assertEqual(raw_placeholders[0].get_title(), 'Slot Test2')
        self.assertEqual(raw_placeholders[0].get_role(), None)

        # Test the public API
        data = get_template_placeholder_data(template)
        self.assertEqual(len(data), 1)
        self.assertEqual(data[0].slot, 'slot_test2')
        self.assertEqual(data[0].title, 'Slot Test2')
        self.assertEqual(data[0].role, 'm')  # Defaults to "main"