Esempio n. 1
0
 def test_selectpassword2(self):
     a = User(username="******", password="******", name="ray", detail="")
     b = User(username="******", password="******", name="ray", detail="")
     s = [a, b]
     user_db.insert_users_table(s)
     self.assertEqual(user_db.select_password("2ry", "ssss"), None)
     self.assertEqual(user_db.select_password("1ra", "ssss"), None)
Esempio n. 2
0
 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)
Esempio n. 3
0
 def test_selectpassword3(self):
     self.assertEqual(user_db.select_password(None, "sss"), None)
     self.assertEqual(user_db.select_password("sss", None), None)
     self.assertEqual(user_db.select_password(None, None), None)