def test_user(self): a = User(username="******", password="******", name="ray", detail="") b = User(username="******", password="******", name="ray", detail="") s = [a, b] c = User(username="******", password="******", name="ray", detail="1);DROP TABLE if exists USER--") self.assertTrue(user_db.insert_users_table(s)) self.assertTrue(user_db.insert_user_table(c)) user_db.drop_user_table() user_db.init_user_table() s.append(c) self.assertTrue(user_db.insert_users_table(s)) self.assertFalse( user_db.delete_user_table2("1);DROP TABLE if exists USER--")) self.assertTrue(user_db.update_user_table(1, c)) self.assertEqual( user_db.select_user_name("1ray);DROP TABLE if exists USER--"), None) self.assertEqual( user_db.select_password("1ray", "sss);DROP TABLE if exists USER--"), None) self.assertEqual( user_db.select_user("1ray", "sss);DROP TABLE if exists USER--"), None)
def test_insert4(self): self.assertFalse(user_db.insert_user_table("None"))
def test_insert3(self): self.assertFalse(user_db.insert_user_table(None))
def test_insert2(self): a = User(username="******", password="******", name="ray", detail="") self.assertFalse(user_db.insert_user_table(a))
def test_insert1(self): a = User(username="******", password="******", name="ray", detail="") self.assertTrue(user_db.insert_user_table(a))
def inituser(): user_db.drop_user_table() user_db.init_user_table() user_db.insert_user_table( User(username="******", password="******", name="ray", detail=""))