Commit 23c1ee32 by Ned Batchelder Committed by GitHub

Merge pull request #14679 from edx/nedbat/flexible-help-link-tests

HelpContextProcessorTest improvements from the Ficus branch.
parents 40621b6c 5e5f0c17
......@@ -21,9 +21,6 @@ class HelpContextProcessorTest(TestCase):
Tests for help_context_processor.py
"""
def setUp(self):
super(HelpContextProcessorTest, self).setUp()
@staticmethod
def _get_doc_url(page_token=None):
""" Helper method for getting the doc url. """
......@@ -36,34 +33,34 @@ class HelpContextProcessorTest(TestCase):
def test_get_doc_url(self):
# Test default values.
self.assertEqual(
"http://edx.readthedocs.io/projects/open-edx-learner-guide/en/latest/index.html",
HelpContextProcessorTest._get_doc_url()
self.assertRegexpMatches(
self._get_doc_url(),
"http://edx.readthedocs.io/projects/open-edx-learner-guide/en/.*/index.html"
)
# Provide a known page_token.
self.assertEqual(
"http://edx.readthedocs.io/projects/open-edx-learner-guide/en/latest/sfd_dashboard_profile/index.html",
HelpContextProcessorTest._get_doc_url('profile')
self.assertRegexpMatches(
self._get_doc_url('profile'),
"http://edx.readthedocs.io/projects/open-edx-learner-guide/en/.*/sfd_dashboard_profile/index.html"
)
# Use settings.DOC_LINK_BASE_URL to override default base_url.
with patch('django.conf.settings.DOC_LINK_BASE_URL', 'settings_base_url'):
self.assertEqual(
"settings_base_url/en/latest/SFD_instructor_dash_help.html",
HelpContextProcessorTest._get_doc_url('instructor')
self.assertRegexpMatches(
self._get_doc_url('instructor'),
"settings_base_url/en/.*/SFD_instructor_dash_help.html"
)
def test_get_pdf_url(self):
# Test default values.
self.assertEqual(
"https://media.readthedocs.org/pdf/open-edx-learner-guide/latest/open-edx-learner-guide.pdf",
HelpContextProcessorTest._get_pdf_url()
self.assertRegexpMatches(
self._get_pdf_url(),
"https://media.readthedocs.org/pdf/open-edx-learner-guide/.*/open-edx-learner-guide.pdf"
)
# Use settings.DOC_LINK_BASE_URL to override default base_url.
with patch('django.conf.settings.DOC_LINK_BASE_URL', 'settings_base_url'):
self.assertEqual(
"settings_base_url/latest/open-edx-learner-guide.pdf",
HelpContextProcessorTest._get_pdf_url()
self.assertRegexpMatches(
self._get_pdf_url(),
"settings_base_url/.*/open-edx-learner-guide.pdf"
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment