Small test change: do as little as possible in an app test context.
This commit is contained in:
parent
e600d87592
commit
d5c2df371a
@ -21,9 +21,9 @@ class FileUploadingTest(AbstractPillarTest):
|
|||||||
with self.app.test_request_context():
|
with self.app.test_request_context():
|
||||||
self.ensure_project_exists()
|
self.ensure_project_exists()
|
||||||
|
|
||||||
resp = self.client.post('/files',
|
resp = self.client.post('/files',
|
||||||
data=json_file,
|
data=json_file,
|
||||||
headers={'Content-Type': 'application/json'})
|
headers={'Content-Type': 'application/json'})
|
||||||
|
|
||||||
self.assertEqual(422, resp.status_code)
|
self.assertEqual(422, resp.status_code)
|
||||||
|
|
||||||
@ -39,15 +39,15 @@ class FileUploadingTest(AbstractPillarTest):
|
|||||||
with self.app.test_request_context():
|
with self.app.test_request_context():
|
||||||
self.ensure_project_exists()
|
self.ensure_project_exists()
|
||||||
|
|
||||||
target_dir = os.path.join(self.app.config['SHARED_DIR'], filename[:2])
|
target_dir = os.path.join(self.app.config['SHARED_DIR'], filename[:2])
|
||||||
if os.path.exists(target_dir):
|
if os.path.exists(target_dir):
|
||||||
assert os.path.isdir(target_dir)
|
assert os.path.isdir(target_dir)
|
||||||
else:
|
else:
|
||||||
os.makedirs(target_dir)
|
os.makedirs(target_dir)
|
||||||
shutil.copy(os.path.join(MY_PATH, filename), target_dir)
|
shutil.copy(os.path.join(MY_PATH, filename), target_dir)
|
||||||
|
|
||||||
resp = self.client.post('/files',
|
resp = self.client.post('/files',
|
||||||
data=json_file,
|
data=json_file,
|
||||||
headers={'Content-Type': 'application/json'})
|
headers={'Content-Type': 'application/json'})
|
||||||
|
|
||||||
self.assertEqual(201, resp.status_code)
|
self.assertEqual(201, resp.status_code)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user