示例#1
0
 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')
示例#2
0
 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")
示例#3
0
 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'])
示例#4
0
 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"])
示例#5
0
 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')
示例#6
0
 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")