def test_save_adapt(self): self.clas.save(WIMS_URL, "myself", "toto") u = User("ap'ostrophe", "test", "test", "pass", "*****@*****.**") u.save(self.clas) self.assertEqual("apostrophe", u.quser) self.assertTrue(User.check(self.clas, "apostrophe")) self.assertFalse(User.check(self.clas, "ap'ostrophe"))
def test_save_exceptions(self): with self.assertRaises(NotSavedError): self.user.save() with self.assertRaises(NotSavedError): self.user.save(self.clas) self.clas.save(WIMS_URL, "myself", "toto") u = User("ap'ostrophe", "test", "test", "pass", "*****@*****.**") with self.assertRaises(InvalidIdentifier): u.save(self.clas, adapt=False) self.assertFalse(User.check(self.clas, "apostrophe")) self.assertFalse(User.check(self.clas, "ap'ostrophe"))
def test_check(self): self.clas.save(WIMS_URL, "myself", "toto") u = User("Test", "test", "test", "pass", "*****@*****.**") c = Class("myclass", "A class", "an institution", "*****@*****.**", "password", self.user, qclass=999999) with self.assertRaises(NotSavedError): User.check(c, u) self.assertFalse(User.check(self.clas, u)) self.clas.additem(u) self.assertTrue(User.check(self.clas, u))