def test_get_chassis(self): chassis1 = Class8Chassis() chassis2 = Class8Chassis() server1 = Class8Server("class8-test1.lindenlab.com") server2 = Class8Server("class8-test2.lindenlab.com") self.assertEqual(Class8Chassis.get_chassis(server1), None) self.assertEqual(Class8Chassis.get_chassis(server2), None) chassis1.insert(server1) chassis2.insert(server2) self.assertEqual(Class8Chassis.get_chassis(server1), chassis1) self.assertEqual(Class8Chassis.get_chassis(server2), chassis2)
def test_insert(self): chassis = Class8Chassis() server1 = Class8Server("class8-test1.lindenlab.com") server2 = Class8Server("class8-test2.lindenlab.com") server3 = Class8Server("class8-test3.lindenlab.com") server4 = Class8Server("class8-test4.lindenlab.com") server5 = Class8Server("class8-test5.lindenlab.com") server6 = Class5Server("class5-test1.lindenlab.com") self.assertRaises(TypeError, chassis.insert, server6) # Should not be able to insert Class5Server into Class8Chassis self.assert_(server1 not in chassis) self.assertEqual(Class8Chassis.get_chassis(server1), None) chassis.insert(server1) self.assert_(server1 in chassis) chassis.insert(server2) chassis.insert(server3) chassis.insert(server4) self.assertRaises(ChassisFullError, chassis.insert, server5) chassis.remove(server4) self.assert_(server4 not in chassis) chassis.insert(server5)