Skip to content

Commit d69f5bb

Browse files
committed
test: add test cases for raw-file hg.python.org URL remapping
1 parent 3f0c60f commit d69f5bb

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

apps/downloads/tests/test_models.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,3 +361,29 @@ def test_empty_url_returns_empty(self):
361361
release_notes_url="",
362362
)
363363
self.assertEqual(release.corrected_release_notes_url, "")
364+
365+
def test_raw_file_hg_url_converted_to_github_raw(self):
366+
"""A raw-file hg.python.org URL is remapped to raw.githubusercontent.com."""
367+
release = Release.objects.create(
368+
version=Release.PYTHON2,
369+
name="Python 2.7.3",
370+
is_published=True,
371+
release_notes_url="http://hg.python.org/cpython/raw-file/v2.7.3/Misc/NEWS",
372+
)
373+
self.assertEqual(
374+
release.corrected_release_notes_url,
375+
"https://raw.githubusercontent.com/python/cpython/v2.7.3/Misc/NEWS",
376+
)
377+
378+
def test_https_raw_file_hg_url_also_converted(self):
379+
"""An https raw-file hg.python.org URL is also remapped to raw.githubusercontent.com."""
380+
release = Release.objects.create(
381+
version=Release.PYTHON2,
382+
name="Python 2.6.9",
383+
is_published=True,
384+
release_notes_url="https://hg.python.org/cpython/raw-file/v2.6.9/Misc/NEWS",
385+
)
386+
self.assertEqual(
387+
release.corrected_release_notes_url,
388+
"https://raw.githubusercontent.com/python/cpython/v2.6.9/Misc/NEWS",
389+
)

0 commit comments

Comments
 (0)