def test_pv_disp_parser(self): input_test = """PV:VG:PSize:PE:Alloc:PV UUID:Ext:Free /dev/mapper/luks-92ee4956-3fd1-47fa-a603-9b8ad867f66d:fedora\ :319543050.24K:76185:76169:Yce0X3-H5vz-65P3-u7Fk-s7Nv-G903-4QJDnb:4194.\ 30K:16""" pv_out = utils.parse_pvdisplay_output(input_test, True) self.assertEqual(pv_out['VG Name'], 'fedora') self.assertEqual(pv_out['PV Size'], 319543050.24) self.assertEqual(pv_out['Allocatable'], 'N/A') self.assertEqual(pv_out['PV UUID'], 'Yce0X3-H5vz-65P3-u7Fk-s7Nv-G903-4QJDnb')
def test_pv_disp_parser(self): input_test = """--- NEW Physical volume --- PV Name /dev/sdb1 VG Name PV Size 20.00 MiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID NMLPlg-ozfg-pFuJ-Q0ld-rvqb-KAda-4MywSM""" pv_out = utils.parse_pvdisplay_output(input_test) self.assertEqual(pv_out['PV Name'], '/dev/sdb1') self.assertEqual(pv_out['PV Size'], '20.00 MiB') self.assertEqual(pv_out['Allocatable'], 'NO') self.assertEqual(pv_out['PV UUID'], 'NMLPlg-ozfg-pFuJ-Q0ld-rvqb-KAda-4MywSM')