Esempio n. 1
0
    def test_lvdisplay(self):
        """
        Return information about the logical volume(s)
        """
        mock = MagicMock(return_value={"retcode": 1})
        with patch.dict(linux_lvm.__salt__, {"cmd.run_all": mock}):
            self.assertDictEqual(linux_lvm.lvdisplay(), {})

        mock = MagicMock(
            return_value={"retcode": 0, "stdout": "A:B:C:D:E:F:G:H:I:J:K:L:M"}
        )
        with patch.dict(linux_lvm.__salt__, {"cmd.run_all": mock}):
            self.assertDictEqual(
                linux_lvm.lvdisplay(),
                {
                    "A": {
                        "Allocated Logical Extents": "I",
                        "Allocation Policy": "J",
                        "Current Logical Extents Associated": "H",
                        "Internal Logical Volume Number": "E",
                        "Logical Volume Access": "C",
                        "Logical Volume Name": "A",
                        "Logical Volume Size": "G",
                        "Logical Volume Status": "D",
                        "Major Device Number": "L",
                        "Minor Device Number": "M",
                        "Open Logical Volumes": "F",
                        "Read Ahead Sectors": "K",
                        "Volume Group Name": "B",
                    }
                },
            )
Esempio n. 2
0
    def test_lvdisplay(self):
        '''
        Return information about the logical volume(s)
        '''
        mock = MagicMock(return_value={'retcode': 1})
        with patch.dict(linux_lvm.__salt__, {'cmd.run_all': mock}):
            self.assertDictEqual(linux_lvm.lvdisplay(), {})

        mock = MagicMock(return_value={
            'retcode': 0,
            'stdout': 'A:B:C:D:E:F:G:H:I:J:K:L:M'
        })
        with patch.dict(linux_lvm.__salt__, {'cmd.run_all': mock}):
            self.assertDictEqual(
                linux_lvm.lvdisplay(), {
                    'A': {
                        'Allocated Logical Extents': 'I',
                        'Allocation Policy': 'J',
                        'Current Logical Extents Associated': 'H',
                        'Internal Logical Volume Number': 'E',
                        'Logical Volume Access': 'C',
                        'Logical Volume Name': 'A',
                        'Logical Volume Size': 'G',
                        'Logical Volume Status': 'D',
                        'Major Device Number': 'L',
                        'Minor Device Number': 'M',
                        'Open Logical Volumes': 'F',
                        'Read Ahead Sectors': 'K',
                        'Volume Group Name': 'B'
                    }
                })
Esempio n. 3
0
    def test__lvdisplay(self):
        '''
        Return information about the logical volume(s)
        '''
        mock = MagicMock(return_value={'retcode': 1})
        with patch.dict(linux_lvm.__salt__, {'cmd.run_all': mock}):
            self.assertDictEqual(linux_lvm.lvdisplay(), {})

        mock = MagicMock(return_value={'retcode': 0,
                                       'stdout': 'A:B:C:D:E:F:G:H:I:J:K:L:M'})
        with patch.dict(linux_lvm.__salt__, {'cmd.run_all': mock}):
            self.assertDictEqual(linux_lvm.lvdisplay(),
                                 {'A': {'Allocated Logical Extents': 'I',
                                        'Allocation Policy': 'J',
                                        'Current Logical Extents Associated': 'H',
                                        'Internal Logical Volume Number': 'E',
                                        'Logical Volume Access': 'C',
                                        'Logical Volume Name': 'A',
                                        'Logical Volume Size': 'G',
                                        'Logical Volume Status': 'D',
                                        'Major Device Number': 'L',
                                        'Minor Device Number': 'M',
                                        'Open Logical Volumes': 'F',
                                        'Read Ahead Sectors': 'K',
                                        'Volume Group Name': 'B'}})