Esempio n. 1
0
    def test_install_ruby(self):
        '''
        Test for install a ruby implementation.
        '''
        with patch.dict(rbenv.__grains__, {'os': 'FreeBSD'}):
            with patch.dict(rbenv.__salt__,
                            {'config.get': MagicMock(return_value='True')}):
                with patch.object(rbenv,
                                  '_rbenv_exec',
                                  return_value={
                                      'retcode': 0,
                                      'stderr': 'stderr'
                                  }):
                    with patch.object(rbenv, 'rehash', return_value=None):
                        self.assertEqual(rbenv.install_ruby('ruby'), 'stderr')

                with patch.object(rbenv,
                                  '_rbenv_exec',
                                  return_value={
                                      'retcode': 1,
                                      'stderr': 'stderr'
                                  }):
                    with patch.object(rbenv,
                                      'uninstall_ruby',
                                      return_value=None):
                        self.assertFalse(rbenv.install_ruby('ruby'))
Esempio n. 2
0
    def test_install_ruby(self):
        """
        Test for install a ruby implementation.
        """
        with patch.dict(rbenv.__grains__, {"os": "FreeBSD"}):
            with patch.dict(rbenv.__salt__,
                            {"config.get": MagicMock(return_value="True")}):
                with patch.object(
                        rbenv,
                        "_rbenv_exec",
                        return_value={
                            "retcode": 0,
                            "stderr": "stderr"
                        },
                ):
                    with patch.object(rbenv, "rehash", return_value=None):
                        self.assertEqual(rbenv.install_ruby("ruby"), "stderr")

                with patch.object(
                        rbenv,
                        "_rbenv_exec",
                        return_value={
                            "retcode": 1,
                            "stderr": "stderr"
                        },
                ):
                    with patch.object(rbenv,
                                      "uninstall_ruby",
                                      return_value=None):
                        self.assertFalse(rbenv.install_ruby("ruby"))
Esempio n. 3
0
    def test_install_ruby(self):
        """
        Test for install a ruby implementation.
        """
        with patch.dict(rbenv.__grains__, {"os": "FreeBSD"}):
            with patch.dict(rbenv.__salt__, {"config.get": MagicMock(return_value="True")}):
                with patch.object(rbenv, "_rbenv_exec", return_value={"retcode": 0, "stderr": "stderr"}):
                    with patch.object(rbenv, "rehash", return_value=None):
                        self.assertEqual(rbenv.install_ruby("ruby"), "stderr")

                with patch.object(rbenv, "_rbenv_exec", return_value={"retcode": 1, "stderr": "stderr"}):
                    with patch.object(rbenv, "uninstall_ruby", return_value=None):
                        self.assertFalse(rbenv.install_ruby("ruby"))
Esempio n. 4
0
    def test_install_ruby(self):
        '''
        Test for install a ruby implementation.
        '''
        with patch.dict(rbenv.__grains__, {'os': 'FreeBSD'}):
            with patch.dict(rbenv.__salt__,
                            {'config.get': MagicMock(return_value='True')}):
                with patch.object(rbenv, '_rbenv_exec',
                                  return_value={'retcode': 0,
                                                'stderr': 'stderr'}):
                    with patch.object(rbenv, 'rehash', return_value=None):
                        self.assertEqual(rbenv.install_ruby('ruby'), 'stderr')

                with patch.object(rbenv, '_rbenv_exec',
                                  return_value={'retcode': 1,
                                                'stderr': 'stderr'}):
                    with patch.object(rbenv, 'uninstall_ruby',
                                      return_value=None):
                        self.assertFalse(rbenv.install_ruby('ruby'))