From 3bb8061f802be846016207fa862996e201066279 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Fri, 17 Mar 2017 15:52:28 -0400 Subject: [PATCH 1/4] An indicator of the Open edX release line --- openedx/core/release.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 openedx/core/release.py diff --git a/openedx/core/release.py b/openedx/core/release.py new file mode 100644 index 0000000000..409f8aa6d9 --- /dev/null +++ b/openedx/core/release.py @@ -0,0 +1,19 @@ +""" +Information about the release line of this Open edX code. +""" + +# The release line: an Open edX release name ("ficus"), or "master". +# This should always be "master" on the master branch, and will be changed +# manually when we start release-line branches, like open-release/ficus.master. +RELEASE_LINE = "master" + + +def doc_version(): + """The readthedocs.org version name used in documentation references. + + Returns a short string like "latest" or "open-release-ficus.master". + """ + if RELEASE_LINE == "master": + return "latest" + else: + return "open-release-{}.master".format(RELEASE_LINE) From 60221dcc131e7b2aa891d4fb9f0580e15f82f6a4 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Fri, 17 Mar 2017 15:52:49 -0400 Subject: [PATCH 2/4] Get the doc version from openedx.core.release, instead of an ini file --- common/djangoapps/util/help_context_processor.py | 8 +++++--- docs/cms_config.ini | 1 - docs/lms_config.ini | 1 - 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/common/djangoapps/util/help_context_processor.py b/common/djangoapps/util/help_context_processor.py index 5aa56e7bae..2f6fd134b3 100644 --- a/common/djangoapps/util/help_context_processor.py +++ b/common/djangoapps/util/help_context_processor.py @@ -4,9 +4,11 @@ Online Contextual Help. """ import ConfigParser -from django.conf import settings import logging +from django.conf import settings + +from openedx.core.release import doc_version log = logging.getLogger(__name__) @@ -76,7 +78,7 @@ def common_doc_url(request, config_file_object): # pylint: disable=unused-argum return "{url_base}/{language}/{version}/{page_path}".format( url_base=doc_base_url, language=get_config_value_with_default("locales", settings.LANGUAGE_CODE), - version=config_file_object.get("help_settings", "version"), + version=doc_version(), page_path=get_config_value_with_default("pages", page_token), ) @@ -102,7 +104,7 @@ def common_doc_url(request, config_file_object): # pylint: disable=unused-argum # Construct and return the URL for the PDF link. return "{pdf_base}/{version}/{pdf_file}".format( pdf_base=pdf_base_url, - version=config_file_object.get("help_settings", "version"), + version=doc_version(), pdf_file=config_file_object.get("pdf_settings", "pdf_file"), ) diff --git a/docs/cms_config.ini b/docs/cms_config.ini index cf7bdec2f0..08b9392400 100644 --- a/docs/cms_config.ini +++ b/docs/cms_config.ini @@ -2,7 +2,6 @@ [help_settings] # The optional DOC_LINK_BASE_URL configuration property will override url_base url_base = http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course -version = latest # below are the pdf settings for the pdf file diff --git a/docs/lms_config.ini b/docs/lms_config.ini index 40a53512dc..207fd46f3d 100644 --- a/docs/lms_config.ini +++ b/docs/lms_config.ini @@ -2,7 +2,6 @@ [help_settings] # The optional DOC_LINK_BASE_URL configuration property will override url_base url_base = http://edx.readthedocs.io/projects/open-edx-learner-guide -version = latest # below are the pdf settings for the pdf file From f7b08b16fc0ecd7dd0724c0a19aeadc2a6d1aca2 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Fri, 17 Mar 2017 16:06:46 -0400 Subject: [PATCH 3/4] Adapt the tests to openedx.core.release.doc_version() --- .../util/tests/test_help_context_processor.py | 31 +-- .../acceptance/tests/lms/test_lms_help.py | 19 +- .../tests/studio/test_studio_help.py | 237 ++++++++++++------ 3 files changed, 183 insertions(+), 104 deletions(-) diff --git a/common/djangoapps/util/tests/test_help_context_processor.py b/common/djangoapps/util/tests/test_help_context_processor.py index 3b388f3421..b4c2e26a5a 100644 --- a/common/djangoapps/util/tests/test_help_context_processor.py +++ b/common/djangoapps/util/tests/test_help_context_processor.py @@ -8,6 +8,7 @@ from mock import patch from django.conf import settings from django.test import TestCase +from openedx.core.release import doc_version from util.help_context_processor import common_doc_url @@ -33,34 +34,24 @@ class HelpContextProcessorTest(TestCase): def test_get_doc_url(self): # Test default values. - self.assertRegexpMatches( - self._get_doc_url(), - "http://edx.readthedocs.io/projects/open-edx-learner-guide/en/.*/index.html" - ) + doc = "http://edx.readthedocs.io/projects/open-edx-learner-guide/en/{}/index.html" + self.assertEqual(self._get_doc_url(), doc.format(doc_version())) # Provide a known page_token. - self.assertRegexpMatches( - self._get_doc_url('profile'), - "http://edx.readthedocs.io/projects/open-edx-learner-guide/en/.*/sfd_dashboard_profile/index.html" - ) + doc = "http://edx.readthedocs.io/projects/open-edx-learner-guide/en/{}/sfd_dashboard_profile/index.html" + self.assertEqual(self._get_doc_url('profile'), doc.format(doc_version())) # Use settings.DOC_LINK_BASE_URL to override default base_url. + doc = "settings_base_url/en/{}/SFD_instructor_dash_help.html" with patch('django.conf.settings.DOC_LINK_BASE_URL', 'settings_base_url'): - self.assertRegexpMatches( - self._get_doc_url('instructor'), - "settings_base_url/en/.*/SFD_instructor_dash_help.html" - ) + self.assertEqual(self._get_doc_url('instructor'), doc.format(doc_version())) def test_get_pdf_url(self): # Test default values. - self.assertRegexpMatches( - self._get_pdf_url(), - "https://media.readthedocs.org/pdf/open-edx-learner-guide/.*/open-edx-learner-guide.pdf" - ) + doc = "https://media.readthedocs.org/pdf/open-edx-learner-guide/{}/open-edx-learner-guide.pdf" + self.assertEqual(self._get_pdf_url(), doc.format(doc_version())) # Use settings.DOC_LINK_BASE_URL to override default base_url. + doc = "settings_base_url/{}/open-edx-learner-guide.pdf" with patch('django.conf.settings.DOC_LINK_BASE_URL', 'settings_base_url'): - self.assertRegexpMatches( - self._get_pdf_url(), - "settings_base_url/.*/open-edx-learner-guide.pdf" - ) + self.assertEqual(self._get_pdf_url(), doc.format(doc_version())) diff --git a/common/test/acceptance/tests/lms/test_lms_help.py b/common/test/acceptance/tests/lms/test_lms_help.py index d8d442055b..13b84a12aa 100644 --- a/common/test/acceptance/tests/lms/test_lms_help.py +++ b/common/test/acceptance/tests/lms/test_lms_help.py @@ -3,7 +3,6 @@ Test Help links in LMS """ import json - from common.test.acceptance.tests.lms.test_lms_instructor_dashboard import BaseInstructorDashboardTest from common.test.acceptance.pages.lms.instructor_dashboard import InstructorDashboardPage from common.test.acceptance.tests.studio.base_studio_test import ContainerBase @@ -15,6 +14,8 @@ from common.test.acceptance.tests.helpers import ( assert_opened_help_link_is_correct ) +from openedx.core.release import doc_version + class TestCohortHelp(ContainerBase): """ @@ -66,8 +67,10 @@ class TestCohortHelp(ContainerBase): """ self.cohort_management.add_cohort('cohort_name') - href = 'http://edx.readthedocs.org/projects/edx-partner-course-staff/en/latest/' \ - 'course_features/cohorts/cohort_config.html#assign-learners-to-cohorts-manually' + href = ( + 'http://edx.readthedocs.org/projects/edx-partner-course-staff/en/{}/' + 'course_features/cohorts/cohort_config.html#assign-learners-to-cohorts-manually' + ).format(doc_version()) self.verify_help_link(href) @@ -86,8 +89,10 @@ class TestCohortHelp(ContainerBase): self.cohort_management.add_cohort('cohort_name', assignment_type='random') - href = 'http://edx.readthedocs.org/projects/edx-partner-course-staff/en/latest/' \ - 'course_features/cohorts/cohorts_overview.html#all-automated-assignment' + href = ( + 'http://edx.readthedocs.org/projects/edx-partner-course-staff/en/{}/' + 'course_features/cohorts/cohorts_overview.html#all-automated-assignment' + ).format(doc_version()) self.verify_help_link(href) @@ -119,6 +124,8 @@ class InstructorDashboardHelp(BaseInstructorDashboardTest): When I click "Help" Then I see help about the instructor dashboard in a new tab """ - href = 'http://edx.readthedocs.io/projects/edx-guide-for-students/en/latest/SFD_instructor_dash_help.html' + href = ( + 'http://edx.readthedocs.io/projects/edx-guide-for-students/en/{}/SFD_instructor_dash_help.html' + ).format(doc_version()) self.instructor_dashboard_page.click_help() assert_opened_help_link_is_correct(self, href) diff --git a/common/test/acceptance/tests/studio/test_studio_help.py b/common/test/acceptance/tests/studio/test_studio_help.py index de5bd60583..1e7055480c 100644 --- a/common/test/acceptance/tests/studio/test_studio_help.py +++ b/common/test/acceptance/tests/studio/test_studio_help.py @@ -34,6 +34,8 @@ from common.test.acceptance.tests.helpers import ( from common.test.acceptance.pages.studio.import_export import ExportLibraryPage, ImportLibraryPage from common.test.acceptance.pages.studio.auto_auth import AutoAuthPage +from openedx.core.release import doc_version + @attr(shard=10) class StudioHelpTest(StudioCourseTest): @@ -96,8 +98,10 @@ class SignInHelpTest(AcceptanceTest): """ sign_in_page = self.index_page.click_sign_in() # The href we want to see in anchor help element. - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' \ - 'en/latest/getting_started/get_started.html' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' + 'en/{}/getting_started/get_started.html' + ).format(doc_version()) # Assert that help link is correct. assert_nav_help_link( @@ -129,8 +133,10 @@ class SignUpHelpTest(AcceptanceTest): """ sign_up_page = self.index_page.click_sign_up() # The href we want to see in anchor help element. - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' \ - 'en/latest/getting_started/get_started.html' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' + 'en/{}/getting_started/get_started.html' + ).format(doc_version()) # Assert that help link is correct. assert_nav_help_link( @@ -161,8 +167,10 @@ class HomeHelpTest(StudioCourseTest): And help url should end with 'getting_started/get_started.html' """ # The href we want to see in anchor help element. - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' \ - 'en/latest/getting_started/get_started.html' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' + 'en/{}/getting_started/get_started.html' + ).format(doc_version()) # Assert that help link is correct. assert_nav_help_link( @@ -181,8 +189,10 @@ class HomeHelpTest(StudioCourseTest): And help url should end with 'getting_started/get_started.html' """ # The href we want to see in anchor help element. - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' \ - 'en/latest/getting_started/get_started.html' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' + 'en/{}/getting_started/get_started.html' + ).format(doc_version()) # Assert that help link is correct. assert_side_bar_help_link( @@ -218,8 +228,10 @@ class NewCourseHelpTest(AcceptanceTest): And help url should end with 'getting_started/get_started.html' """ # The href we want to see in anchor help element. - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course' \ - '/en/latest/getting_started/get_started.html' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course' + '/en/{}/getting_started/get_started.html' + ).format(doc_version()) # Assert that help link is correct. assert_nav_help_link( @@ -238,8 +250,10 @@ class NewCourseHelpTest(AcceptanceTest): And help url should end with 'getting_started/get_started.html' """ # The href we want to see in anchor help element. - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' \ - 'en/latest/getting_started/get_started.html' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' + 'en/{}/getting_started/get_started.html' + ).format(doc_version()) # Assert that help link is correct. assert_side_bar_help_link( @@ -275,8 +289,10 @@ class NewLibraryHelpTest(AcceptanceTest): And help url should end with 'getting_started/get_started.html' """ # The href we want to see in anchor help element. - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' \ - 'en/latest/getting_started/get_started.html' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' + 'en/{}/getting_started/get_started.html' + ).format(doc_version()) # Assert that help link is correct. assert_nav_help_link( @@ -295,8 +311,10 @@ class NewLibraryHelpTest(AcceptanceTest): And help url should end with 'getting_started/get_started.html' """ # The href we want to see in anchor help element. - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' \ - 'en/latest/getting_started/get_started.html' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' + 'en/{}/getting_started/get_started.html' + ).format(doc_version()) # Assert that help link is correct. assert_side_bar_help_link( @@ -332,8 +350,10 @@ class LibraryTabHelpTest(AcceptanceTest): self.assertTrue(self.dashboard_page.has_new_library_button) click_css(self.dashboard_page, '#course-index-tabs .libraries-tab', 0, False) # The href we want to see in anchor help element. - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' \ - 'en/latest/getting_started/get_started.html' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' + 'en/{}/getting_started/get_started.html' + ).format(doc_version()) # Assert that help link is correct. assert_nav_help_link( @@ -365,8 +385,10 @@ class LibraryHelpTest(StudioLibraryTest): """ self.library_page.visit() # The href we want to see in anchor help element. - href = "http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/" \ - "en/latest/course_components/libraries.html" + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' + 'en/{}/course_components/libraries.html' + ).format(doc_version()) # Assert that help link is correct. assert_nav_help_link( @@ -387,8 +409,10 @@ class LibraryHelpTest(StudioLibraryTest): """ self.library_page.visit() # The href we want to see in anchor help element. - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' \ - 'en/latest/course_components/libraries.html' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' + 'en/{}/course_components/libraries.html' + ).format(doc_version()) # Assert that help link is correct. assert_side_bar_help_link( @@ -411,8 +435,10 @@ class LibraryHelpTest(StudioLibraryTest): """ self.library_user_page.visit() # The href we want to see in anchor help element. - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/' \ - 'latest/course_components/libraries.html#give-other-users-access-to-your-library' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' + 'en/{}/course_components/libraries.html#give-other-users-access-to-your-library' + ).format(doc_version()) # Assert that help link is correct. assert_nav_help_link( @@ -442,8 +468,10 @@ class LibraryImportHelpTest(StudioLibraryTest): And help url should end with 'creating_content/libraries.html#import-a-library' """ # The href we want to see in anchor help element. - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/' \ - 'latest/course_components/libraries.html#import-a-library' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/' + '{}/course_components/libraries.html#import-a-library' + ).format(doc_version()) # Assert that help link is correct. assert_nav_help_link( @@ -462,8 +490,10 @@ class LibraryImportHelpTest(StudioLibraryTest): And help url should end with 'creating_content/libraries.html#import-a-library' """ # The href we want to see in anchor help element. - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/' \ - 'latest/course_components/libraries.html#import-a-library' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/' + '{}/course_components/libraries.html#import-a-library' + ).format(doc_version()) # Assert that help link is correct. assert_side_bar_help_link( @@ -494,8 +524,10 @@ class LibraryExportHelpTest(StudioLibraryTest): And help url should end with 'creating_content/libraries.html#export-a-library' """ # The href we want to see in anchor help element. - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/' \ - 'latest/course_components/libraries.html#export-a-library' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/' + '{}/course_components/libraries.html#export-a-library' + ).format(doc_version()) # Assert that help link is correct. assert_nav_help_link( @@ -514,8 +546,10 @@ class LibraryExportHelpTest(StudioLibraryTest): And help url should end with 'creating_content/libraries.html#export-a-library' """ # The href we want to see in anchor help element. - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/' \ - 'latest/course_components/libraries.html#export-a-library' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/' + '{}/course_components/libraries.html#export-a-library' + ).format(doc_version()) # Assert that help link is correct. assert_side_bar_help_link( @@ -551,8 +585,10 @@ class CourseOutlineHelpTest(StudioCourseTest): Then Help link should open. And help url should end with 'developing_course/course_outline.html' """ - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course' \ - '/en/latest/developing_course/course_outline.html' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course' + '/en/{}/developing_course/course_outline.html' + ).format(doc_version()) # Assert that help link is correct. assert_nav_help_link( @@ -570,8 +606,10 @@ class CourseOutlineHelpTest(StudioCourseTest): Then Help link should open. And help url should end with 'developing_course/course_outline.html' """ - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course' \ - '/en/latest/developing_course/course_outline.html' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course' + '/en/{}/developing_course/course_outline.html' + ).format(doc_version()) # Assert that help link is correct. assert_side_bar_help_link( @@ -607,8 +645,10 @@ class CourseUpdateHelpTest(StudioCourseTest): Then Help link should open. And help url should end with 'course_assets/handouts_updates.html' """ - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' \ - 'en/latest/course_assets/handouts_updates.html' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' + 'en/{}/course_assets/handouts_updates.html' + ).format(doc_version()) # Assert that help link is correct. assert_nav_help_link( @@ -642,8 +682,10 @@ class AssetIndexHelpTest(StudioCourseTest): Then Help link should open. And help url should end with 'course_assets/course_files.html' """ - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' \ - 'en/latest/course_assets/course_files.html' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' + 'en/{}/course_assets/course_files.html' + ).format(doc_version()) # Assert that help link is correct. assert_nav_help_link( @@ -661,8 +703,10 @@ class AssetIndexHelpTest(StudioCourseTest): Then Help link should open. And help url should end with 'course_assets/course_files.html' """ - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' \ - 'en/latest/course_assets/course_files.html' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' + 'en/{}/course_assets/course_files.html' + ).format(doc_version()) # Assert that help link is correct. assert_side_bar_help_link( @@ -697,8 +741,10 @@ class CoursePagesHelpTest(StudioCourseTest): Then Help link should open. And help url should end with 'course_assets/pages.html' """ - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' \ - 'en/latest/course_assets/pages.html' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' + 'en/{}/course_assets/pages.html' + ).format(doc_version()) # Assert that help link is correct. assert_nav_help_link( @@ -732,8 +778,10 @@ class UploadTextbookHelpTest(StudioCourseTest): Then Help link should open. And help url should end with 'course_assets/textbooks.html' """ - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course' \ - '/en/latest/course_assets/textbooks.html' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course' + '/en/{}/course_assets/textbooks.html' + ).format(doc_version()) # Assert that help link is correct. assert_nav_help_link( @@ -751,8 +799,10 @@ class UploadTextbookHelpTest(StudioCourseTest): Then Help link should open. And help url should end with 'course_assets/textbooks.html' """ - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course' \ - '/en/latest/course_assets/textbooks.html' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course' + '/en/{}/course_assets/textbooks.html' + ).format(doc_version()) # Assert that help link is correct. assert_side_bar_help_link( @@ -802,8 +852,10 @@ class StudioUnitHelpTest(ContainerBase): And help url should end with 'developing_course/course_units.html' """ unit_page = self.go_to_unit_page() - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course' \ - '/en/latest/developing_course/course_units.html' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course' + '/en/{}/developing_course/course_units.html' + ).format(doc_version()) # Assert that help link is correct. assert_nav_help_link( @@ -839,8 +891,10 @@ class SettingsHelpTest(StudioCourseTest): Then Help link should open. And help url should end with 'set_up_course/setting_up_student_view.html' """ - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course' \ - '/en/latest/set_up_course/setting_up_student_view.html' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course' + '/en/{}/set_up_course/setting_up_student_view.html' + ).format(doc_version()) # Assert that help link is correct. assert_nav_help_link( @@ -876,8 +930,10 @@ class GradingPageHelpTest(StudioCourseTest): Then Help link should open. And help url should end with 'grading/index.html' """ - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' \ - 'en/latest/grading/index.html' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' + 'en/{}/grading/index.html' + ).format(doc_version()) # Assert that help link is correct. assert_nav_help_link( @@ -913,8 +969,10 @@ class CourseTeamSettingsHelpTest(StudioCourseTest): Then Help link should open. And help url should end with 'set_up_course/course_staffing.html#add-course-team-members' """ - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' \ - 'en/latest/set_up_course/course_staffing.html#add-course-team-members' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' + 'en/{}/set_up_course/course_staffing.html#add-course-team-members' + ).format(doc_version()) # Assert that help link is correct. assert_nav_help_link( @@ -951,8 +1009,10 @@ class CourseGroupConfigurationHelpTest(StudioCourseTest): Then Help link should open. And help url should end with 'index.html' """ - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' \ - 'en/latest/index.html' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' + 'en/{}/index.html' + ).format(doc_version()) # Assert that help link is correct. assert_nav_help_link( @@ -971,8 +1031,10 @@ class CourseGroupConfigurationHelpTest(StudioCourseTest): Then Help link should open. And help url should end with 'course_features/cohorts/cohorted_courseware.html' """ - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' \ - 'en/latest/course_features/cohorts/cohorted_courseware.html' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' + 'en/{}/course_features/cohorts/cohorted_courseware.html' + ).format(doc_version()) # Assert that help link is correct. assert_side_bar_help_link( @@ -1009,8 +1071,10 @@ class AdvancedSettingHelpTest(StudioCourseTest): Then Help link should open. And help url should end with 'index.html' """ - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course' \ - '/en/latest/index.html' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course' + '/en/{}/index.html' + ).format(doc_version()) # Assert that help link is correct. assert_nav_help_link( @@ -1046,8 +1110,10 @@ class CertificatePageHelpTest(StudioCourseTest): Then Help link should open. And help url should end with 'set_up_course/creating_course_certificates.html' """ - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course' \ - '/en/latest/set_up_course/creating_course_certificates.html' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course' + '/en/{}/set_up_course/creating_course_certificates.html' + ).format(doc_version()) # Assert that help link is correct. assert_nav_help_link( @@ -1065,8 +1131,10 @@ class CertificatePageHelpTest(StudioCourseTest): Then Help link should open. And help url should end with 'set_up_course/creating_course_certificates.html' """ - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course' \ - '/en/latest/set_up_course/creating_course_certificates.html' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course' + '/en/{}/set_up_course/creating_course_certificates.html' + ).format(doc_version()) # Assert that help link is correct. assert_side_bar_help_link( @@ -1117,8 +1185,11 @@ class GroupExperimentConfigurationHelpTest(ContainerBase): And help url should end with 'content_experiments_configure.html#set-up-group-configurations-in-edx-studio' """ - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/latest/course_features' \ - '/content_experiments/content_experiments_configure.html#set-up-group-configurations-in-edx-studio' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/{}/course_features' + '/content_experiments/content_experiments_configure.html#set-up-group-configurations-in-edx-studio' + ).format(doc_version()) + # Assert that help link is correct. assert_side_bar_help_link( test=self, @@ -1154,8 +1225,10 @@ class ToolsImportHelpTest(StudioCourseTest): Then Help link should open. And help url should end with 'releasing_course/export_import_course.html#import-a-course' """ - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/' \ - 'latest/releasing_course/export_import_course.html#import-a-course' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/' + '{}/releasing_course/export_import_course.html#import-a-course' + ).format(doc_version()) # Assert that help link is correct. assert_nav_help_link( @@ -1173,8 +1246,10 @@ class ToolsImportHelpTest(StudioCourseTest): Then Help link should open. And help url should end with 'releasing_course/export_import_course.html#import-a-course' """ - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/' \ - 'latest/releasing_course/export_import_course.html#import-a-course' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/' + '{}/releasing_course/export_import_course.html#import-a-course' + ).format(doc_version()) # Assert that help link is correct. assert_side_bar_help_link( @@ -1211,8 +1286,10 @@ class ToolsExportHelpTest(StudioCourseTest): Then Help link should open. And help url should end with 'releasing_course/export_import_course.html#export-a-course' """ - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/' \ - 'latest/releasing_course/export_import_course.html#export-a-course' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/' + '{}/releasing_course/export_import_course.html#export-a-course' + ).format(doc_version()) # Assert that help link is correct. assert_nav_help_link( @@ -1230,8 +1307,10 @@ class ToolsExportHelpTest(StudioCourseTest): Then Help link should open. And help url should end with 'releasing_course/export_import_course.html#export-a-course' """ - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/' \ - 'latest/releasing_course/export_import_course.html#export-a-course' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/' + '{}/releasing_course/export_import_course.html#export-a-course' + ).format(doc_version()) # Assert that help link is correct. assert_side_bar_help_link( @@ -1262,8 +1341,10 @@ class StudioWelcomeHelpTest(AcceptanceTest): And help url should contain 'getting_started/get_started.html' """ # The url we want to see in anchor help element. - href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' \ - 'en/latest/getting_started/get_started.html' + href = ( + 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' + 'en/{}/getting_started/get_started.html' + ).format(doc_version()) # Assert that help link is correct. assert_nav_help_link( From 4df63b2b2e21b9f1da294d41b6fb65cc18b7c9ab Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sat, 18 Mar 2017 07:11:52 -0400 Subject: [PATCH 4/4] No need to switch .org -> .io, just use the right URL to begin with --- .../test/acceptance/tests/lms/test_lms_help.py | 16 +++------------- .../cohort-group-header.underscore | 4 ++-- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/common/test/acceptance/tests/lms/test_lms_help.py b/common/test/acceptance/tests/lms/test_lms_help.py index 13b84a12aa..0609f75b84 100644 --- a/common/test/acceptance/tests/lms/test_lms_help.py +++ b/common/test/acceptance/tests/lms/test_lms_help.py @@ -28,16 +28,6 @@ class TestCohortHelp(ContainerBase): self.instructor_dashboard_page.visit() self.cohort_management = self.instructor_dashboard_page.select_cohort_management() - def get_url_with_changed_domain(self, url): - """ - Replaces .org with .io in the url - Arguments: - url (str): The url to perform replace operation on. - Returns: - str: The updated url - """ - return url.replace('.org/', '.io/') - def verify_help_link(self, href): """ Verifies that help link is correct @@ -51,7 +41,7 @@ class TestCohortHelp(ContainerBase): actual_link = self.cohort_management.get_cohort_help_element_and_click_help() assert_link(self, expected_link, actual_link) - assert_opened_help_link_is_correct(self, self.get_url_with_changed_domain(href)) + assert_opened_help_link_is_correct(self, href) def test_manual_cohort_help(self): """ @@ -68,7 +58,7 @@ class TestCohortHelp(ContainerBase): self.cohort_management.add_cohort('cohort_name') href = ( - 'http://edx.readthedocs.org/projects/edx-partner-course-staff/en/{}/' + 'http://edx.readthedocs.io/projects/edx-partner-course-staff/en/{}/' 'course_features/cohorts/cohort_config.html#assign-learners-to-cohorts-manually' ).format(doc_version()) @@ -90,7 +80,7 @@ class TestCohortHelp(ContainerBase): self.cohort_management.add_cohort('cohort_name', assignment_type='random') href = ( - 'http://edx.readthedocs.org/projects/edx-partner-course-staff/en/{}/' + 'http://edx.readthedocs.io/projects/edx-partner-course-staff/en/{}/' 'course_features/cohorts/cohorts_overview.html#all-automated-assignment' ).format(doc_version()) diff --git a/lms/templates/instructor/instructor_dashboard_2/cohort-group-header.underscore b/lms/templates/instructor/instructor_dashboard_2/cohort-group-header.underscore index 7329c3783f..8db5453ba0 100644 --- a/lms/templates/instructor/instructor_dashboard_2/cohort-group-header.underscore +++ b/lms/templates/instructor/instructor_dashboard_2/cohort-group-header.underscore @@ -12,10 +12,10 @@
<% if (cohort.get('assignment_type') == "manual") { %> <%- gettext("Learners are added to this cohort only when you provide their email addresses or usernames on this page.") %> - <%- gettext("What does this mean?") %> + <%- gettext("What does this mean?") %> <% } else { %> <%- gettext("Learners are added to this cohort automatically.") %> - <%- gettext("What does this mean?") %> + <%- gettext("What does this mean?") %> <% } %>