def test_upload_file(client, tmp_path, set_mock_decrypty):
"""
Validate if /upload/<filename> will return 201 and json response
on successful upload of a file with a POST.
:param client: App client
:param tmp_path: fixture to access tmp path
:param set_mock_decrypty: fixture to monkey patch decrypt method
:return:
"""
resp = None
with open(tmp_path/"test_file.txt", "w") as file:
file.write("Some dummy test data.")
with open(tmp_path/"test_file.txt", "rb") as filedata:
data = {
'file': filedata
}
resp = client.post("/upload/testfile", data=data)
assert resp.status_code == 201
assert resp.json == {'msg': 'File is decrypted and saved to /usr/src/app-receiver/output/testfile.xml',
'status_code': 201}
error
} resp = client.post("/upload/testfile", data=data) > assert resp.status_code == 201 E assert 500 == 201 E +500 E -201 tests/test_controller.py:29: AssertionError