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, "")
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, '')
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'))