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"))
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")
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'))
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'))
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'))
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"))
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")
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