Exemplo n.º 1
0
    def test_missing_taps(self, tmpdir, debug, verbose, installed, brewed):
        cider = Cider(False, debug, verbose, cider_dir=str(tmpdir))
        cider.brew = MagicMock()
        cider.brew.tap = MagicMock(return_value="\n".join(brewed))

        missing = set(brewed) - set(installed)
        assert cider.missing_taps() == sorted(missing)
Exemplo n.º 2
0
    def test_missing_taps(self, tmpdir, debug, verbose, installed, brewed):
        cider = Cider(False, debug, verbose, cider_dir=str(tmpdir))
        cider.brew = MagicMock()
        cider.brew.tap = MagicMock(return_value="\n".join(brewed))

        missing = set(brewed) - set(installed)
        assert cider.missing_taps() == sorted(missing)
Exemplo n.º 3
0
    def test_rm(self, tmpdir, cask, debug, verbose, formulas):
        cider = Cider(cask, debug, verbose, cider_dir=str(tmpdir))
        cider.brew = MagicMock()

        cider.rm(*formulas)
        cider.brew.rm.assert_called_once_with(*formulas)
        key = "casks" if cask else "formulas"
        for formula in formulas:
            assert formula not in cider.read_bootstrap().get(key, [])
Exemplo n.º 4
0
    def test_rm(self, tmpdir, cask, debug, verbose, formulas):
        cider = Cider(cask, debug, verbose, cider_dir=str(tmpdir))
        cider.brew = MagicMock()

        cider.rm(*formulas)
        cider.brew.rm.assert_called_once_with(*formulas)
        key = "casks" if cask else "formulas"
        for formula in formulas:
            assert formula not in cider.read_bootstrap().get(key, [])
Exemplo n.º 5
0
    def test_missing(self, tmpdir, cask, debug, verbose, installed, brewed):
        orphans = []

        def generate_uses():
            uses = {}
            for formula in brewed:
                subset = [x for x in installed if x != formula]
                if subset and random.choice([True, False]):
                    uses[formula] = random.sample(
                        subset, random.randint(1, len(subset)))
                else:
                    orphans.append(formula)

            return lambda x: uses.get(x, [])

        cider = Cider(cask, debug, verbose, cider_dir=str(tmpdir))
        cider.brew = MagicMock()
        cider.brew.ls = MagicMock(return_value=brewed)
        cider.brew.uses = MagicMock(side_effect=generate_uses())
        cider.installed = MagicMock(return_value=installed)

        assert cider.missing() == sorted(orphans)
Exemplo n.º 6
0
    def test_missing(self, tmpdir, cask, debug, verbose,
                     installed, brewed):
        orphans = []

        def generate_uses():
            uses = {}
            for formula in brewed:
                subset = [x for x in installed if x != formula]
                if subset and random.choice([True, False]):
                    uses[formula] = random.sample(subset, random.randint(
                        1, len(subset)
                    ))
                else:
                    orphans.append(formula)

            return lambda x: uses.get(x, [])

        cider = Cider(cask, debug, verbose, cider_dir=str(tmpdir))
        cider.brew = MagicMock()
        cider.brew.ls = MagicMock(return_value=brewed)
        cider.brew.uses = MagicMock(side_effect=generate_uses())
        cider.installed = MagicMock(return_value=installed)

        assert cider.missing() == sorted(orphans)
Exemplo n.º 7
0
 def test_untap(self, tmpdir, debug, verbose, tap):
     cider = Cider(False, debug, verbose, cider_dir=str(tmpdir))
     cider.brew = MagicMock()
     cider.untap(tap)
     cider.brew.untap.assert_called_with(tap)
     assert tap not in cider.read_bootstrap().get("taps", [])
Exemplo n.º 8
0
 def test_untap(self, tmpdir, debug, verbose, tap):
     cider = Cider(False, debug, verbose, cider_dir=str(tmpdir))
     cider.brew = MagicMock()
     cider.untap(tap)
     cider.brew.untap.assert_called_with(tap)
     assert tap not in cider.read_bootstrap().get("taps", [])