4 class TestRight(unittest.TestCase):
8 def testRightInit(self):
10 self.assertEqual(right.kind, "embed")
12 def testRightCanPerform(self):
13 right = Right("embed")
14 self.assert_(right.can_perform("getticket"))
15 self.assert_(not right.can_perform("resolve"))
17 class TestRightList(unittest.TestCase):
22 # create a blank right list
23 rightList = RightList()
25 # create a right list with "embed" in it
26 rightList = RightList(string="embed")
28 def testAsString(self):
29 rightList = RightList()
30 self.assertEqual(rightList.save_to_string(), "")
32 rightList = RightList(string="embed")
33 self.assertEqual(rightList.save_to_string(), "embed")
35 rightList = RightList(string="embed,resolve")
36 self.assertEqual(rightList.save_to_string(), "embed,resolve")
38 def testCanPerform(self):
39 rightList = RightList(string="embed")
40 self.assert_(rightList.can_perform("getticket"))
41 self.assert_(not rightList.can_perform("resolve"))
43 rightList = RightList(string="embed,resolve")
44 self.assert_(rightList.can_perform("getticket"))
45 self.assert_(rightList.can_perform("resolve"))
48 if __name__ == "__main__":