diff --git a/tests/syndication_tests/tests.py b/tests/syndication_tests/tests.py index e98ac354b0..043533d943 100644 --- a/tests/syndication_tests/tests.py +++ b/tests/syndication_tests/tests.py @@ -495,27 +495,14 @@ class SyndicationFeedTest(FeedTestCase): """ add_domain() prefixes domains onto the correct URLs. """ - self.assertEqual( - views.add_domain('example.com', '/foo/?arg=value'), - 'http://example.com/foo/?arg=value' - ) - self.assertEqual( - views.add_domain('example.com', '/foo/?arg=value', True), - 'https://example.com/foo/?arg=value' - ) - self.assertEqual( - views.add_domain('example.com', 'http://djangoproject.com/doc/'), - 'http://djangoproject.com/doc/' - ) - self.assertEqual( - views.add_domain('example.com', 'https://djangoproject.com/doc/'), - 'https://djangoproject.com/doc/' - ) - self.assertEqual( - views.add_domain('example.com', 'mailto:uhoh@djangoproject.com'), - 'mailto:uhoh@djangoproject.com' - ) - self.assertEqual( - views.add_domain('example.com', '//example.com/foo/?arg=value'), - 'http://example.com/foo/?arg=value' + prefix_domain_mapping = ( + (('example.com', '/foo/?arg=value'), 'http://example.com/foo/?arg=value'), + (('example.com', '/foo/?arg=value', True), 'https://example.com/foo/?arg=value'), + (('example.com', 'http://djangoproject.com/doc/'), 'http://djangoproject.com/doc/'), + (('example.com', 'https://djangoproject.com/doc/'), 'https://djangoproject.com/doc/'), + (('example.com', 'mailto:uhoh@djangoproject.com'), 'mailto:uhoh@djangoproject.com'), + (('example.com', '//example.com/foo/?arg=value'), 'http://example.com/foo/?arg=value'), ) + for prefix in prefix_domain_mapping: + with self.subTest(prefix=prefix): + self.assertEqual(views.add_domain(*prefix[0]), prefix[1])