Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
ab5f71ea
Commit
ab5f71ea
authored
Jun 04, 2013
by
JonahStanley
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into jonahstanley/add-navigation-tests
parents
862bb3f8
2cfea12d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
6 deletions
+33
-6
cms/djangoapps/contentstore/tests/test_utils.py
+21
-3
cms/djangoapps/contentstore/utils.py
+12
-3
cms/static/img/large-advanced-icon.png
+0
-0
No files found.
cms/djangoapps/contentstore/tests/test_utils.py
View file @
ab5f71ea
...
@@ -4,6 +4,7 @@ import mock
...
@@ -4,6 +4,7 @@ import mock
import
collections
import
collections
import
copy
import
copy
from
django.test
import
TestCase
from
django.test
import
TestCase
from
django.test.utils
import
override_settings
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
...
@@ -11,11 +12,28 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
...
@@ -11,11 +12,28 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
class
LMSLinksTestCase
(
TestCase
):
class
LMSLinksTestCase
(
TestCase
):
""" Tests for LMS links. """
""" Tests for LMS links. """
def
about_page_test
(
self
):
def
about_page_test
(
self
):
""" Get URL for about page. """
""" Get URL for about page, no marketing site """
# default for ENABLE_MKTG_SITE is False.
self
.
assertEquals
(
self
.
get_about_page_link
(),
"//localhost:8000/courses/mitX/101/test/about"
)
@override_settings
(
MKTG_URLS
=
{
'ROOT'
:
'dummy-root'
})
def
about_page_marketing_site_test
(
self
):
""" Get URL for about page, marketing root present. """
with
mock
.
patch
.
dict
(
'django.conf.settings.MITX_FEATURES'
,
{
'ENABLE_MKTG_SITE'
:
True
}):
self
.
assertEquals
(
self
.
get_about_page_link
(),
"//dummy-root/courses/mitX/101/test/about"
)
with
mock
.
patch
.
dict
(
'django.conf.settings.MITX_FEATURES'
,
{
'ENABLE_MKTG_SITE'
:
False
}):
self
.
assertEquals
(
self
.
get_about_page_link
(),
"//localhost:8000/courses/mitX/101/test/about"
)
@override_settings
(
LMS_BASE
=
None
)
def
about_page_no_lms_base_test
(
self
):
""" No LMS_BASE, nor is ENABLE_MKTG_SITE True """
self
.
assertEquals
(
self
.
get_about_page_link
(),
None
)
def
get_about_page_link
(
self
):
""" create mock course and return the about page link """
location
=
'i4x'
,
'mitX'
,
'101'
,
'course'
,
'test'
location
=
'i4x'
,
'mitX'
,
'101'
,
'course'
,
'test'
utils
.
get_course_id
=
mock
.
Mock
(
return_value
=
"mitX/101/test"
)
utils
.
get_course_id
=
mock
.
Mock
(
return_value
=
"mitX/101/test"
)
link
=
utils
.
get_lms_link_for_about_page
(
location
)
return
utils
.
get_lms_link_for_about_page
(
location
)
self
.
assertEquals
(
link
,
"//localhost:8000/courses/mitX/101/test/about"
)
def
lms_link_test
(
self
):
def
lms_link_test
(
self
):
""" Tests get_lms_link_for_item. """
""" Tests get_lms_link_for_item. """
...
...
cms/djangoapps/contentstore/utils.py
View file @
ab5f71ea
...
@@ -107,9 +107,18 @@ def get_lms_link_for_about_page(location):
...
@@ -107,9 +107,18 @@ def get_lms_link_for_about_page(location):
"""
"""
Returns the url to the course about page from the location tuple.
Returns the url to the course about page from the location tuple.
"""
"""
if
settings
.
LMS_BASE
is
not
None
:
if
settings
.
MITX_FEATURES
.
get
(
'ENABLE_MKTG_SITE'
,
False
):
lms_link
=
"//{lms_base}/courses/{course_id}/about"
.
format
(
# Root will be "www.edx.org". The complete URL will still not be exactly correct,
lms_base
=
settings
.
LMS_BASE
,
# but redirects exist from www.edx.org to get to the drupal course about page URL.
about_base
=
settings
.
MKTG_URLS
.
get
(
'ROOT'
)
elif
settings
.
LMS_BASE
is
not
None
:
about_base
=
settings
.
LMS_BASE
else
:
about_base
=
None
if
about_base
is
not
None
:
lms_link
=
"//{about_base_url}/courses/{course_id}/about"
.
format
(
about_base_url
=
about_base
,
course_id
=
get_course_id
(
location
)
course_id
=
get_course_id
(
location
)
)
)
else
:
else
:
...
...
cms/static/img/large-advanced-icon.png
View replaced file @
862bb3f8
View file @
ab5f71ea
342 Bytes
|
W:
|
H:
633 Bytes
|
W:
|
H:
2-up
Swipe
Onion skin
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment