import unittest

class TestRecaptchaTags(unittest.TestCase):

    def test_recaptcha_html(self):
        from fixcity.bmabr.templatetags import recaptcha_tags
        from django.conf import settings  
        html = recaptcha_tags.recaptcha_html()
        self.failUnless(settings.RECAPTCHA_PUBLIC_KEY in html)
        self.failUnless(html.startswith('<script'))
        

class TestGoogleTags(unittest.TestCase):

    def test_google_analytics(self):
        from fixcity.bmabr.templatetags import google_analytics
        from django.conf import settings  
        html = google_analytics.google_analytics()
        self.failUnless(settings.GOOGLE_ANALYTICS_KEY in html)
        self.failUnless(html.startswith('<script'))

@@ -9,16 +9,49 @@
 nittest%0A
+import mock%0A%0Aimport django.conf%0A%0A
 %0Aclass T
@@ -434,32 +434,80 @@
 est.TestCase):%0A%0A
+    @mock.patch_object(django.conf, 'settings')%0A
     def test_goo
@@ -520,24 +520,39 @@
 alytics(self
+, mock_settings
 ):%0A        f
@@ -618,42 +618,53 @@
     
-from django.conf import settings  
+mock_settings.GOOGLE_ANALYTICS_KEY = 'xyzpdq'
 %0A   
@@ -739,37 +739,16 @@
 ess(
-settings.GOOGLE_ANALYTICS_KEY
+'xyzpdq'
  in 
@@ -785,28 +785,385 @@
 html.startswith('%3Cscript'))%0A
+%0A        # For some reason this doesn't work if I put it in a separate%0A        # test case... the google_analytics() function keeps a%0A        # reference to the OLD mock_settings instance with the%0A        # 'xyzpdq' value!%0A        mock_settings.GOOGLE_ANALYTICS_KEY = ''%0A        html = google_analytics.google_analytics()%0A        self.assertEqual(html, '')%0A

Fix tests to work when GOOGLE_ANALYTICS_KEY is not set.