forked from cartwheelweb/packaginator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.py
29 lines (23 loc) · 1.04 KB
/
tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# -*- coding: utf-8 -*-
from core.test_utils.context_managers import SettingsOverride
from django import template
from django.test.testcases import TestCase
class PackaginatorTagsTests(TestCase):
def test_fixed_ga(self):
tpl = template.Template("""
{% load packaginator_tags %}
{% fixed_ga %}
""")
context = template.Context()
with SettingsOverride(URCHIN_ID='testid', DEBUG=False):
output = tpl.render(context)
self.assertTrue('var pageTracker = _gat._getTracker("testid");' in output)
with SettingsOverride(URCHIN_ID='testid', DEBUG=True):
output = tpl.render(context)
self.assertEqual(output.strip(), "")
with SettingsOverride(URCHIN_ID=None, DEBUG=True):
output = tpl.render(context)
self.assertEqual(output.strip(), "")
with SettingsOverride(URCHIN_ID=None, DEBUG=False):
output = tpl.render(context)
self.assertEqual(output.strip(), "")