Refs #27804 -- Used subTest() in a syndication test.
This commit is contained in:
parent
68f0e8d8b1
commit
feb1a0a692
|
@ -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])
|
||||
|
|
Loading…
Reference in New Issue