Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
2e353401
Commit
2e353401
authored
6 years ago
by
christopher lee
Browse files
Options
Downloads
Patches
Plain Diff
Added enrollment API test for throttle rates
LEARNER-5287
parent
175fbac2
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/djangoapps/enrollment/tests/test_views.py
+14
-0
14 additions, 0 deletions
common/djangoapps/enrollment/tests/test_views.py
with
14 additions
and
0 deletions
common/djangoapps/enrollment/tests/test_views.py
+
14
−
0
View file @
2e353401
...
...
@@ -11,6 +11,7 @@ import httpretty
import
pytz
from
django.conf
import
settings
from
django.core.cache
import
cache
from
django.core.exceptions
import
ImproperlyConfigured
from
django.core.handlers.wsgi
import
WSGIRequest
from
django.core.urlresolvers
import
reverse
from
django.test
import
Client
...
...
@@ -555,6 +556,19 @@ class EnrollmentTest(EnrollmentTestMixin, ModuleStoreTestCase, APITestCase, Ente
expected_status
=
status
.
HTTP_429_TOO_MANY_REQUESTS
if
attempt
>=
self
.
rate_limit
else
status
.
HTTP_200_OK
self
.
assert_enrollment_status
(
expected_status
=
expected_status
)
@ddt.data
(
'
staff
'
,
'
user
'
)
def
test_enrollment_throttle_is_set_correctly
(
self
,
user_scope
):
"""
Make sure throttle rate is set correctly for different user scopes.
"""
self
.
rate_limit_config
.
enabled
=
True
self
.
rate_limit_config
.
save
()
throttle
=
EnrollmentUserThrottle
()
throttle
.
scope
=
user_scope
try
:
throttle
.
parse_rate
(
throttle
.
get_rate
())
except
ImproperlyConfigured
:
self
.
fail
(
"
No throttle rate set for {}
"
.
format
(
user_scope
))
def
test_create_enrollment_with_mode
(
self
):
"""
With the right API key, create a new enrollment with a mode set other than the default.
"""
# Create a professional ed course mode.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment