Source code for oioioi.analytics.tests
from django.test.utils import override_settings
from oioioi.base.tests import TestCase
[docs]class TestAnalytics(TestCase):
[docs] def test_without_analytics(self):
response = self.client.get('/', follow=True)
self.assertNotContains(response, 'google-analytics.com')
@override_settings(GOOGLE_ANALYTICS_TRACKING_ID='ga-tracking-id')
[docs] def test_with_analytics(self):
response = self.client.get('/', follow=True)
self.assertContains(response, 'google-analytics.com')
self.assertContains(response, 'ga-tracking-id')