# Path: zfs_autobackup/LogStub.py
# class LogStub:
#     """Just a stub, usually overriden in subclasses."""
# 
#     # simple logging stubs
#     def debug(self, txt):
#         print("DEBUG  : " + txt)
# 
#     def verbose(self, txt):
#         print("VERBOSE: " + txt)
# 
#     def warning(self, txt):
#         print("WARNING: " + txt)
# 
#     def error(self, txt):
#         print("ERROR  : " + txt)
# 
# Path: zfs_autobackup/ExecuteNode.py
# class ExecuteError(Exception):
#     pass


from basetest import *
from zfs_autobackup.LogStub import LogStub
from zfs_autobackup.ExecuteNode import ExecuteError


class TestZfsNode(unittest2.TestCase):

    def setUp(self):
        prepare_zpools()
        # return super().setUp()

    def test_consistent_snapshot(self):
        logger = LogStub()
        description = "[Source]"
        node = ZfsNode(snapshot_time_format="test-%Y%m%d%H%M%S", hold_name="zfs_autobackup:test", logger=logger, description=description)

        with self.subTest("first snapshot"):
            node.consistent_snapshot(node.selected_datasets(property_name="autobackup:test",exclude_paths=[], exclude_received=False, exclude_unchanged=False, min_change=200000), "test-20101111000001", 100000)

# Path: zfs_autobackup/LogStub.py
# class LogStub:
#     """Just a stub, usually overriden in subclasses."""
# 
#     # simple logging stubs
#     def debug(self, txt):
#         print("DEBUG  : " + txt)
# 
#     def verbose(self, txt):
#         print("VERBOSE: " + txt)
# 
#     def warning(self, txt):
#         print("WARNING: " + txt)
# 
#     def error(self, txt):
#         print("ERROR  : " + txt)
# 
# Path: zfs_autobackup/ExecuteNode.py
# class ExecuteError(Exception):
#     pass


# Path: tests/test_zfsnode.py
from basetest import *
from zfs_autobackup.LogStub import LogStub
from zfs_autobackup.ExecuteNode import ExecuteError



class TestZfsNode(unittest2.TestCase):

    def setUp(self):
        prepare_zpools()
        # return super().setUp()

    def test_consistent_snapshot(self):
        logger = LogStub()
        description = "[Source]"
        node = ZfsNode(snapshot_time_format="test-%Y%m%d%H%M%S", hold_name="zfs_autobackup:test", logger=logger, description=description)

        with self.subTest("first snapshot"):
            node.consistent_snapshot(node.selected_datasets(property_name="autobackup:test",exclude_paths=[], exclude_received=False, exclude_unchanged=False, min_change=200000), "test-20101111000001", 100000)

            r = shelltest("zfs list -H -o name -r -t all " + TEST_POOLS)