def test_subvolume_create_fails_parameters(self): ''' Test btrfs subvolume create ''' # Fails when qgroupids is not a list with pytest.raises(CommandExecutionError): btrfs.subvolume_create('var', qgroupids='1')
def test_subvolume_create_fails_parameters(self): """ Test btrfs subvolume create """ # Fails when qgroupids is not a list with pytest.raises(CommandExecutionError): btrfs.subvolume_create("var", qgroupids="1")
def test_subvolume_create(self, subvolume_exists): ''' Test btrfs subvolume create ''' subvolume_exists.return_value = False salt_mock = { 'cmd.run_all': MagicMock(return_value={'recode': 0}), } with patch.dict(btrfs.__salt__, salt_mock): assert btrfs.subvolume_create('var', dest='/mnt') subvolume_exists.assert_called_once() salt_mock['cmd.run_all'].assert_called_once() salt_mock['cmd.run_all'].assert_called_with( ['btrfs', 'subvolume', 'create', '/mnt/var'])
def test_subvolume_create(self, subvolume_exists): """ Test btrfs subvolume create """ subvolume_exists.return_value = False salt_mock = { "cmd.run_all": MagicMock(return_value={"recode": 0}), } with patch.dict(btrfs.__salt__, salt_mock): assert btrfs.subvolume_create("var", dest="/mnt") subvolume_exists.assert_called_once() salt_mock["cmd.run_all"].assert_called_once() salt_mock["cmd.run_all"].assert_called_with( ["btrfs", "subvolume", "create", "/mnt/var"])
def test_subvolume_create_already_exists(self, subvolume_exists): ''' Test btrfs subvolume create ''' subvolume_exists.return_value = True assert not btrfs.subvolume_create('var', dest='/mnt')
def test_subvolume_create_already_exists(self, subvolume_exists): """ Test btrfs subvolume create """ subvolume_exists.return_value = True assert not btrfs.subvolume_create("var", dest="/mnt")