Exemple #1
0
 def test_list__valid_unit_chs_valid_cmd_output(self):
     with patch('salt.modules.parted_partition._validate_device', MagicMock()):
         self.cmdrun_stdout.return_value = self.parted_print_output('valid chs')
         output = parted.list_('/dev/sda', unit='chs')
         self.cmdrun_stdout.assert_called_once_with('parted -m -s /dev/sda unit chs print')
         expected = {
             'info': {
                 'logical sector': '512',
                 'physical sector': '512',
                 'interface': 'scsi',
                 'model': 'AMCC 9650SE-24M DISK',
                 'disk': '/dev/sda',
                 'disk flags': '',
                 'partition table': 'gpt',
                 'size': '3133,0,2'
             },
             'partitions': {
                 '1': {
                     'end': '2431,134,43',
                     'number': '1',
                     'start': '0,0,34',
                     'file system': 'ext3',
                     'flags': 'boot',
                     'name': ''},
                 '2': {
                     'end': '2492,80,42',
                     'number': '2',
                     'start': '2431,134,44',
                     'file system': 'linux-swap(v1)',
                     'flags': '',
                     'name': ''}
             }
         }
         self.assertEqual(output, expected)
 def test_list__empty_cmd_output(self):
     with patch("salt.modules.parted_partition._validate_device", MagicMock()):
         self.cmdrun_stdout.return_value = self.parted_print_output("empty")
         output = parted.list_("/dev/sda")
         self.cmdrun_stdout.assert_called_once_with("parted -m -s /dev/sda print")
         expected = {"info": {}, "partitions": {}}
         self.assertEqual(output, expected)
Exemple #3
0
 def test_list__valid_unit_empty_cmd_output(self):
     with patch('salt.modules.parted_partition._validate_device', MagicMock()):
         self.cmdrun_stdout.return_value = self.parted_print_output('empty')
         output = parted.list_('/dev/sda', unit='s')
         self.cmdrun_stdout.assert_called_once_with('parted -m -s /dev/sda unit s print')
         expected = {'info': {}, 'partitions': {}}
         self.assertEqual(output, expected)
 def test_list__valid_legacy_cmd_output(self):
     with patch('salt.modules.parted_partition._validate_device',
                MagicMock()):
         self.cmdrun_stdout.return_value = self.parted_print_output(
             'valid_legacy')
         output = parted.list_('/dev/sda')
         self.cmdrun_stdout.assert_called_once_with(
             'parted -m -s /dev/sda print')
         expected = {
             'info': {
                 'logical sector': '512',
                 'physical sector': '512',
                 'interface': 'scsi',
                 'model': 'AMCC 9650SE-24M DISK',
                 'disk': '/dev/sda',
                 'partition table': 'gpt',
                 'size': '4000GB'
             },
             'partitions': {
                 '1': {
                     'end': '150MB',
                     'number': '1',
                     'start': '17.4kB',
                     'file system': 'ext3',
                     'flags': 'boot',
                     'name': '',
                     'size': '150MB'
                 },
                 '2': {
                     'end': '4000GB',
                     'number': '2',
                     'start': '3921GB',
                     'file system': 'linux-swap(v1)',
                     'flags': '',
                     'name': '',
                     'size': '79.3GB'
                 }
             }
         }
         self.assertEqual(output, expected)
Exemple #5
0
 def test_list__valid_unit_valid_legacy_cmd_output(self):
     with patch("salt.modules.parted_partition._validate_device",
                MagicMock()):
         self.cmdrun_stdout.return_value = self.parted_print_output(
             "valid_legacy")
         output = parted.list_("/dev/sda", unit="s")
         self.cmdrun_stdout.assert_called_once_with(
             "parted -m -s /dev/sda unit s print")
         expected = {
             "info": {
                 "logical sector": "512",
                 "physical sector": "512",
                 "interface": "scsi",
                 "model": "AMCC 9650SE-24M DISK",
                 "disk": "/dev/sda",
                 "partition table": "gpt",
                 "size": "4000GB",
             },
             "partitions": {
                 "1": {
                     "end": "150MB",
                     "number": "1",
                     "start": "17.4kB",
                     "file system": "ext3",
                     "flags": "boot",
                     "name": "",
                     "size": "150MB",
                 },
                 "2": {
                     "end": "4000GB",
                     "number": "2",
                     "start": "3921GB",
                     "file system": "linux-swap(v1)",
                     "flags": "",
                     "name": "",
                     "size": "79.3GB",
                 },
             },
         }
         self.assertEqual(output, expected)