예제 #1
0
class TestMountParser(CiTestCase):
    def setUp(self):
        super(TestMountParser, self).setUp()
        self.probe_data = _get_data('probert_storage_diglett.json')
        self.mountp = MountParser(self.probe_data)

    def test_mount_parser(self):
        """ MountParser 'class_data' on instance matches input. """
        self.assertEqual(self.probe_data['mount'], self.mountp.class_data)

    def test_mount_asdict(self):
        source_mount = {
            'fstype': 'ext4',
            'options': 'rw,relatime',
            'source': '/dev/bcache0',
            'target': '/'
        }
        expected_dict = {
            'type': 'mount',
            'id': 'mount-disk-bcache0',
            'path': '/',
            'device': 'format-disk-bcache0'
        }
        self.assertDictEqual(expected_dict, self.mountp.asdict(source_mount))

    @skipUnlessJsonSchema()
    def test_mount_parser_parses_all_blockdev_mounts(self):
        """ MountParser returns expected dicts for known mount probe data."""
        configs, errors = self.mountp.parse()
        self.assertEqual(4, len(configs))
        self.assertEqual(0, len(errors))
예제 #2
0
 def setUp(self):
     super(TestMountParser, self).setUp()
     self.probe_data = _get_data('probert_storage_diglett.json')
     self.mountp = MountParser(self.probe_data)