def test3_extract_installer(self, mock_which, mock_subprocess): mock_which.return_value = True mock_subprocess().returncode = 0 mock_subprocess().communicate.return_value = [b"stdout", b"stderr"] game = Game("Absolute Drift", install_dir="/home/makson/GOG Games/Absolute Drift", platform="windows") installer_path = "/home/makson/.cache/minigalaxy/download/Absolute Drift/setup_absolute_drift_1.0f_(64bit)_(47863).exe" temp_dir = "/home/makson/.cache/minigalaxy/extract/1136126792" exp = "" obs = installer.extract_installer(game, installer_path, temp_dir) self.assertEqual(exp, obs)
def test2_extract_installer(self, mock_subprocess, mock_listdir, mock_is_file): mock_is_file.return_value = True mock_subprocess().returncode = 2 mock_subprocess().communicate.return_value = [b"stdout", b"stderr"] mock_listdir.return_value = ["object1", "object2"] game = Game("Beneath A Steel Sky", install_dir="/home/makson/GOG Games/Beneath a Steel Sky") installer_path = "/home/makson/.cache/minigalaxy/download/Beneath a Steel Sky/beneath_a_steel_sky_en_gog_2_20150.sh" temp_dir = "/home/makson/.cache/minigalaxy/extract/1207658695" exp = "The installation of /home/makson/.cache/minigalaxy/download/Beneath a Steel Sky/beneath_a_steel_sky_en_gog_2_20150.sh failed. Please try again." obs = installer.extract_installer(game, installer_path, temp_dir) self.assertEqual(exp, obs)