|
1 | | -from collections import OrderedDict |
| 1 | +import re |
2 | 2 | from django.conf import settings |
3 | 3 | from django.test import TestCase |
4 | 4 | from common.helpers.caching import is_sitemap_url |
@@ -28,12 +28,16 @@ def test_section_path(self): |
28 | 28 | expected = '/events/test-slug' |
29 | 29 | self.assertEqual(expected, section_path(FrontEndSection.AboutEvent, {'id': 'test-slug'})) |
30 | 30 |
|
31 | | - # TODO: Add test for multiple args |
32 | 31 | def test_section_path_with_single_arg(self): |
33 | 32 | expected = '/events/test-slug?a=1' |
34 | | - arg_dict = OrderedDict([('id', 'test-slug'), ('a', '1')]) |
| 33 | + arg_dict = {'id': 'test-slug', 'a': '1'} |
35 | 34 | self.assertEqual(expected, section_path(FrontEndSection.AboutEvent, arg_dict)) |
36 | 35 |
|
| 36 | + def test_section_path_with_single_arg(self): |
| 37 | + expected_pattern = re.compile(r'/events/test-slug(\?a=1&b=2|\?b=2&a=1)') |
| 38 | + arg_dict = {'id': 'test-slug', 'a': '1', 'b': '2'} |
| 39 | + self.assertRegexpMatches(section_path(FrontEndSection.AboutEvent, arg_dict), expected_pattern) |
| 40 | + |
37 | 41 | def test_section_url(self): |
38 | 42 | expected = settings.PROTOCOL_DOMAIN + '/events/test-slug' |
39 | 43 | self.assertEqual(expected, section_url(FrontEndSection.AboutEvent, {'id': 'test-slug'})) |
|
0 commit comments