Add a basic link embiggener
[bigly] / src / bigly / test_views.py
diff --git a/src/bigly/test_views.py b/src/bigly/test_views.py
new file mode 100644 (file)
index 0000000..8d9df71
--- /dev/null
@@ -0,0 +1,25 @@
+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)