コード例 #1
0
ファイル: test_mount.py プロジェクト: nicholasmhughes/salt
def test_rm_filesystems():
    """
    Remove the mount point from the filesystems
    """
    file_data = textwrap.dedent("""\
        #

        """)
    mock = MagicMock(return_value=True)
    with patch.dict(mount.__grains__, {
            "os": "AIX",
            "kernel": "AIX"
    }), patch.object(os.path, "isfile",
                     mock), patch("salt.utils.files.fopen",
                                  mock_open(read_data=file_data)):
        assert not mount.rm_filesystems("name", "device")

    file_data = textwrap.dedent("""\
        #
        /name:
                dev             = device
                vol             = /name

        """)

    mock = MagicMock(return_value=True)
    mock_fsyst = MagicMock(return_value=True)
    with patch.dict(mount.__grains__, {
            "os": "AIX",
            "kernel": "AIX"
    }), patch.object(os.path, "isfile",
                     mock), patch("salt.utils.files.fopen",
                                  mock_open(read_data=file_data)):
        assert mount.rm_filesystems("/name", "device")
コード例 #2
0
    def test_rm_filesystems(self):
        '''
        Remove the mount point from the filesystems
        '''
        file_data = textwrap.dedent('''\
            #

            ''')
        mock = MagicMock(return_value=True)
        with patch.dict(mount.__grains__, {'os': 'AIX', 'kernel': 'AIX'}), \
                patch.object(os.path, 'isfile', mock), \
                patch('salt.utils.files.fopen', mock_open(read_data=file_data)):
            self.assertFalse(mount.rm_filesystems('name', 'device'))

        file_data = textwrap.dedent('''\
            #
            /name:
                    dev             = device
                    vol             = /name

            ''')

        mock = MagicMock(return_value=True)
        mock_fsyst = MagicMock(return_value=True)
        with patch.dict(mount.__grains__, {'os': 'AIX', 'kernel': 'AIX'}), \
                patch.object(os.path, 'isfile', mock), \
                patch('salt.utils.files.fopen', mock_open(read_data=file_data)):
            self.assertTrue(mount.rm_filesystems('/name', 'device'))