Exemplo n.º 1
0
    def test_google_analytics(self, mock_settings):
        from fixcity.bmabr.templatetags import google_analytics

        mock_settings.GOOGLE_ANALYTICS_KEY = "xyzpdq"
        html = google_analytics.google_analytics()
        self.failUnless("xyzpdq" in html)
        self.failUnless(html.startswith("<script"))

        # For some reason this doesn't work if I put it in a separate
        # test case... the google_analytics() function keeps a
        # reference to the OLD mock_settings instance with the
        # 'xyzpdq' value!
        mock_settings.GOOGLE_ANALYTICS_KEY = ""
        html = google_analytics.google_analytics()
        self.assertEqual(html, "")
Exemplo n.º 2
0
 def test_google_analytics__no_key(self, mock_settings):
     from fixcity.bmabr.templatetags import google_analytics
     mock_settings.GOOGLE_ANALYTICS_KEY = ''
     html = google_analytics.google_analytics()
     self.assertEqual(html, '')
Exemplo n.º 3
0
 def test_google_analytics(self, mock_settings):
     from fixcity.bmabr.templatetags import google_analytics
     mock_settings.GOOGLE_ANALYTICS_KEY = 'xyzpdq'
     html = google_analytics.google_analytics()
     self.failUnless('xyzpdq' in html)
     self.failUnless(html.startswith('<script'))