Skip to content

Commit

Permalink
Jkantor/blank content (openedx#2167)
Browse files Browse the repository at this point in the history
* test: reproduce issue

* fix: allow blank type

* chore: version
  • Loading branch information
jansenk authored Jan 29, 2024
1 parent eb9e2ac commit 9ed4f62
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion openassessment/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Initialization Information for Open Assessment Module
"""

__version__ = '6.0.29'
__version__ = '6.0.30'
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class AddFileRequestSerializer(Serializer):
fileDescription = CharField(source='description')
fileName = CharField(source='name')
fileSize = IntegerField(source='size', min_value=0)
contentType = CharField()
contentType = CharField(allow_blank=True)


class FileUploadCallbackRequestSerializer(Serializer):
Expand Down
13 changes: 10 additions & 3 deletions openassessment/xblock/ui_mixins/mfe/test_mfe_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
from collections import namedtuple
from contextlib import contextmanager
import copy
import json
from unittest.mock import Mock, PropertyMock, patch

Expand Down Expand Up @@ -727,7 +728,7 @@ def _mock_delete_uploaded_file(self, **kwargs):
'fileName': 'n1',
'fileSize': -1,
'contentType': 'text',
}
},
)
@scenario("data/basic_scenario.xml")
def test_bad_inputs(self, xblock, payload):
Expand Down Expand Up @@ -783,16 +784,22 @@ def test_upload_url_error(
assert_error_response(resp, expected_status, expected_code, expected_context)
mock_delete_file.assert_called_once_with(self.VALID_FILE_UPLOAD_OBJ.index)

@ddt.data(False, True)
@scenario("data/basic_scenario.xml")
def test_upload_files(self, xblock):
def test_upload_files(self, xblock, blank_content_type):
""" Test for file upload happy path"""
url = 'www.someurl.xyz/fileUpload'
mock_args = {
'get_upload_url.return_value': url,
'append_file_data.return_value': [self.VALID_FILE_UPLOAD_OBJ],
}

payload = copy.deepcopy(self.VALID_FILE_UPLOAD_PAYLOAD)
if blank_content_type:
payload['contentType'] = ''

with self._mock_submissions_actions(**mock_args):
resp = self.request_upload_files(xblock, self.VALID_FILE_UPLOAD_PAYLOAD)
resp = self.request_upload_files(xblock, payload)
assert resp.status_code == 200
assert resp.json == {
'fileUrl': url,
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "edx-ora2",
"version": "6.0.29",
"version": "6.0.30",
"repository": "https://github.com/openedx/edx-ora2.git",
"dependencies": {
"@edx/frontend-build": "8.0.6",
Expand Down

0 comments on commit 9ed4f62

Please sign in to comment.