0001-cmis-handle-content_type-parameter-21807.patch
passerelle/apps/cmis/models.py | ||
---|---|---|
111 | 111 |
filename, |
112 | 112 |
data['path'], |
113 | 113 |
data['file_byte_content'], |
114 |
content_type=data['file'].get('content_type'), |
|
114 | 115 |
object_type=data.get('object_type'), |
115 | 116 |
properties=data.get('properties'), |
116 | 117 |
) |
... | ... | |
186 | 187 | |
187 | 188 |
@wrap_cmis_error |
188 | 189 |
def create_doc(self, file_name, file_path, file_byte_content, |
189 |
object_type=None, properties=None): |
|
190 |
content_type=None, object_type=None, properties=None):
|
|
190 | 191 |
folder = self._get_or_create_folder(file_path) |
191 | 192 |
properties = properties or {} |
192 | 193 |
if object_type: |
193 | 194 |
properties['cmis:objectTypeId'] = object_type |
194 | 195 |
return folder.createDocument(file_name, contentFile=BytesIO(file_byte_content), |
195 |
properties=properties) |
|
196 |
contentType=content_type, properties=properties) |
tests/test_cmis.py | ||
---|---|---|
45 | 45 |
pass |
46 | 46 | |
47 | 47 |
def create_doc(self, file_name, file_path, file_byte_content, |
48 |
object_type=None, properties=None): |
|
48 |
content_type=None, object_type=None, properties=None): |
|
49 |
assert content_type == "image/jpeg" |
|
49 | 50 |
with open(file_name, 'wb') as f: |
50 | 51 |
f.write(file_byte_content) |
51 | 52 |
return Mock(properties={"toto": "tata"}) |
... | ... | |
89 | 90 |
def test_upload_file_metadata(app, setup, monkeypatch): |
90 | 91 | |
91 | 92 |
class FakeFolder: |
92 |
def createDocument(self, filename, contentFile, properties): |
|
93 |
def createDocument(self, filename, contentFile, properties, contentType=None):
|
|
93 | 94 |
return Mock(properties=properties) |
94 | 95 | |
95 | 96 |
from passerelle.apps.cmis.models import CMISGateway |
96 |
- |