def test_update_then_list(self): ada = UserDataAccess("test.ini") ada.load() a = User() a.set_id("id1") a.set_name("name0") a.set_is_admin(False) a.set_password("password0") self.assertTrue(ada.update(a)) clist = ada.list_all() self.assertEqual(len(clist), 3) a = clist[0] self.assertEqual(a.get_id(), "id1") self.assertEqual(a.get_name(), "name0") self.assertFalse(a.is_admin()) self.assertEqual(a.get_password(), "password0") a = clist[1] self.assertEqual(a.get_id(), "id2") self.assertEqual(a.get_name(), "name2") self.assertTrue(a.is_admin()) self.assertEqual(a.get_password(), "password2") a = clist[2] self.assertEqual(a.get_id(), "id3") self.assertEqual(a.get_name(), "name3") self.assertFalse(a.is_admin()) self.assertEqual(a.get_password(), "password3")
def test_id(self): a = User() a.set_id("1") self.assertEqual(a.get_id(), "1") a.set_id("2") self.assertEqual(a.get_id(), "2")