File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
qiita_pet/handlers/cloud_handlers Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -92,7 +92,9 @@ def post(self):
9292 filepath = filepath [len (os .sep ):]
9393 filepath = os .path .abspath (os .path .join (basedatadir , filepath ))
9494
95- if os .path .exists (filepath ):
95+ # prevent overwriting existing files, except in test mode
96+ if os .path .exists (filepath ) and \
97+ (not qiita_config .test_environment ):
9698 raise HTTPError (403 , reason = (
9799 "The requested file is already "
98100 "present in Qiita's BASE_DATA_DIR!" ))
Original file line number Diff line number Diff line change 55
66from qiita_db .handlers .tests .oauthbase import OauthTestingBase
77import qiita_db as qdb
8+ from qiita_core .qiita_settings import qiita_config
89
910
1011class FetchFileFromCentralHandlerTests (OauthTestingBase ):
@@ -70,7 +71,11 @@ def test_post(self):
7071
7172 # check if error is raised, if file already exists
7273 with open (fp_source , 'rb' ) as fh :
74+ # we need to let qiita thinks for this test, to NOT be in test mode
75+ oldval = qiita_config .test_environment
76+ qiita_config .test_environment = False
7377 obs = self .post_authed (endpoint , files = {'bar/' : fh })
78+ qiita_config .test_environment = oldval
7479 self .assertIn ("already present in Qiita's BASE_DATA_DIR!" ,
7580 obs .reason )
7681
You can’t perform that action at this time.
0 commit comments