diff --git a/cms/djangoapps/contentstore/context_processors.py b/cms/djangoapps/contentstore/context_processors.py
index 0eff961a83..256c5780cd 100644
--- a/cms/djangoapps/contentstore/context_processors.py
+++ b/cms/djangoapps/contentstore/context_processors.py
@@ -12,7 +12,7 @@ config = ConfigParser.ConfigParser()
config.readfp(config_file)
-def doc_url(request=None):
+def doc_url(request=None): # pylint: disable=unused-argument
"""
This function is added in the list of TEMPLATE_CONTEXT_PROCESSORS, which is a django setting for
a tuple of callables that take a request object as their argument and return a dictionary of items
@@ -25,7 +25,7 @@ def doc_url(request=None):
May be used in the future for determining the language of choice.
"""
- def get_online_help_info(page_token):
+ def get_online_help_info(page_token=None):
"""
Args:
page_token: A string that identifies the page for which the help information is requested.
@@ -38,7 +38,14 @@ def doc_url(request=None):
* "pdf_url" - a string with the url corresponding to the location of the PDF help file.
"""
- def get_config_value(section_name, option, default_option="default"):
+ def get_config_value_with_default(section_name, option, default_option="default"):
+ """
+ Args:
+ section_name: name of the section in the configuration from which the option should be found
+ option: name of the configuration option
+ default_option: name of the default configuration option whose value should be returned if the
+ requested option is not found
+ """
try:
return config.get(section_name, option)
except (ConfigParser.NoOptionError, AttributeError):
@@ -46,23 +53,28 @@ def doc_url(request=None):
return config.get(section_name, default_option)
def get_doc_url():
+ """
+ Returns:
+ The URL for the documentation
+ """
return "{url_base}/{language}/{version}/{page_path}".format(
url_base=config.get("help_settings", "url_base"),
- language=language_dir,
+ language=get_config_value_with_default("locales", settings.LANGUAGE_CODE),
version=config.get("help_settings", "version"),
- page_path=page_path,
+ page_path=get_config_value_with_default("pages", page_token),
)
def get_pdf_url():
+ """
+ Returns:
+ The URL for the PDF document using the pdf_settings and the help_settings (version) in the configuration
+ """
return "{pdf_base}/{version}/{pdf_file}".format(
pdf_base=config.get("pdf_settings", "pdf_base"),
version=config.get("help_settings", "version"),
pdf_file=config.get("pdf_settings", "pdf_file"),
)
- language_dir = get_config_value("locales", settings.LANGUAGE_CODE)
- page_path = get_config_value("pages", page_token)
-
return {
"doc_url": get_doc_url(),
"pdf_url": get_pdf_url(),
diff --git a/cms/djangoapps/contentstore/features/course-export.py b/cms/djangoapps/contentstore/features/course-export.py
index bfbb855670..a57ec41f02 100644
--- a/cms/djangoapps/contentstore/features/course-export.py
+++ b/cms/djangoapps/contentstore/features/course-export.py
@@ -1,5 +1,6 @@
-# disable missing docstring
# pylint: disable=C0111
+# pylint: disable=W0621
+# pylint: disable=W0613
from lettuce import world, step
from component_settings_editor_helpers import enter_xml_in_advanced_problem
diff --git a/cms/djangoapps/contentstore/features/course_import.py b/cms/djangoapps/contentstore/features/course_import.py
index 47f7a7f383..42131f097e 100644
--- a/cms/djangoapps/contentstore/features/course_import.py
+++ b/cms/djangoapps/contentstore/features/course_import.py
@@ -1,3 +1,7 @@
+# pylint: disable=C0111
+# pylint: disable=W0621
+# pylint: disable=W0613
+
import os
from lettuce import world, step
from django.conf import settings
diff --git a/cms/djangoapps/contentstore/features/help.feature b/cms/djangoapps/contentstore/features/help.feature
index c829647565..ef6bfe33cc 100644
--- a/cms/djangoapps/contentstore/features/help.feature
+++ b/cms/djangoapps/contentstore/features/help.feature
@@ -14,12 +14,6 @@ Feature: CMS.Help
And I click the course link in My Courses
Then I should see online help for "organizing_course"
- And I click a subsection in the outline
- Then I should see the online help for "subsection"
-
- And I click a unit
- Then I should see the online help for "unit"
-
And I go to the course updates page
Then I should see online help for "updates"
@@ -53,3 +47,15 @@ Feature: CMS.Help
And I go to the export page
Then I should see online help for "export"
+
+ Scenario: Users can access online help on the unit page
+ Given I am in Studio editing a new unit
+ Then I should see online help for "units"
+
+
+ Scenario: Users can access online help on the subsection page
+ Given I have opened a new course section in Studio
+ And I have added a new subsection
+ And I click on the subsection
+ Then I should see online help for "subsections"
+
diff --git a/cms/djangoapps/contentstore/features/help.py b/cms/djangoapps/contentstore/features/help.py
index a614216f18..639aad9c01 100644
--- a/cms/djangoapps/contentstore/features/help.py
+++ b/cms/djangoapps/contentstore/features/help.py
@@ -1,17 +1,24 @@
-from lettuce import world, step
-from nose.tools import assert_false
+# pylint: disable=C0111
+# pylint: disable=W0621
+# pylint: disable=W0613
-
-def find_online_help_for(page_name):
- return world.browser.find_by_xpath(
- '//li[contains(@class, "nav-account-help")]//a[contains(@href, "{page_name}")]'.format(
- page_name=page_name
- )
- )
+from nose.tools import assert_false # pylint: disable=no-name-in-module
+from lettuce import step, world
@step(u'I should see online help for "([^"]*)"$')
def see_online_help_for(step, page_name):
- elements_found = find_online_help_for(page_name)
+ # make sure the online Help link exists on this page and contains the expected page name
+ elements_found = world.browser.find_by_xpath(
+ '//li[contains(@class, "nav-account-help")]//a[contains(@href, "{page_name}")]'.format(
+ page_name=page_name
+ )
+ )
assert_false(elements_found.is_empty())
+ # make sure the PDF link on the sock of this page exists
+ # for now, the PDF link stays constant for all the pages so we just check for "pdf"
+ elements_found = world.browser.find_by_xpath(
+ '//section[contains(@class, "sock")]//li[contains(@class, "js-help-pdf")]//a[contains(@href, "pdf")]'
+ )
+ assert_false(elements_found.is_empty())
diff --git a/cms/templates/base.html b/cms/templates/base.html
index 75b94fe32e..c5ba8ac3a2 100644
--- a/cms/templates/base.html
+++ b/cms/templates/base.html
@@ -277,7 +277,7 @@
- <%include file="widgets/sock.html" />
+ <%include file="widgets/sock.html" args="online_help_token=online_help_token" />
% endif
<%include file="widgets/footer.html" />
diff --git a/cms/templates/index.html b/cms/templates/index.html
index fba662735d..2a905a75ae 100644
--- a/cms/templates/index.html
+++ b/cms/templates/index.html
@@ -275,9 +275,6 @@ require(["domReady!", "jquery", "jquery.form", "js/index"], function(doc, $) {
% endif
- <%
- help_doc_urls = get_online_help_info(online_help_token())
- %>