diff --git a/src/postorius/tests/test_urls.py b/src/postorius/tests/test_urls.py new file mode 100644 index 0000000..d1c723e --- /dev/null +++ b/src/postorius/tests/test_urls.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2016 by the Free Software Foundation, Inc. +# +# This file is part of Postorius. +# +# Postorius is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# Postorius is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# Postorius. If not, see . + +from django.test import TestCase + +from django.core.urlresolvers import reverse, NoReverseMatch + + +class URLTest(TestCase): + + def test_email_allows_slash(self): + try: + reverse('list_member_options', kwargs={ + 'list_id': 'test.example.com', + 'email': 'slashed/are/allowed@example.com', + }) + reverse('remove_role', kwargs={ + 'list_id': 'test.example.com', + 'role': 'subscriber', + 'address': 'slashed/are/allowed@example.com', + }) + except NoReverseMatch as e: + self.fail(e) diff --git a/src/postorius/urls.py b/src/postorius/urls.py index 4b03305..8568480 100644 --- a/src/postorius/urls.py +++ b/src/postorius/urls.py @@ -27,7 +27,7 @@ list_patterns = [ url(r'^csv_view/$', list_views.csv_view, name='csv_view'), - url(r'^members/options/(?P[^/]+)/$', list_views.list_member_options, + url(r'^members/options/(?P.+)$', list_views.list_member_options, name='list_member_options'), url(r'^members/(?P\w+)/$', list_views.list_members_view, name='list_members'), @@ -63,7 +63,7 @@ url(r'^bans/$', list_views.list_bans, name='list_bans'), url(r'^header-matches/$', list_views.list_header_matches, name='list_header_matches'), - url(r'^remove/(?P[^/]+)/(?P
[^/]+)', list_views.remove_role, + url(r'^remove/(?P[^/]+)/(?P
.+)$', list_views.remove_role, name='remove_role'), url(r'^settings/(?P[^/]+)?$', list_views.list_settings, name='list_settings'),