File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -108,12 +108,13 @@ def get_user_agent():
108108
109109def upload_file (client , report_name , report_id , owner_id ):
110110 report_filename = os .path .basename (report_name )
111+ _ , report_extension = report_filename .rsplit ('.' , 1 )
111112 reports_media_api = client .ns ('media' ).ns ('folders' ).collection ('reports_report_file' )
112113 media_file = reports_media_api [owner_id ].action ('files' ).post (
113114 data = open (report_name , 'rb' ),
114115 headers = {
115116 'Content-Type' : 'application/octet-stream' ,
116- 'Content-Disposition' : f'attachment; filename="{ report_filename } "' ,
117+ 'Content-Disposition' : f'attachment; filename="{ report_id } . { report_extension } "' ,
117118 },
118119 )
119120
Original file line number Diff line number Diff line change 55import pytest
66from connect .client import ConnectClient
77from pkg_resources import DistributionNotFound
8+ from responses import matchers
89
910from executor .exceptions import RunnerException
1011from executor .utils import (
@@ -102,6 +103,10 @@ def test_upload_file(mocked_responses, fs):
102103 url = 'https://localhost/public/v1/media/folders/reports_report_file/VA-001/files' ,
103104 status = 201 ,
104105 body = b'{"id": "MFL-001"}' ,
106+ match = [matchers .header_matcher ({
107+ 'Content-Type' : 'application/octet-stream' ,
108+ 'Content-Disposition' : 'attachment; filename="REC-000-000-0000-000000.zip"' ,
109+ })],
105110 )
106111
107112 mocked_responses .add (
You can’t perform that action at this time.
0 commit comments