Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-ora2
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-ora2
Commits
0c74d7d0
Commit
0c74d7d0
authored
May 26, 2017
by
attiyaishaque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
All files with upper case extension changes into lowercase.
parent
3789d962
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
1 deletions
+44
-1
openassessment/xblock/submission_mixin.py
+1
-1
openassessment/xblock/test/data/custom_file_upload.xml
+20
-0
openassessment/xblock/test/test_submission.py
+23
-0
No files found.
openassessment/xblock/submission_mixin.py
View file @
0c74d7d0
...
...
@@ -298,7 +298,7 @@ class SubmissionMixin(object):
if
self
.
file_upload_type
==
'pdf-and-image'
and
content_type
not
in
self
.
ALLOWED_FILE_MIME_TYPES
:
return
{
'success'
:
False
,
'msg'
:
self
.
_
(
u"Content type must be PDF, GIF, PNG or JPG."
)}
if
self
.
file_upload_type
==
'custom'
and
file_ext
not
in
self
.
white_listed_file_types
:
if
self
.
file_upload_type
==
'custom'
and
file_ext
.
lower
()
not
in
self
.
white_listed_file_types
:
return
{
'success'
:
False
,
'msg'
:
self
.
_
(
u"File type must be one of the following types: {}"
)
.
format
(
', '
.
join
(
self
.
white_listed_file_types
))}
...
...
openassessment/xblock/test/data/custom_file_upload.xml
0 → 100644
View file @
0c74d7d0
<openassessment
file_upload_type=
"custom"
white_listed_file_types=
"pdf"
submission_due=
"2035-03-11T18:20"
>
<title>
Global Poverty
</title>
<rubric>
<prompt>
Given the state of the world today, what do you think should be done to combat poverty?
Read for conciseness, clarity of thought, and form.
</prompt>
</rubric>
<assessments>
<assessment
name=
"peer-assessment"
start=
"2014-03-11T10:00-18:10"
due=
"2035-12-21T22:22-7:00"
must_grade=
"1"
must_be_graded_by=
"1"
/>
<assessment
name=
"self-assessment"
/>
</assessments>
</openassessment>
openassessment/xblock/test/test_submission.py
View file @
0c74d7d0
...
...
@@ -221,6 +221,29 @@ class SubmissionTest(XBlockHandlerTestCase):
self
.
assertTrue
(
resp
[
'success'
])
self
.
assertEqual
(
u''
,
resp
[
'url'
])
@mock_s3
@override_settings
(
AWS_ACCESS_KEY_ID
=
'foobar'
,
AWS_SECRET_ACCESS_KEY
=
'bizbaz'
,
FILE_UPLOAD_STORAGE_BUCKET_NAME
=
"mybucket"
)
@scenario
(
'data/custom_file_upload.xml'
)
def
test_upload_files_with_uppercase_ext
(
self
,
xblock
):
"""
Tests that files with upper case extention uploaded successfully
"""
xblock
.
xmodule_runtime
=
Mock
(
course_id
=
'test_course'
,
anonymous_student_id
=
'test_student'
,
)
resp
=
self
.
request
(
xblock
,
'upload_url'
,
json
.
dumps
({
'contentType'
:
'filename'
,
'filename'
:
'test.PDF'
}),
response_format
=
'json'
)
self
.
assertTrue
(
resp
[
'success'
])
self
.
assertTrue
(
resp
[
'url'
]
.
startswith
(
'https://mybucket.s3.amazonaws.com/submissions_attachments/test_student/test_course/'
+
xblock
.
scope_ids
.
usage_id
))
class
SubmissionRenderTest
(
XBlockHandlerTestCase
):
"""
...
...
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