class TestDecorateStrategy(TestCase):
    def setUp(self):
        self.root=MockRoot()
        self.default=Dummy()
        self.strategy=DecorateStrategy(self.root, self.default)

    def testInterface(self):
        verifyObject(INavtreeStrategy, self.strategy)

    def testShowAllParentAlwaysTrue(self):
        self.default.showAllParents=False
        self.assertEqual(self.strategy.showAllParents, True)

    def testRootPathSetToOurRoot(self):
        self.default.rootPath="this is wrong"
        self.assertEqual(self.strategy.rootPath, "/root")

    def testNodeFilterDelegates(self):
        self.default.nodeFilter=yes 
        self.assertEqual(self.strategy.nodeFilter(CreateNode("/root/child/baby")), True)
        self.default.nodeFilter=no 
        self.assertEqual(self.strategy.nodeFilter(CreateNode("/root/child/baby")), False)

    def testNodeFilterRejectsOutsideRoot(self):
        self.default.nodeFilter=yes 
        self.assertEqual(self.strategy.nodeFilter(CreateNode("/other/child/baby")), False)

    def testNodeFilterAcceptsRoot(self):
        self.default.nodeFilter=yes 
        self.assertEqual(self.strategy.nodeFilter(CreateNode("/root/child")), True)

    def testNodeFilterAcceptsRootsChildren(self):
        self.default.nodeFilter=yes 
        self.assertEqual(self.strategy.nodeFilter(CreateNode("/root/child/baby")), True)
 def setUp(self):
     self.root=MockRoot()
     self.default=Dummy()
     self.strategy=DecorateStrategy(self.root, self.default)