def test_close_room(self): r = Room() r.open() u1 = User() u2 = User() o = User() r.add_user(u1) r.add_user(u2) r.add_owner(o) r.close() self.assertFalse(r.is_open()) self.assertEqual(len(r.users), 0) self.assertEqual(r.owner, o)
def test_add_users_to_unopened_room(self): r = Room() u = User() self.assertFalse(r.is_open()) with self.assertRaises(RoomException): r.add_user(u)
def test_open_room(self): r = Room() r.open() self.assertTrue(r.is_open())