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
b5305147
Commit
b5305147
authored
Apr 17, 2015
by
Jesse Zoldak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Expose course start/end date in the enrollment API"
parent
53f4a13f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
88 deletions
+20
-88
common/djangoapps/enrollment/api.py
+12
-24
common/djangoapps/enrollment/serializers.py
+0
-2
common/djangoapps/enrollment/tests/test_views.py
+0
-41
common/djangoapps/enrollment/views.py
+8
-21
No files found.
common/djangoapps/enrollment/api.py
View file @
b5305147
...
@@ -36,10 +36,7 @@ def get_enrollments(user_id):
...
@@ -36,10 +36,7 @@ def get_enrollments(user_id):
"user": "Bob",
"user": "Bob",
"course": {
"course": {
"course_id": "edX/DemoX/2014T2",
"course_id": "edX/DemoX/2014T2",
"enrollment_end": "2014-12-20T20:18:00Z",
"enrollment_end": 2014-12-20T20:18:00Z,
"enrollment_start": "2014-10-15T20:18:00Z",
"course_start": "2015-02-03T00:00:00Z",
"course_end": "2015-05-06T00:00:00Z",
"course_modes": [
"course_modes": [
{
{
"slug": "honor",
"slug": "honor",
...
@@ -52,6 +49,7 @@ def get_enrollments(user_id):
...
@@ -52,6 +49,7 @@ def get_enrollments(user_id):
"sku": null
"sku": null
}
}
],
],
"enrollment_start": 2014-10-15T20:18:00Z,
"invite_only": False
"invite_only": False
}
}
},
},
...
@@ -62,10 +60,7 @@ def get_enrollments(user_id):
...
@@ -62,10 +60,7 @@ def get_enrollments(user_id):
"user": "Bob",
"user": "Bob",
"course": {
"course": {
"course_id": "edX/edX-Insider/2014T2",
"course_id": "edX/edX-Insider/2014T2",
"enrollment_end": "2014-12-20T20:18:00Z",
"enrollment_end": 2014-12-20T20:18:00Z,
"enrollment_start": "2014-10-15T20:18:00Z",
"course_start": "2015-02-03T00:00:00Z",
"course_end": "2015-05-06T00:00:00Z",
"course_modes": [
"course_modes": [
{
{
"slug": "honor",
"slug": "honor",
...
@@ -78,6 +73,7 @@ def get_enrollments(user_id):
...
@@ -78,6 +73,7 @@ def get_enrollments(user_id):
"sku": null
"sku": null
}
}
],
],
"enrollment_start": 2014-10-15T20:18:00Z,
"invite_only": True
"invite_only": True
}
}
}
}
...
@@ -108,10 +104,7 @@ def get_enrollment(user_id, course_id):
...
@@ -108,10 +104,7 @@ def get_enrollment(user_id, course_id):
"user": "Bob",
"user": "Bob",
"course": {
"course": {
"course_id": "edX/DemoX/2014T2",
"course_id": "edX/DemoX/2014T2",
"enrollment_end": "2014-12-20T20:18:00Z",
"enrollment_end": 2014-12-20T20:18:00Z,
"enrollment_start": "2014-10-15T20:18:00Z",
"course_start": "2015-02-03T00:00:00Z",
"course_end": "2015-05-06T00:00:00Z",
"course_modes": [
"course_modes": [
{
{
"slug": "honor",
"slug": "honor",
...
@@ -124,6 +117,7 @@ def get_enrollment(user_id, course_id):
...
@@ -124,6 +117,7 @@ def get_enrollment(user_id, course_id):
"sku": null
"sku": null
}
}
],
],
"enrollment_start": 2014-10-15T20:18:00Z,
"invite_only": False
"invite_only": False
}
}
}
}
...
@@ -157,10 +151,7 @@ def add_enrollment(user_id, course_id, mode='honor', is_active=True):
...
@@ -157,10 +151,7 @@ def add_enrollment(user_id, course_id, mode='honor', is_active=True):
"user": "Bob",
"user": "Bob",
"course": {
"course": {
"course_id": "edX/DemoX/2014T2",
"course_id": "edX/DemoX/2014T2",
"enrollment_end": "2014-12-20T20:18:00Z",
"enrollment_end": 2014-12-20T20:18:00Z,
"enrollment_start": "2014-10-15T20:18:00Z",
"course_start": "2015-02-03T00:00:00Z",
"course_end": "2015-05-06T00:00:00Z",
"course_modes": [
"course_modes": [
{
{
"slug": "honor",
"slug": "honor",
...
@@ -173,6 +164,7 @@ def add_enrollment(user_id, course_id, mode='honor', is_active=True):
...
@@ -173,6 +164,7 @@ def add_enrollment(user_id, course_id, mode='honor', is_active=True):
"sku": null
"sku": null
}
}
],
],
"enrollment_start": 2014-10-15T20:18:00Z,
"invite_only": False
"invite_only": False
}
}
}
}
...
@@ -204,10 +196,7 @@ def update_enrollment(user_id, course_id, mode=None, is_active=None):
...
@@ -204,10 +196,7 @@ def update_enrollment(user_id, course_id, mode=None, is_active=None):
"user": "Bob",
"user": "Bob",
"course": {
"course": {
"course_id": "edX/DemoX/2014T2",
"course_id": "edX/DemoX/2014T2",
"enrollment_end": "2014-12-20T20:18:00Z",
"enrollment_end": 2014-12-20T20:18:00Z,
"enrollment_start": "2014-10-15T20:18:00Z",
"course_start": "2015-02-03T00:00:00Z",
"course_end": "2015-05-06T00:00:00Z",
"course_modes": [
"course_modes": [
{
{
"slug": "honor",
"slug": "honor",
...
@@ -220,6 +209,7 @@ def update_enrollment(user_id, course_id, mode=None, is_active=None):
...
@@ -220,6 +209,7 @@ def update_enrollment(user_id, course_id, mode=None, is_active=None):
"sku": null
"sku": null
}
}
],
],
"enrollment_start": 2014-10-15T20:18:00Z,
"invite_only": False
"invite_only": False
}
}
}
}
...
@@ -249,10 +239,7 @@ def get_course_enrollment_details(course_id):
...
@@ -249,10 +239,7 @@ def get_course_enrollment_details(course_id):
>>> get_course_enrollment_details("edX/DemoX/2014T2")
>>> get_course_enrollment_details("edX/DemoX/2014T2")
{
{
"course_id": "edX/DemoX/2014T2",
"course_id": "edX/DemoX/2014T2",
"enrollment_end": "2014-12-20T20:18:00Z",
"enrollment_end": 2014-12-20T20:18:00Z,
"enrollment_start": "2014-10-15T20:18:00Z",
"course_start": "2015-02-03T00:00:00Z",
"course_end": "2015-05-06T00:00:00Z",
"course_modes": [
"course_modes": [
{
{
"slug": "honor",
"slug": "honor",
...
@@ -265,6 +252,7 @@ def get_course_enrollment_details(course_id):
...
@@ -265,6 +252,7 @@ def get_course_enrollment_details(course_id):
"sku": null
"sku": null
}
}
],
],
"enrollment_start": 2014-10-15T20:18:00Z,
"invite_only": False
"invite_only": False
}
}
...
...
common/djangoapps/enrollment/serializers.py
View file @
b5305147
...
@@ -46,8 +46,6 @@ class CourseField(serializers.RelatedField):
...
@@ -46,8 +46,6 @@ class CourseField(serializers.RelatedField):
"course_id"
:
course_id
,
"course_id"
:
course_id
,
"enrollment_start"
:
course
.
enrollment_start
,
"enrollment_start"
:
course
.
enrollment_start
,
"enrollment_end"
:
course
.
enrollment_end
,
"enrollment_end"
:
course
.
enrollment_end
,
"course_start"
:
course
.
start
,
"course_end"
:
course
.
end
,
"invite_only"
:
course
.
invitation_only
,
"invite_only"
:
course
.
invitation_only
,
"course_modes"
:
course_modes
,
"course_modes"
:
course_modes
,
}
}
...
...
common/djangoapps/enrollment/tests/test_views.py
View file @
b5305147
...
@@ -3,7 +3,6 @@ Tests for user enrollment.
...
@@ -3,7 +3,6 @@ Tests for user enrollment.
"""
"""
import
json
import
json
import
unittest
import
unittest
import
datetime
import
ddt
import
ddt
from
django.core.cache
import
cache
from
django.core.cache
import
cache
...
@@ -306,46 +305,6 @@ class EnrollmentTest(EnrollmentTestMixin, ModuleStoreTestCase, APITestCase):
...
@@ -306,46 +305,6 @@ class EnrollmentTest(EnrollmentTestMixin, ModuleStoreTestCase, APITestCase):
self
.
assertEqual
(
mode
[
'sku'
],
'123'
)
self
.
assertEqual
(
mode
[
'sku'
],
'123'
)
self
.
assertEqual
(
mode
[
'name'
],
CourseMode
.
HONOR
)
self
.
assertEqual
(
mode
[
'name'
],
CourseMode
.
HONOR
)
@ddt.data
(
# NOTE: Studio requires a start date, but this is not
# enforced at the data layer, so we need to handle the case
# in which no dates are specified.
(
None
,
None
,
None
,
None
),
(
datetime
.
datetime
(
2015
,
1
,
2
,
3
,
4
,
5
),
None
,
"2015-01-02T03:04:05Z"
,
None
),
(
None
,
datetime
.
datetime
(
2015
,
1
,
2
,
3
,
4
,
5
),
None
,
"2015-01-02T03:04:05Z"
),
(
datetime
.
datetime
(
2014
,
6
,
7
,
8
,
9
,
10
),
datetime
.
datetime
(
2015
,
1
,
2
,
3
,
4
,
5
),
"2014-06-07T08:09:10Z"
,
"2015-01-02T03:04:05Z"
),
)
@ddt.unpack
def
test_get_course_details_course_dates
(
self
,
start_datetime
,
end_datetime
,
expected_start
,
expected_end
):
course
=
CourseFactory
.
create
(
start
=
start_datetime
,
end
=
end_datetime
)
self
.
_create_enrollment
(
course_id
=
unicode
(
course
.
id
))
# Check course details
url
=
reverse
(
'courseenrollmentdetails'
,
kwargs
=
{
"course_id"
:
unicode
(
course
.
id
)})
resp
=
self
.
client
.
get
(
url
)
self
.
assertEqual
(
resp
.
status_code
,
status
.
HTTP_200_OK
)
data
=
json
.
loads
(
resp
.
content
)
self
.
assertEqual
(
data
[
'course_start'
],
expected_start
)
self
.
assertEqual
(
data
[
'course_end'
],
expected_end
)
# Check enrollment course details
url
=
reverse
(
'courseenrollment'
,
kwargs
=
{
"course_id"
:
unicode
(
course
.
id
)})
resp
=
self
.
client
.
get
(
url
)
self
.
assertEqual
(
resp
.
status_code
,
status
.
HTTP_200_OK
)
data
=
json
.
loads
(
resp
.
content
)
self
.
assertEqual
(
data
[
'course_details'
][
'course_start'
],
expected_start
)
self
.
assertEqual
(
data
[
'course_details'
][
'course_end'
],
expected_end
)
# Check enrollment list course details
resp
=
self
.
client
.
get
(
reverse
(
'courseenrollments'
))
self
.
assertEqual
(
resp
.
status_code
,
status
.
HTTP_200_OK
)
data
=
json
.
loads
(
resp
.
content
)
self
.
assertEqual
(
data
[
0
][
'course_details'
][
'course_start'
],
expected_start
)
self
.
assertEqual
(
data
[
0
][
'course_details'
][
'course_end'
],
expected_end
)
def
test_with_invalid_course_id
(
self
):
def
test_with_invalid_course_id
(
self
):
self
.
assert_enrollment_status
(
course_id
=
'entirely/fake/course'
,
expected_status
=
status
.
HTTP_400_BAD_REQUEST
)
self
.
assert_enrollment_status
(
course_id
=
'entirely/fake/course'
,
expected_status
=
status
.
HTTP_400_BAD_REQUEST
)
...
...
common/djangoapps/enrollment/views.py
View file @
b5305147
...
@@ -83,13 +83,7 @@ class EnrollmentView(APIView, ApiKeyPermissionMixIn):
...
@@ -83,13 +83,7 @@ class EnrollmentView(APIView, ApiKeyPermissionMixIn):
* course_id: The unique identifier for the course.
* course_id: The unique identifier for the course.
* enrollment_start: The date and time that users can begin enrolling in the course. If null, enrollment opens immediately when the course is created.
* enrollment_end: The date and time after which users cannot enroll for the course.
* enrollment_end: The date and time after which users cannot enroll for the course. If null, the enrollment period never ends.
* course_start: The date and time at which the course opens. If null, the course opens immediately when created.
* course_end: The date and time at which the course closes. If null, the course never ends.
* course_modes: An array of data about the enrollment modes supported for the course. Each enrollment mode collection includes:
* course_modes: An array of data about the enrollment modes supported for the course. Each enrollment mode collection includes:
...
@@ -101,6 +95,8 @@ class EnrollmentView(APIView, ApiKeyPermissionMixIn):
...
@@ -101,6 +95,8 @@ class EnrollmentView(APIView, ApiKeyPermissionMixIn):
* expiration_datetime: The date and time after which users cannot enroll in the course in this mode.
* expiration_datetime: The date and time after which users cannot enroll in the course in this mode.
* description: A description of this mode.
* description: A description of this mode.
* enrollment_start: The date and time that users can begin enrolling in the course.
* invite_only: Whether students must be invited to enroll in the course; true or false.
* invite_only: Whether students must be invited to enroll in the course; true or false.
* user: The ID of the user.
* user: The ID of the user.
...
@@ -171,13 +167,7 @@ class EnrollmentCourseDetailView(APIView):
...
@@ -171,13 +167,7 @@ class EnrollmentCourseDetailView(APIView):
* course_id: The unique identifier of the course.
* course_id: The unique identifier of the course.
* enrollment_start: The date and time that users can begin enrolling in the course. If null, enrollment opens immediately when the course is created.
* enrollment_end: The date and time after which users cannot enroll for the course.
* enrollment_end: The date and time after which users cannot enroll for the course. If null, the enrollment period never ends.
* course_start: The date and time at which the course opens. If null, the course opens immediately when created.
* course_end: The date and time at which the course closes. If null, the course never ends.
* course_modes: An array of data about the enrollment modes supported for the course. Each enrollment mode collection includes:
* course_modes: An array of data about the enrollment modes supported for the course. Each enrollment mode collection includes:
...
@@ -189,6 +179,8 @@ class EnrollmentCourseDetailView(APIView):
...
@@ -189,6 +179,8 @@ class EnrollmentCourseDetailView(APIView):
* expiration_datetime: The date and time after which users cannot enroll in the course in this mode.
* expiration_datetime: The date and time after which users cannot enroll in the course in this mode.
* description: A description of this mode.
* description: A description of this mode.
* enrollment_start: The date and time that users can begin enrolling in the course.
* invite_only: Whether students must be invited to enroll in the course; true or false.
* invite_only: Whether students must be invited to enroll in the course; true or false.
"""
"""
...
@@ -275,13 +267,7 @@ class EnrollmentListView(APIView, ApiKeyPermissionMixIn):
...
@@ -275,13 +267,7 @@ class EnrollmentListView(APIView, ApiKeyPermissionMixIn):
* course_id: The unique identifier for the course.
* course_id: The unique identifier for the course.
* enrollment_start: The date and time that users can begin enrolling in the course. If null, enrollment opens immediately when the course is created.
* enrollment_end: The date and time after which users cannot enroll for the course.
* enrollment_end: The date and time after which users cannot enroll for the course. If null, the enrollment period never ends.
* course_start: The date and time at which the course opens. If null, the course opens immediately when created.
* course_end: The date and time at which the course closes. If null, the course never ends.
* course_modes: An array of data about the enrollment modes supported for the course. Each enrollment mode collection includes:
* course_modes: An array of data about the enrollment modes supported for the course. Each enrollment mode collection includes:
...
@@ -293,6 +279,7 @@ class EnrollmentListView(APIView, ApiKeyPermissionMixIn):
...
@@ -293,6 +279,7 @@ class EnrollmentListView(APIView, ApiKeyPermissionMixIn):
* expiration_datetime: The date and time after which users cannot enroll in the course in this mode.
* expiration_datetime: The date and time after which users cannot enroll in the course in this mode.
* description: A description of this mode.
* description: A description of this mode.
* enrollment_start: The date and time that users can begin enrolling in the course.
* invite_only: Whether students must be invited to enroll in the course; true or false.
* invite_only: Whether students must be invited to enroll in the course; true or false.
...
...
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