def test_get_page_from_id_context_variable(self):
        """Test get_page_from_string_or_id with an id context variable."""
        page = self.new_page({"slug": "test"})
        self.assertEqual(get_page_from_string_or_id(str(page.id)), page)

        content = Content(page=page, language="en-us", type="test_id", body=page.id)
        content.save()
        context = Context({"current_page": page})
        context = RequestContext(MockRequest(), context)
        template = Template(
            "{% load pages_tags %}" "{% placeholder test_id as str %}" "{% get_page str as p %}" "{{ p.slug }}"
        )
        self.assertEqual(template.render(context), "test")
    def test_get_page_from_id_context_variable(self):
        """Test get_page_from_string_or_id with an id context variable."""
        page = self.new_page({'slug': 'test'})
        self.assertEqual(get_page_from_string_or_id(str(page.id)), page)

        content = Content(page=page, language='en-us', type='test_id',
            body=page.id)
        content.save()
        context = {'current_page': page}
        template = Template('{% load pages_tags %}'
                            '{% placeholder test_id as str %}'
                            '{% get_page str as p %}'
                            '{{ p.slug }}')
        self.assertEqual(render(template, context), 'test')
    def test_get_page_from_id_context_variable(self):
        """Test get_page_from_string_or_id with an id context variable."""
        page = self.new_page({'slug': 'test'})
        self.assertEqual(get_page_from_string_or_id(str(page.id)), page)

        content = Content(page=page, language='en-us', type='test_id',
            body=page.id)
        content.save()
        context = {'current_page': page}
        template = Template('{% load pages_tags %}'
                            '{% placeholder test_id as str %}'
                            '{% get_page str as p %}'
                            '{{ p.slug }}')
        self.assertEqual(render(template, context), 'test')