1 from django.test import TestCase
5 class RemoveUTMTestCase(TestCase):
6 def test_preserves_basic(self):
7 expected = 'http://www.myhostname.com/my/path?my=param&my=otherparam#myanchor'
8 actual = views._remove_utm(expected)
9 self.assertEqual(expected, actual)
11 def test_removes_utm(self):
12 input_url = 'http://www.myhostname.com/my/path?utm_param=param&my=param#myanchor'
13 expected = 'http://www.myhostname.com/my/path?my=param#myanchor'
14 actual = views._remove_utm(input_url)
15 self.assertEqual(expected, actual)
17 def test_preserves_empty_parameters(self):
18 expected = 'http://www.myhostname.com/my/path?my_empty_param=&my=param#myanchor'
19 actual = views._remove_utm(expected)
20 self.assertEqual(expected, actual)
22 def test_preserves_flags(self):
23 expected = 'http://www.myhostname.com/my/path?my_flag&my=param#myanchor'
24 actual = views._remove_utm(expected)
25 self.assertEqual(expected, actual)