Example #1
0
    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'
        )
Example #2
0
    def test_get_meta_url(self):
        m = MetadataMixin()
        self.assertEqual(
            m.get_meta_url(),
            None
        )

        m.url = '/foo/bar'
        self.assertEqual(
            m.get_meta_url(),
            '/foo/bar'
        )
Example #3
0
    def test_get_meta_url(self):
        m = MetadataMixin()
        self.assertEqual(
            m.get_meta_url(),
            None
        )

        m.url = '/foo/bar'
        self.assertEqual(
            m.get_meta_url(),
            '/foo/bar'
        )
Example #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'