def testIsActive(self): """ Test to see if given node is active. is_active is tested earlier. This test makes sure it works in parsed case too. """ tabs = get_tabs() request = get_request("foo", "GET") self.assertEquals(tabs.is_active(request), False) request = get_request("/ilmoitustaulu/", "GET") self.assertEquals(tabs.is_active(request), True) node = tabs.next.child request = get_request("/suunnittelu/paiva/", "GET") self.assertEquals(node.is_active(request), True) node2 = tabs.next.child.next request = get_request("/foo/", "GET") self.assertEquals(node2.is_active(request), False) request = get_request("/suunnittelu/viikko/", "GET") self.assertEquals(node2.is_active(request), True)
def testGetPaths(self): """ Test to see if nodes return proper paths. get_path is tested earlier. This test operates on parsed structure which makes the case a bit different and hence worth testing. """ tabs = get_tabs() self.assertEquals(tabs.get_path(), "/noticeboard/") self.assertEquals(tabs.next.child.get_path(), "/planning/day/browse/") self.assertEquals(tabs.next.child.child.get_path(), "/planning/day/browse/")
def testGetTabs(self): """ Test to see if node names match, tab case. """ tabs = get_tabs() self.assertEquals(tabs.name, "noticeboard") self.assertEquals(tabs.next.name, "planning") self.assertEquals(tabs.next.prev.name, "noticeboard") self.assertEquals(tabs.next.child.name, "day") self.assertEquals(tabs.next.child.parent.name, "planning") self.assertEquals(tabs.next.child.child.name, "browse") self.assertEquals(tabs.next.child.next.name, "week")