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
ffd1e29d
Commit
ffd1e29d
authored
Jun 06, 2016
by
Renzo Lucioni
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show Programs tab on program detail pages
parent
f8be1ed1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
5 deletions
+19
-5
lms/djangoapps/learner_dashboard/tests/test_programs.py
+16
-5
lms/djangoapps/learner_dashboard/views.py
+2
-0
openedx/core/djangoapps/programs/tests/mixins.py
+1
-0
No files found.
lms/djangoapps/learner_dashboard/tests/test_programs.py
View file @
ffd1e29d
...
...
@@ -6,6 +6,7 @@ import json
import
unittest
from
urlparse
import
urljoin
from
bs4
import
BeautifulSoup
from
django.conf
import
settings
from
django.core.urlresolvers
import
reverse
from
django.test
import
override_settings
,
TestCase
...
...
@@ -51,7 +52,6 @@ class TestProgramListing(
ClientFactory
(
name
=
CredentialsApiConfig
.
OAUTH2_CLIENT_NAME
,
client_type
=
CONFIDENTIAL
)
ClientFactory
(
name
=
ProgramsApiConfig
.
OAUTH2_CLIENT_NAME
,
client_type
=
CONFIDENTIAL
)
self
.
student
=
UserFactory
()
self
.
create_programs_config
(
xseries_ad_enabled
=
True
,
program_listing_enabled
=
True
)
def
_create_course_and_enroll
(
self
,
student
,
org
,
course
,
run
):
"""
...
...
@@ -107,6 +107,7 @@ class TestProgramListing(
@httpretty.activate
def
test_get_program_with_no_enrollment
(
self
):
self
.
create_programs_config
()
response
=
self
.
_setup_and_get_program
()
for
program_element
in
self
.
_get_program_checklist
(
0
):
self
.
assertNotContains
(
response
,
program_element
)
...
...
@@ -115,6 +116,7 @@ class TestProgramListing(
@httpretty.activate
def
test_get_one_program
(
self
):
self
.
create_programs_config
()
self
.
_create_course_and_enroll
(
self
.
student
,
*
self
.
COURSE_KEYS
[
0
]
.
split
(
'/'
))
response
=
self
.
_setup_and_get_program
()
for
program_element
in
self
.
_get_program_checklist
(
0
):
...
...
@@ -126,6 +128,7 @@ class TestProgramListing(
@httpretty.activate
def
test_get_both_program
(
self
):
self
.
create_programs_config
()
self
.
_create_course_and_enroll
(
self
.
student
,
*
self
.
COURSE_KEYS
[
0
]
.
split
(
'/'
))
self
.
_create_course_and_enroll
(
self
.
student
,
*
self
.
COURSE_KEYS
[
5
]
.
split
(
'/'
))
response
=
self
.
_setup_and_get_program
()
...
...
@@ -143,7 +146,7 @@ class TestProgramListing(
self
.
assertEqual
(
response
.
status_code
,
404
)
def
test_xseries_advertise_disabled
(
self
):
self
.
create_programs_config
(
program_listing_enabled
=
True
,
xseries_ad_enabled
=
False
)
self
.
create_programs_config
(
xseries_ad_enabled
=
False
)
self
.
client
.
login
(
username
=
self
.
student
.
username
,
password
=
self
.
PASSWORD
)
response
=
self
.
client
.
get
(
self
.
url
)
x_series_url
=
urljoin
(
settings
.
MKTG_URLS
.
get
(
'ROOT'
),
'xseries'
)
...
...
@@ -194,7 +197,7 @@ class TestProgramListing(
@httpretty.activate
def
test_get_xseries_certificates_with_data
(
self
):
self
.
create_programs_config
(
program_listing_enabled
=
True
)
self
.
create_programs_config
()
self
.
create_credentials_config
(
is_learner_issuance_enabled
=
True
)
self
.
client
.
login
(
username
=
self
.
student
.
username
,
password
=
self
.
PASSWORD
)
...
...
@@ -213,7 +216,7 @@ class TestProgramListing(
@httpretty.activate
def
test_get_xseries_certificates_without_data
(
self
):
self
.
create_programs_config
(
program_listing_enabled
=
True
)
self
.
create_programs_config
()
self
.
create_credentials_config
(
is_learner_issuance_enabled
=
True
)
self
.
client
.
login
(
username
=
self
.
student
.
username
,
password
=
self
.
PASSWORD
)
...
...
@@ -283,8 +286,16 @@ class TestProgramDetails(ProgramsApiConfigMixin, SharedModuleStoreTestCase):
def
_assert_program_data_present
(
self
,
response
):
"""Verify that program data is present."""
self
.
assertContains
(
response
,
'programData'
)
self
.
assertContains
(
response
,
'programListingUrl'
)
self
.
assertContains
(
response
,
self
.
data
[
'name'
])
self
.
assertContains
(
response
,
reverse
(
'program_listing_view'
))
self
.
_assert_programs_tab_present
(
response
)
def
_assert_programs_tab_present
(
self
,
response
):
"""Verify that the programs tab is present in the nav."""
soup
=
BeautifulSoup
(
response
.
content
,
'html.parser'
)
self
.
assertTrue
(
any
(
soup
.
find_all
(
'a'
,
class_
=
'tab-nav-link'
,
href
=
reverse
(
'program_listing_view'
)))
)
def
test_login_required
(
self
):
"""
...
...
lms/djangoapps/learner_dashboard/views.py
View file @
ffd1e29d
...
...
@@ -63,10 +63,12 @@ def program_details(request, program_id):
raise
Http404
program_data
=
utils
.
supplement_program_data
(
program_data
,
request
.
user
)
show_program_listing
=
ProgramsApiConfig
.
current
()
.
show_program_listing
context
=
{
'program_data'
:
program_data
,
'program_listing_url'
:
reverse
(
'program_listing_view'
),
'show_program_listing'
:
show_program_listing
,
'nav_hidden'
:
True
,
'disable_courseware_js'
:
True
,
'uses_pattern_library'
:
True
...
...
openedx/core/djangoapps/programs/tests/mixins.py
View file @
ffd1e29d
...
...
@@ -22,6 +22,7 @@ class ProgramsApiConfigMixin(object):
'enable_studio_tab'
:
True
,
'enable_certification'
:
True
,
'xseries_ad_enabled'
:
True
,
'program_listing_enabled'
:
True
,
'program_details_enabled'
:
True
,
}
...
...
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