3 from gackscalendar import *
5 class TestGacksCalendar():
7 self.r1 = GacksRecord("cpu", 0, 10, 100, 200, ["foo", "bar"], "slice1")
8 self.r2 = GacksRecord("cpu", 0, 10, 200, 300, ["foo", "bar"], "slice2")
9 self.r3 = GacksRecord("cpu", 10, 60, 150, 250, ["foo", "bar"], "slice3")
10 self.r4 = GacksRecord("disk", 0, 50, 100, INFINITY, ["foo", "bar"], "slice4")
17 c.insert_record(self.r1)
18 c.insert_record(self.r2)
19 c.insert_record(self.r3)
20 c.insert_record(self.r4)
24 c.insert_record(self.r1)
25 c.insert_record(self.r2)
26 c.insert_record(self.r3)
27 c.insert_record(self.r4)
31 self.assertEqual(len(records), 4)
35 c.insert_record(self.r1)
36 c.insert_record(self.r2)
37 c.insert_record(self.r3)
38 c.insert_record(self.r4)
40 c.remove_record(self.r2)
41 c.remove_record(self.r4)
44 self.assertEqual(len(records), 2)
46 self.assert_(c.find_record(self.r1))
47 self.assertEqual(c.find_record(self.r2), None)
48 self.assert_(c.find_record(self.r3))
49 self.assertEqual(c.find_record(self.r4), None)
52 class TestGacksListCalendar(unittest.TestCase, TestGacksCalendar):
54 self.CalClass = GacksListCalendar
55 TestGacksCalendar.setUp(self)
57 if __name__ == "__main__":