def test_get_meta(self):
        m = MetadataMixin()
        m.title = 'title'
        m.description = 'description'
        m.keywords = ['foo', 'bar']
        m.url = 'some/path'
        m.image = 'images/foo.gif'

        meta.settings.SITE_PROTOCOL = 'http'
        meta.settings.SITE_DOMAIN = 'foo.com'

        meta_object = m.get_meta()

        self.assertTrue(type(meta_object), Meta)
        self.assertEqual(
            meta_object.title,
            'title'
        )
        self.assertEqual(
            meta_object.description,
            'description'
        )
        self.assertEqual(
            meta_object.url,
            'http://foo.com/some/path'
        )
        self.assertEqual(
            meta_object.keywords,
            ['foo', 'bar']
        )
        self.assertEqual(
            meta_object.image,
            'http://foo.com/static/images/foo.gif'
        )
    def test_get_meta_image(self):
        m = MetadataMixin()
        self.assertEqual(m.get_meta_image(), None)

        m.image = 'img/foo.gif'

        self.assertEqual(m.get_meta_image(), 'img/foo.gif')
    def test_get_meta_image(self):
        m = MetadataMixin()
        self.assertEqual(
            m.get_meta_image(),
            None
        )

        m.image = 'img/foo.gif'

        self.assertEqual(
            m.get_meta_image(),
            'img/foo.gif'
        )
Beispiel #4
0
    def test_get_meta(self):
        settings.SITE_PROTOCOL = 'http'
        settings.SITE_DOMAIN = 'foo.com'
        settings.USE_SITES = False
        settings.FB_PAGES = 'fbpages'
        settings.FB_APPID = 'appid'

        m = MetadataMixin()
        m.title = 'title'
        m.description = 'description'
        m.keywords = ['foo', 'bar']
        m.url = 'some/path'
        m.image = 'images/foo.gif'

        meta_object = m.get_meta()

        self.assertTrue(type(meta_object), Meta)
        self.assertEqual(
            meta_object.title,
            'title'
        )
        self.assertEqual(
            meta_object.description,
            'description'
        )
        self.assertEqual(
            meta_object.url,
            'http://foo.com/some/path'
        )
        self.assertEqual(
            meta_object.keywords,
            ['foo', 'bar']
        )
        self.assertEqual(
            meta_object.image,
            'http://foo.com/static/images/foo.gif'
        )
        settings.SITE_DOMAIN = 'example.com'