--- /dev/null
+from django.test import TestCase
+
+from . import views
+
+class RemoveUTMTestCase(TestCase):
+ def test_preserves_basic(self):
+ expected = 'http://www.myhostname.com/my/path?my=param&my=otherparam#myanchor'
+ actual = views._remove_utm(expected)
+ self.assertEqual(expected, actual)
+
+ def test_removes_utm(self):
+ input_url = 'http://www.myhostname.com/my/path?utm_param=param&my=param#myanchor'
+ expected = 'http://www.myhostname.com/my/path?my=param#myanchor'
+ actual = views._remove_utm(input_url)
+ self.assertEqual(expected, actual)
+
+ def test_preserves_empty_parameters(self):
+ expected = 'http://www.myhostname.com/my/path?my_empty_param=&my=param#myanchor'
+ actual = views._remove_utm(expected)
+ self.assertEqual(expected, actual)
+
+ def test_preserves_flags(self):
+ expected = 'http://www.myhostname.com/my/path?my_flag&my=param#myanchor'
+ actual = views._remove_utm(expected)
+ self.assertEqual(expected, actual)