Fixed imports for py.test

For some reason the 'from application import utils' worked fine when
running unittests from PyCharm, but breaks in py.test. Strange.
This commit is contained in:
2016-03-25 18:27:27 +01:00
parent 7c04e01cde
commit 8b4e0c4578

View File

@@ -12,12 +12,10 @@ from common_test_data import EXAMPLE_FILE
class FileUploadingTest(AbstractPillarTest):
def test_create_file_missing_on_fs(self):
from application import utils
from application.utils import PillarJSONEncoder
from application.utils import PillarJSONEncoder, remove_private_keys
to_post = utils.remove_private_keys(EXAMPLE_FILE)
to_post = remove_private_keys(EXAMPLE_FILE)
json_file = json.dumps(to_post, cls=PillarJSONEncoder)
with self.app.test_request_context():
@@ -29,15 +27,13 @@ class FileUploadingTest(AbstractPillarTest):
self.assertEqual(422, resp.status_code)
def test_create_file_exists_on_fs(self):
from application import utils
from application.utils import PillarJSONEncoder
from application.utils import PillarJSONEncoder, remove_private_keys
filename = 'BlenderDesktopLogo.png'
full_file = copy.deepcopy(EXAMPLE_FILE)
full_file[u'name'] = filename
to_post = utils.remove_private_keys(full_file)
to_post = remove_private_keys(full_file)
json_file = json.dumps(to_post, cls=PillarJSONEncoder)
with self.app.test_request_context():
@@ -55,4 +51,3 @@ class FileUploadingTest(AbstractPillarTest):
headers={'Content-Type': 'application/json'})
self.assertEqual(201, resp.status_code)