Exemplo n.º 1
0
 def test_config_simple(self):
     vol = base.Base(device='/dev/sda1',
                     mpoint='/',
                     size=100,
                     fscreated=False)
     config = vol.config()
     assert config.get('device') == '/dev/sda1'
     assert config.get('mpoint') == '/'
Exemplo n.º 2
0
 def test_config_nested(self):
     vol = base.Base(device='/dev/mapper/lxc-host1',
                     pv_disks=['/dev/sdb',
                               base.Base(device='/dev/sdc')],
                     vg='lxc',
                     name='host1',
                     options={
                         'extent_size': 4,
                         'log_disk': base.Base(fstype='tmpfs')
                     })
     config = vol.config()
     assert 'pv_disks' in config
     assert len(config['pv_disks']) == 2
     assert type(config['pv_disks'][1]) == dict
     assert 'options' in config
     assert type(config['options']) == dict
     assert 'log_disk' in config['options']
     assert config['options']['log_disk']['fstype'] == 'tmpfs'
Exemplo n.º 3
0
 def test_set_attr(self):
     vol = base.Base()
     vol.custom = 15
     assert vol.custom == 15
Exemplo n.º 4
0
 def test_get_attr_unknown(self):
     vol = base.Base()
     vol.unknown_attr
Exemplo n.º 5
0
 def test_get_attr(self):
     vol = base.Base(custom=512)
     assert hasattr(vol, 'config'), 'Has config attribute'
     assert hasattr(vol, 'custom'), 'Has custom attribute'
     assert vol.custom == 512, 'Custom attribute value stored well'
     assert hasattr(vol, '_dictify'), 'Has function attribute'