From 5caff3fbc6e81348f0bc03cda6a43183718a6f3c Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Wed, 10 Mar 2021 12:03:01 +0300 Subject: Add extra tests for file utils In test server, files were not extracted properly. This test exposes the bug. --- tests/unit/test_file_utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/unit/test_file_utils.py b/tests/unit/test_file_utils.py index bd54a6a..b319693 100644 --- a/tests/unit/test_file_utils.py +++ b/tests/unit/test_file_utils.py @@ -56,6 +56,10 @@ non-existent""" token="abcdef-abcdef") mock_fileobj.save.assert_called_once_with("/tmp/abcdef-abcdef/" "upload-data.tar.gz") + mock_tarfile.open.assert_called_once_with("/tmp/abcdef-abcdef/" + "upload-data.tar.gz") + mock_tarfile.open.return_value.extractall.assert_called_once_with( + path='/tmp/abcdef-abcdef') mock_file.assert_called_once_with("upload-data.tar.gz") self.assertEqual(result, {"status": 0, "token": "abcdef-abcdef"}) -- cgit v1.2.3