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
e98e2aba
Commit
e98e2aba
authored
Jun 14, 2014
by
Matt Drayer
Committed by
Jonathan Piacenti
Aug 20, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mattdrayer/api-workgroupsubmissions: Added resource link to view submissions
parent
e9994a92
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
2 deletions
+39
-2
lms/djangoapps/projects/tests/test_projects.py
+1
-1
lms/djangoapps/projects/tests/test_workgroups.py
+25
-1
lms/djangoapps/projects/views.py
+13
-0
No files found.
lms/djangoapps/projects/tests/test_projects.py
View file @
e98e2aba
...
...
@@ -99,7 +99,7 @@ class ProjectsApiTests(TestCase):
}
response
=
self
.
do_post
(
self
.
test_organizations_uri
,
data
)
self
.
assertEqual
(
response
.
status_code
,
201
)
test_org_id
=
response
.
data
[
'
id
'
]
test_org_id
=
response
.
data
[
'
url
'
]
test_course_content_id
=
"i4x://blahblah1234"
data
=
{
...
...
lms/djangoapps/projects/tests/test_workgroups.py
View file @
e98e2aba
...
...
@@ -198,7 +198,6 @@ class WorkgroupsApiTests(TestCase):
'project'
:
self
.
test_project
.
id
}
response
=
self
.
do_post
(
self
.
test_workgroups_uri
,
data
)
print
response
.
data
self
.
assertEqual
(
response
.
status_code
,
201
)
test_uri
=
'{}{}/'
.
format
(
self
.
test_workgroups_uri
,
str
(
response
.
data
[
'id'
]))
users_uri
=
'{}users/'
.
format
(
test_uri
)
...
...
@@ -276,6 +275,31 @@ class WorkgroupsApiTests(TestCase):
self
.
assertEqual
(
response
.
data
[
0
][
'id'
],
wr_id
)
self
.
assertEqual
(
response
.
data
[
0
][
'reviewer'
],
self
.
test_user
.
username
)
def
test_workgroups_submissions_get
(
self
):
data
=
{
'name'
:
self
.
test_workgroup_name
,
'project'
:
self
.
test_project
.
id
}
response
=
self
.
do_post
(
self
.
test_workgroups_uri
,
data
)
self
.
assertEqual
(
response
.
status_code
,
201
)
workgroup_id
=
response
.
data
[
'id'
]
data
=
{
'workgroup'
:
workgroup_id
,
'user'
:
self
.
test_user
.
id
,
'document_id'
:
'filename.pdf'
,
'document_url'
:
'https://s3.amazonaws.com/bucketname/filename.pdf'
,
'document_mime_type'
:
'application/pdf'
}
response
=
self
.
do_post
(
'/api/submissions/'
,
data
)
self
.
assertEqual
(
response
.
status_code
,
201
)
submission_id
=
response
.
data
[
'id'
]
test_uri
=
'{}{}/'
.
format
(
self
.
test_workgroups_uri
,
workgroup_id
)
submissions_uri
=
'{}submissions/'
.
format
(
test_uri
)
response
=
self
.
do_get
(
submissions_uri
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
data
[
0
][
'id'
],
submission_id
)
self
.
assertEqual
(
response
.
data
[
0
][
'user'
],
self
.
test_user
.
id
)
def
test_submissions_list_post_invalid_relationships
(
self
):
data
=
{
'name'
:
self
.
test_workgroup_name
,
...
...
lms/djangoapps/projects/views.py
View file @
e98e2aba
...
...
@@ -117,6 +117,19 @@ class WorkgroupsViewSet(viewsets.ModelViewSet):
response_data
.
append
(
serializer
.
data
)
return
Response
(
response_data
,
status
=
status
.
HTTP_200_OK
)
@link
()
def
submissions
(
self
,
request
,
pk
):
"""
View Submissions for a specific Workgroup
"""
submissions
=
WorkgroupSubmission
.
objects
.
filter
(
workgroup
=
pk
)
response_data
=
[]
if
submissions
:
for
submission
in
submissions
:
serializer
=
WorkgroupSubmissionSerializer
(
submission
)
response_data
.
append
(
serializer
.
data
)
return
Response
(
response_data
,
status
=
status
.
HTTP_200_OK
)
class
ProjectsViewSet
(
viewsets
.
ModelViewSet
):
"""
...
...
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