Ejemplo n.º 1
0
    def test_dont_disable_apt_run_if_already_disabled(self):
        apt_run = AptRun()
        apt_run.set_folder(AptRunTests.TEST_FOLDER)

        result = apt_run.disable()

        self.assertFalse(result)
Ejemplo n.º 2
0
    def test_enable_apt_run(self):
        apt_run = AptRun()
        apt_run.set_folder(AptRunTests.TEST_FOLDER)

        apt_run.enable()
        result = apt_run.is_enable()

        self.assertTrue(result)
Ejemplo n.º 3
0
    def test_disable_apt_run(self):
        apt_run = AptRun()
        apt_run.set_folder(AptRunTests.TEST_FOLDER)

        os.makedirs(AptRunTests.TEST_FOLDER)
        apt_run.disable()
        result = apt_run.is_enable()

        self.assertFalse(result)
Ejemplo n.º 4
0
    def test_post_invoke(self, mock_user_pkgs):
        mock_user_pkgs.return_value = ['vim', 'gedit']

        apt_run = AptRun()
        apt_run.set_folder(AptRunTests.TEST_FOLDER)
        apt_run.enable()

        with open(apt_run.installed_pkgs_file, 'w') as text:
            text.write('gedit')

        installed_pkgs = apt_run.post_invoke()

        self.assertEqual(['vim'], installed_pkgs)
Ejemplo n.º 5
0
    def test_pre_install_pkgs(self):
        apt_run = AptRun()
        apt_run.set_folder(AptRunTests.TEST_FOLDER)
        apt_run.enable()
        apt_run.pre_install_pkgs()

        user = LocalSystem()
        assert_pkgs = user.pkg_profile

        pkgs = []
        with open(apt_run.installed_pkgs_file, 'r') as text:
            pkgs = [line.strip() for line in text]

        self.assertListEqual(assert_pkgs, pkgs)