예제 #1
0
파일: test_mount.py 프로젝트: admd/salt-1
 def test_rm_fstab(self):
     '''
     Remove the mount point from the fstab
     '''
     mock_fstab = MagicMock(return_value={})
     with patch.dict(mount.__grains__, {'kernel': ''}):
         with patch.object(mount, 'fstab', mock_fstab):
             with patch('salt.utils.files.fopen', mock_open()):
                 self.assertTrue(mount.rm_fstab('name', 'device'))
예제 #2
0
def test_rm_fstab():
    """
    Remove the mount point from the fstab
    """
    mock_fstab = MagicMock(return_value={})
    with patch.dict(mount.__grains__, {"kernel": ""}):
        with patch.object(mount, "fstab", mock_fstab):
            with patch("salt.utils.files.fopen", mock_open()):
                assert mount.rm_fstab("name", "device")
예제 #3
0
파일: mount_test.py 프로젝트: bryson/salt
 def test_rm_fstab(self):
     """
     Remove the mount point from the fstab
     """
     mock_fstab = MagicMock(return_value={})
     with patch.dict(mount.__grains__, {"kernel": ""}):
         with patch.object(mount, "fstab", mock_fstab):
             with patch("salt.utils.fopen", mock_open()):
                 self.assertTrue(mount.rm_fstab("name", "device"))
예제 #4
0
파일: mount_test.py 프로젝트: DaveQB/salt
    def test_rm_fstab(self):
        """
        Remove the mount point from the fstab
        """
        mock = MagicMock(return_value={})
        with patch.object(mount, "fstab", mock):
            self.assertTrue(mount.rm_fstab("name", "device"))

        mock = MagicMock(return_value={"name": "name"})
        with patch.object(mount, "fstab", mock):
            with patch("salt.utils.fopen", mock_open()) as m_open:
                helper_open = m_open()
                helper_open.write.assertRaises(CommandExecutionError, mount.rm_fstab, config=None)
예제 #5
0
    def test_rm_fstab(self):
        '''
        Remove the mount point from the fstab
        '''
        mock = MagicMock(return_value={})
        with patch.object(mount, 'fstab', mock):
            self.assertTrue(mount.rm_fstab('name', 'device'))

        mock = MagicMock(return_value={'name': 'name'})
        with patch.object(mount, 'fstab', mock):
            with patch('salt.utils.fopen', mock_open()) as m_open:
                helper_open = m_open()
                helper_open.write.assertRaises(CommandExecutionError,
                                               mount.rm_fstab,
                                               config=None)
예제 #6
0
    def test_rm_fstab(self):
        '''
        Remove the mount point from the fstab
        '''
        mock_fstab = MagicMock(return_value={})
        with patch.object(mount, 'fstab', mock_fstab):
            with patch('salt.utils.fopen', mock_open()):
                self.assertTrue(mount.rm_fstab('name', 'device'))

        mock_fstab = MagicMock(return_value={'name': 'name'})
        with patch.object(mount, 'fstab', mock_fstab):
            with patch('salt.utils.fopen', mock_open()) as m_open:
                m_open.side_effect = IOError(13, 'Permission denied:', '/file')
                self.assertRaises(CommandExecutionError, mount.rm_fstab,
                                  'name', 'device')