Ejemplo n.º 1
0
def test_install_already_there():
    source = "/foo/bar/fubar.pkg"
    package_id = "com.foo.fubar.pkg"

    with patch("salt.modules.mac_pkgutil.is_installed", return_value=True):
        with patch("salt.modules.mac_pkgutil._install_from_path",
                   return_value=True) as _install_from_path:
            mac_pkgutil.install(source, package_id)

    assert _install_from_path.called == 0
Ejemplo n.º 2
0
def test_install():
    source = "/foo/bar/fubar.pkg"
    package_id = "com.foo.fubar.pkg"

    with patch("salt.modules.mac_pkgutil.is_installed", return_value=False):
        with patch("salt.modules.mac_pkgutil._install_from_path",
                   return_value=True) as _install_from_path:
            mac_pkgutil.install(source, package_id)

    _install_from_path.assert_called_with(source)
Ejemplo n.º 3
0
    def test_install_already_there(self):
        # Given
        source = "/foo/bar/fubar.pkg"
        package_id = "com.foo.fubar.pkg"

        # When
        with patch("salt.modules.mac_pkgutil.is_installed", return_value=True):
            with patch("salt.modules.mac_pkgutil._install_from_path",
                       return_value=True) as _install_from_path:
                mac_pkgutil.install(source, package_id)

        # Then
        self.assertEqual(_install_from_path.called, 0)
Ejemplo n.º 4
0
    def test_install(self):
        # Given
        source = '/foo/bar/fubar.pkg'
        package_id = 'com.foo.fubar.pkg'

        # When
        with patch('salt.modules.mac_pkgutil.is_installed',
                   return_value=False):
            with patch('salt.modules.mac_pkgutil._install_from_path',
                       return_value=True) as _install_from_path:
                mac_pkgutil.install(source, package_id)

        # Then
        _install_from_path.assert_called_with(source)
Ejemplo n.º 5
0
    def test_install_already_there(self):
        # Given
        source = "/foo/bar/fubar.pkg"
        package_id = "com.foo.fubar.pkg"

        # When
        with patch("salt.modules.mac_pkgutil.is_installed",
                   return_value=True):
            with patch("salt.modules.mac_pkgutil._install_from_path",
                       return_value=True) as _install_from_path:
                mac_pkgutil.install(source, package_id)

        # Then
        self.assertEqual(_install_from_path.called, 0)
Ejemplo n.º 6
0
    def test_install(self):
        # Given
        source = "/foo/bar/fubar.pkg"
        package_id = "com.foo.fubar.pkg"

        # When
        with patch("salt.modules.mac_pkgutil.is_installed",
                   return_value=False):
            with patch("salt.modules.mac_pkgutil._install_from_path",
                       return_value=True) as _install_from_path:
                mac_pkgutil.install(source, package_id)

        # Then
        _install_from_path.assert_called_with(source)
Ejemplo n.º 7
0
    def test_install(self):
        # Given
        source = "/foo/bar/fubar.pkg"
        package_id = "com.foo.fubar.pkg"

        # When
        mock_cmd = MagicMock(return_value=True)
        with patch("salt.modules.mac_pkgutil.is_installed",
                   return_value=False) as is_installed:
            with patch("salt.modules.mac_pkgutil._install_from_path",
                       return_value=True) as _install_from_path:
                ret = mac_pkgutil.install(source, package_id)

        # Then
        _install_from_path.assert_called_with(source)