Fixed stuff

This commit is contained in:
Manuel Cortez 2024-04-29 17:01:45 -06:00
parent 4635eea99d
commit d53676c689
No known key found for this signature in database
GPG Key ID: 9E0735CA15EFE790

View File

@ -91,7 +91,7 @@ def test_extract_archive():
with mock.patch("zipfile.ZipFile", return_value=zipfile_opened) as zipfile_mock: with mock.patch("zipfile.ZipFile", return_value=zipfile_opened) as zipfile_mock:
result = updater.extract_update("update.zip", os.path.dirname(__file__)) result = updater.extract_update("update.zip", os.path.dirname(__file__))
assert result == os.path.dirname(__file__) assert result == os.path.dirname(__file__)
zipfile_mock.called_once_with("update.zip") zipfile_mock.assert_called_once_with("update.zip")
zipfile_opened.extractall.assert_called_once() zipfile_opened.extractall.assert_called_once()
# Test a password protected update file. # Test a password protected update file.
zipfile_opened_with_password = mock.MagicMock() zipfile_opened_with_password = mock.MagicMock()
@ -100,8 +100,8 @@ def test_extract_archive():
updater.password = "MyLongPassword" updater.password = "MyLongPassword"
result2 = updater.extract_update("update.zip", os.path.dirname(__file__)) result2 = updater.extract_update("update.zip", os.path.dirname(__file__))
assert result2 == os.path.dirname(__file__) assert result2 == os.path.dirname(__file__)
zipfile_mock.called_once_with("update.zip") zipfile_mock.assert_called_once_with("update.zip")
zipfile_opened_with_password.setpassword.called_once_with("MyLongPassword") zipfile_opened_with_password.setpassword.assert_called_once_with("MyLongPassword")
zipfile_opened_with_password.extractall.assert_called_once() zipfile_opened_with_password.extractall.assert_called_once()
@pytest.mark.parametrize("system", [("Windows"), ("Darwin"), ("Linux")]) @pytest.mark.parametrize("system", [("Windows"), ("Darwin"), ("Linux")])