Example #1
0
 def test_remove_installer_no_installer(self):
     """
     No installer present
     """
     game1 = Game("Beneath A Steel Sky", install_dir="/home/test/GOG Games/Beneath a Steel Sky", platform="linux")
     installer_path = "/home/i/.cache/minigalaxy/download/Beneath a Steel Sky/beneath_a_steel_sky_en_gog_2_20150.sh"
     obs = installer.remove_installer(game1, installer_path)
     exp = "No installer directory is present: /home/i/.cache/minigalaxy/download/Beneath a Steel Sky"
     self.assertEqual(obs, exp)
Example #2
0
    def test_remove_installer_same_content(self, mock_os_path_isdir, mock_compare_directories, mock_config, mock_shutil_rmtree, mock_os_remove):
        """
        Same content of installer and keep dir
        """
        mock_os_path_isdir.return_value = True
        mock_compare_directories.return_value = True
        mock_config.side_effect = [True, "/home/i/GOG Games/installer"]

        game1 = Game("Beneath A Steel Sky", install_dir="/home/test/GOG Games/Beneath a Steel Sky", platform="linux")
        installer_path = "/home/i/.cache/minigalaxy/download/Beneath a Steel Sky/beneath_a_steel_sky_en_gog_2_20150.sh"
        obs = installer.remove_installer(game1, installer_path)
        assert not mock_shutil_rmtree.called
        assert not mock_os_remove.called
        self.assertEqual(obs, "")
Example #3
0
    def test_remove_installer_from_keep(self, mock_os_path_isdir, mock_compare_directories, mock_config, mock_shutil_rmtree, mock_shutil_move, mock_os_remove):
        """
        Called from keep dir
        """
        mock_os_path_isdir.return_value = True
        mock_compare_directories.return_value = False
        mock_config.side_effect = [True, "/home/i/GOG Games"]

        game1 = Game("Beneath A Steel Sky", install_dir="/home/test/GOG Games/Beneath A Steel Sky", platform="linux")
        installer_path = "/home/i/GOG Games/installer/Beneath A Steel Sky/beneath_a_steel_sky_en_gog_2_20150.sh"
        obs = installer.remove_installer(game1, installer_path)
        assert not mock_shutil_rmtree.called
        assert not mock_shutil_move.called
        assert not mock_os_remove.called
        self.assertEqual(obs, "")
Example #4
0
    def test_remove_installer_no_keep(self, mock_list_dir, mock_os_remove, mock_shutil_rmtree, mock_config, mock_compare_directories, mock_os_path_isdir):
        """
        Disabled keep_installer
        """
        mock_os_path_isdir.return_value = True
        mock_compare_directories.return_value = False
        mock_config.return_value = False
        mock_list_dir.return_value = ["beneath_a_steel_sky_en_gog_2_20150.sh"]

        game1 = Game("Beneath A Steel Sky", install_dir="/home/test/GOG Games/Beneath a Steel Sky", platform="linux")
        installer_path = "/home/i/.cache/minigalaxy/download/Beneath a Steel Sky/beneath_a_steel_sky_en_gog_2_20150.sh"
        obs = installer.remove_installer(game1, installer_path)
        assert mock_os_remove.called
        assert not mock_shutil_rmtree.called
        self.assertEqual(obs, "")