Exemplo n.º 1
0
 def test_is_valid_shell_unavailable(self):
     """
     Tests return when provided shell is not available
     """
     with patch("os.path.exists", MagicMock(return_value=True)):
         with patch("salt.utils.files.fopen",
                    mock_open(read_data=MOCK_SHELL_FILE)):
             self.assertFalse(cmdmod._is_valid_shell("foo"))
Exemplo n.º 2
0
def test_is_valid_shell_available():
    """
    Tests return when provided shell is available
    """
    with patch("os.path.exists", MagicMock(return_value=True)):
        with patch("salt.utils.files.fopen",
                   mock_open(read_data=MOCK_SHELL_FILE)):
            assert cmdmod._is_valid_shell("/bin/bash")
Exemplo n.º 3
0
 def test_is_valid_shell_none(self):
     '''
     Tests return of when os.path.exists(/etc/shells) isn't available
     '''
     with patch('os.path.exists', MagicMock(return_value=False)):
         self.assertIsNone(cmdmod._is_valid_shell('foo'))
Exemplo n.º 4
0
 def test_is_valid_shell_windows(self):
     '''
     Tests return if running on windows
     '''
     with patch('salt.utils.platform.is_windows', MagicMock(return_value=True)):
         self.assertTrue(cmdmod._is_valid_shell('foo'))
Exemplo n.º 5
0
 def test_is_valid_shell_unavailable(self):
     '''
     Tests return when provided shell is not available
     '''
     with patch('salt.utils.fopen', mock_open(read_data=MOCK_SHELL_FILE)):
         self.assertFalse(cmdmod._is_valid_shell('foo'))
Exemplo n.º 6
0
 def test_is_valid_shell_available(self):
     '''
     Tests return when provided shell is available
     '''
     with patch('salt.utils.fopen', mock_open(read_data=MOCK_SHELL_FILE)):
         self.assertTrue(cmdmod._is_valid_shell('/bin/bash'))
Exemplo n.º 7
0
 def test_is_valid_shell_none(self):
     '''
     Tests return of when os.path.exists(/etc/shells) isn't available
     '''
     self.assertIsNone(cmdmod._is_valid_shell('foo'))
Exemplo n.º 8
0
 def test_is_valid_shell_windows(self):
     '''
     Tests return if running on windows
     '''
     self.assertTrue(cmdmod._is_valid_shell('foo'))
Exemplo n.º 9
0
 def test_is_valid_shell_available(self):
     '''
     Tests return when provided shell is available
     '''
     with patch('salt.utils.fopen', mock_open(read_data=MOCK_SHELL_FILE)):
         self.assertTrue(cmdmod._is_valid_shell('/bin/bash'))
Exemplo n.º 10
0
 def test_is_valid_shell_none(self):
     '''
     Tests return of when os.path.exists(/etc/shells) isn't available
     '''
     self.assertIsNone(cmdmod._is_valid_shell('foo'))
Exemplo n.º 11
0
 def test_is_valid_shell_windows(self):
     '''
     Tests return if running on windows
     '''
     self.assertTrue(cmdmod._is_valid_shell('foo'))
Exemplo n.º 12
0
 def test_is_valid_shell_unavailable(self):
     """
     Tests return when provided shell is not available
     """
     with patch("salt.utils.fopen", mock_open(read_data=MOCK_SHELL_FILE)):
         self.assertFalse(cmdmod._is_valid_shell("foo"))
Exemplo n.º 13
0
 def test_is_valid_shell_available(self):
     """
     Tests return when provided shell is available
     """
     with patch("salt.utils.fopen", mock_open(read_data=MOCK_SHELL_FILE)):
         self.assertTrue(cmdmod._is_valid_shell("/bin/bash"))
Exemplo n.º 14
0
 def test_is_valid_shell_none(self):
     """
     Tests return of when os.path.exists(/etc/shells) isn't available
     """
     self.assertIsNone(cmdmod._is_valid_shell("foo"))
Exemplo n.º 15
0
 def test_is_valid_shell_windows(self):
     """
     Tests return if running on windows
     """
     self.assertTrue(cmdmod._is_valid_shell("foo"))
Exemplo n.º 16
0
def test_is_valid_shell_windows():
    """
    Tests return if running on windows
    """
    with patch("salt.utils.platform.is_windows", MagicMock(return_value=True)):
        assert cmdmod._is_valid_shell("foo")
Exemplo n.º 17
0
def test_is_valid_shell_none():
    """
    Tests return of when os.path.exists(/etc/shells) isn't available
    """
    with patch("os.path.exists", MagicMock(return_value=False)):
        assert cmdmod._is_valid_shell("foo") is None
Exemplo n.º 18
0
 def test_is_valid_shell_unavailable(self):
     '''
     Tests return when provided shell is not available
     '''
     with patch('salt.utils.fopen', mock_open(read_data=MOCK_SHELL_FILE)):
         self.assertFalse(cmdmod._is_valid_shell('foo'))