Example #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"))
Example #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")
Example #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'))
Example #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'))
Example #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'))
Example #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'))
Example #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'))
Example #8
0
 def test_is_valid_shell_windows(self):
     '''
     Tests return if running on windows
     '''
     self.assertTrue(cmdmod._is_valid_shell('foo'))
Example #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'))
Example #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'))
Example #11
0
 def test_is_valid_shell_windows(self):
     '''
     Tests return if running on windows
     '''
     self.assertTrue(cmdmod._is_valid_shell('foo'))
 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"))
 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"))
 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"))
 def test_is_valid_shell_windows(self):
     """
     Tests return if running on windows
     """
     self.assertTrue(cmdmod._is_valid_shell("foo"))
Example #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")
Example #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
Example #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'))