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
5e5f4f73
Commit
5e5f4f73
authored
Mar 21, 2017
by
Hasnain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WL-1011 | Added SiteConfiguration flag 'ENABLE_DONATIONS' to enable the donation message.
parent
b10083cb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
1 deletions
+31
-1
common/djangoapps/student/tests/test_recent_enrollments.py
+27
-0
common/djangoapps/student/views.py
+4
-1
No files found.
common/djangoapps/student/tests/test_recent_enrollments.py
View file @
5e5f4f73
...
...
@@ -18,6 +18,7 @@ from course_modes.tests.factories import CourseModeFactory
from
student.models
import
CourseEnrollment
,
DashboardConfiguration
from
student.views
import
get_course_enrollments
,
_get_recently_enrolled_courses
from
common.test.utils
import
XssTestMixin
from
openedx.core.djangoapps.site_configuration.tests.test_util
import
with_site_configuration_context
@attr
(
shard
=
3
)
...
...
@@ -211,3 +212,29 @@ class TestRecentEnrollments(ModuleStoreTestCase, XssTestMixin):
self
.
client
.
login
(
username
=
self
.
student
.
username
,
password
=
self
.
PASSWORD
)
response
=
self
.
client
.
get
(
reverse
(
"dashboard"
))
self
.
assertNotContains
(
response
,
"donate-container"
)
@ddt.data
(
(
True
,
False
,),
(
True
,
True
,),
(
False
,
False
,),
(
False
,
True
,),
)
@ddt.unpack
def
test_donate_button_with_enabled_site_configuration
(
self
,
enable_donation_config
,
enable_donation_site_config
):
# Enable the enrollment success message and donations
self
.
_configure_message_timeout
(
10000
)
# DonationConfiguration has low precedence if 'ENABLE_DONATIONS' is enable in SiteConfiguration
DonationConfiguration
(
enabled
=
enable_donation_config
)
.
save
()
CourseModeFactory
.
create
(
mode_slug
=
"audit"
,
course_id
=
self
.
course
.
id
,
min_price
=
0
)
self
.
enrollment
.
mode
=
"audit"
self
.
enrollment
.
save
()
self
.
client
.
login
(
username
=
self
.
student
.
username
,
password
=
self
.
PASSWORD
)
with
with_site_configuration_context
(
configuration
=
{
'ENABLE_DONATIONS'
:
enable_donation_site_config
}):
response
=
self
.
client
.
get
(
reverse
(
"dashboard"
))
if
enable_donation_site_config
:
self
.
assertContains
(
response
,
"donate-container"
)
else
:
self
.
assertNotContains
(
response
,
"donate-container"
)
common/djangoapps/student/views.py
View file @
5e5f4f73
...
...
@@ -936,7 +936,10 @@ def _allow_donation(course_modes, course_id, enrollment):
flat_unexpired_modes
,
flat_all_modes
)
donations_enabled
=
DonationConfiguration
.
current
()
.
enabled
donations_enabled
=
configuration_helpers
.
get_value
(
'ENABLE_DONATIONS'
,
DonationConfiguration
.
current
()
.
enabled
)
return
(
donations_enabled
and
enrollment
.
mode
in
course_modes
[
course_id
]
and
...
...
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