Beispiel #1
0
 def test__set_default(self):
     '''
     Test setting a subvolume as the current default.
     '''
     salt_mock = {
         'btrfs.subvolume_show': MagicMock(return_value={
             '@/var': {'subvolume id': '256'},
         }),
         'btrfs.subvolume_set_default': MagicMock(return_value=True),
     }
     with patch.dict(btrfs.__salt__, salt_mock):
         assert btrfs._set_default('/tmp/xxx/@/var', '/tmp/xxx', '@/var')
         salt_mock['btrfs.subvolume_show'].assert_called_with('/tmp/xxx/@/var')
         salt_mock['btrfs.subvolume_set_default'].assert_called_with('256', '/tmp/xxx')
Beispiel #2
0
def test__set_default():
    """
    Test setting a subvolume as the current default.
    """
    salt_mock = {
        "btrfs.subvolume_show":
        MagicMock(return_value={"@/var": {
            "subvolume id": "256"
        }}),
        "btrfs.subvolume_set_default":
        MagicMock(return_value=True),
    }
    with patch.dict(btrfs.__salt__, salt_mock):
        assert btrfs._set_default("/tmp/xxx/@/var", "/tmp/xxx", "@/var")
        salt_mock["btrfs.subvolume_show"].assert_called_with("/tmp/xxx/@/var")
        salt_mock["btrfs.subvolume_set_default"].assert_called_with(
            "256", "/tmp/xxx")