Testcase getting failed

0 votes

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

Apr 14, 2022 in Python by anonymous

edited Mar 4 8 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP