X-Git-Url: https://code.kerkeslager.com/?p=bigly;a=blobdiff_plain;f=src%2Fbigly%2Ftest_views.py;fp=src%2Fbigly%2Ftest_views.py;h=8d9df71250cd62fd463437852715a313d07c65b9;hp=0000000000000000000000000000000000000000;hb=9a3403f78fb8021297a0b351d458f9004a9b2b3e;hpb=c2f61845f8372b4796bf4d10da7f57f99ee933c7 diff --git a/src/bigly/test_views.py b/src/bigly/test_views.py new file mode 100644 index 0000000..8d9df71 --- /dev/null +++ b/src/bigly/test_views.py @@ -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)