Small test change: do as little as possible in an app test context.

This commit is contained in:
Sybren A. Stüvel 2016-04-26 11:11:33 +02:00
parent e600d87592
commit d5c2df371a

View File

@ -21,9 +21,9 @@ class FileUploadingTest(AbstractPillarTest):
with self.app.test_request_context():
self.ensure_project_exists()
resp = self.client.post('/files',
data=json_file,
headers={'Content-Type': 'application/json'})
resp = self.client.post('/files',
data=json_file,
headers={'Content-Type': 'application/json'})
self.assertEqual(422, resp.status_code)
@ -39,15 +39,15 @@ class FileUploadingTest(AbstractPillarTest):
with self.app.test_request_context():
self.ensure_project_exists()
target_dir = os.path.join(self.app.config['SHARED_DIR'], filename[:2])
if os.path.exists(target_dir):
assert os.path.isdir(target_dir)
else:
os.makedirs(target_dir)
shutil.copy(os.path.join(MY_PATH, filename), target_dir)
target_dir = os.path.join(self.app.config['SHARED_DIR'], filename[:2])
if os.path.exists(target_dir):
assert os.path.isdir(target_dir)
else:
os.makedirs(target_dir)
shutil.copy(os.path.join(MY_PATH, filename), target_dir)
resp = self.client.post('/files',
data=json_file,
headers={'Content-Type': 'application/json'})
resp = self.client.post('/files',
data=json_file,
headers={'Content-Type': 'application/json'})
self.assertEqual(201, resp.status_code)