def test_getitem(self): c = Class("myclass", "A class", "an institution", "*****@*****.**", "password", self.user, qclass=999999) with self.assertRaises(NotSavedError): c.getitem("supervisor", User) with self.assertRaises(InvalidItemTypeError): c.getitem(1, int) c.save(WIMS_URL, "myself", "toto") user = c.getitem("supervisor", User) self.assertEqual(user.firstname, self.user.firstname)
def test_additem(self): c = Class("myclass", "A class", "an institution", "*****@*****.**", "password", self.user, qclass=999999) u = User("quser", "last", "first", "pass", "*****@*****.**") with self.assertRaises(NotSavedError): c.additem(u) with self.assertRaises(InvalidItemTypeError): c.additem(int) c.save(WIMS_URL, "myself", "toto") c.additem(u) self.assertEqual(u._class.qclass, c.qclass) self.assertEqual(u.wclass, True) u2 = c.getitem("quser", User) self.assertEqual(u2.firstname, u.firstname)