예제 #1
0
    def testSignUpUser(self):
        # 注册成功
        rv = self.signUp("tom2333", "tom%@", "1")

        user = User_helper.query_first_name_password(Users("tom2333", "tom%@"))
        User_Role_helper.delete(User_Role(user.id, "1"))
        User_helper.delete(Users("tom2333", "tom%@"))
        self.assertIn("User registration successful!", rv.data)
예제 #2
0
 def testSignUpUserLose(self):
     # 注册失败
     self.signUp("tom2333", "tom12333", "1")
     rv = self.signUp("tom2333", "tom12333", "1")
     user = User_helper.query_first_name_password(
         Users("tom2333", "tom12333"))
     User_Role_helper.delete(User_Role(user.id, "1"))
     User_helper.delete(Users("tom2333", "tom12333"))
     self.assertIn("User registration failed!", rv.data)
예제 #3
0
 def test_Change(self):
     # 修改密码成功
     self.signUp("Jar123", "Jar1234", "1")
     rv = self.Login("Jar123", "Jar1234")
     self.assertIn("Login Success", rv.data)
     rv = self.Change("Jar123", "Jar1234", "Jar456")
     user = User_helper.query_first_name_password(Users("Jar123", "Jar456"))
     User_Role_helper.delete(User_Role(user.id, "1"))
     User_helper.delete(Users("Jar123", "Jar456"))
     self.assertIn('Change Success', rv.data)
예제 #4
0
 def test_userLogout(self):
     # 注销测试
     self.signUp("Jar123", "Jar1234", "1")
     rv = self.Login("Jar123", "Jar1234")
     user = User_helper.query_first_name_password(Users(
         "Jar123", "Jar1234"))
     User_Role_helper.delete(User_Role(user.id, "1"))
     User_helper.delete(Users("Jar123", "Jar1234"))
     self.assertIn("Login Success", rv.data)
     rv = self.logout()
     self.assertIn(b'You were logged out', rv.data)
예제 #5
0
    def testLoginUser(self):
        # 登陆成功

        user = User_helper.query_first_name_password(Users("tom2333", "%@123"))
        if user:
            User_Role_helper.delete(User_Role(user.id, "1"))
            User_helper.delete(Users("tom2333", "%@123"))

        self.signUp("tom2333", "%@123", "1")
        rv = self.Login("tom2333", "%@123")

        self.assertIn("Login Success", rv.data)
예제 #6
0
 def test_allArticle(self):
     # 发表文章
     self.signUp("Jar123", "Jar1234", "1")
     rv = self.Login("Jar123", "Jar1234")
     self.assertIn("Login Success", rv.data)
     rv = self.addArticle("fish", "fish is good!")
     user = User_helper.query_first_name_password(Users(
         "Jar123", "Jar1234"))
     User_Role_helper.delete(User_Role(user.id, "1"))
     User_helper.delete(Users("Jar123", "Jar1234"))
     Article_helper.delete(Article("fish", "fish is good!"))
     self.assertIn("text published successfully", rv.data)