Esempio n. 1
0
def test_filesystems():
    """
    List the content of 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 mount.filesystems() == {}

    file_data = textwrap.dedent("""\
        #
        /home:
                dev             = /dev/hd1
                vfs             = jfs2
                log             = /dev/hd8
                mount           = true
                check           = true
                vol             = /home
                free            = false
                quota           = no

        """)
    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)):
        fsyst = mount.filesystems()
        test_fsyst = {
            "/home": {
                "dev": "/dev/hd1",
                "vfs": "jfs2",
                "log": "/dev/hd8",
                "mount": "true",
                "check": "true",
                "vol": "/home",
                "free": "false",
                "quota": "no",
            }
        }
        assert test_fsyst == fsyst
Esempio n. 2
0
    def test_filesystems(self):
        '''
        List the content of 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.assertEqual(mount.filesystems(), {})

        file_data = textwrap.dedent('''\
            #
            /home:
                    dev             = /dev/hd1
                    vfs             = jfs2
                    log             = /dev/hd8
                    mount           = true
                    check           = true
                    vol             = /home
                    free            = false
                    quota           = no

            ''')
        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)):
            fsyst = mount.filesystems()
            test_fsyst = {
                '/home': {
                    'dev': '/dev/hd1',
                    'vfs': 'jfs2',
                    'log': '/dev/hd8',
                    'mount': 'true',
                    'check': 'true',
                    'vol': '/home',
                    'free': 'false',
                    'quota': 'no'
                }
            }
            self.assertEqual(test_fsyst, fsyst)