def test_login_pass_01(self):
     self._testMethodDoc = '执行登录模块第一个案例:正常用户名密码登录'  # 测试报告中增加测试用例说明信息
     logger.info("执行登录模块第一个案例:正常用户名密码登录")
     req1 = login(self.session, "sophia.liu", "123456", self.token)
     rep01 = req1.content.decode("utf-8")
     # print(rep01)
     self.assertEqual(req1.json()['state'], "success")
Beispiel #2
0
 def test_regester_fail_token_wrong_03(self):
     self._testMethodDoc = '执行注册模块第三个案例:注册token错误,注册失败'
     logger.info("执行注册模块第三个案例:注册token错误,注册失败")
     res = resister(self.session, config_utils.REGISTER_NAME, '123456',
                    '123456', config_utils.REGISTER_EMAIL, '1111')
     rep = res.content.decode('utf-8')
     # print(rep)
     self.assertIn('错误提示 - phpwind 9.0 - Powered by phpwind', rep)
Beispiel #3
0
 def test_regester_fail_usr_none_02(self):
     self._testMethodDoc = '执行注册模块第二个案例:注册用户名是空,注册失败'
     logger.info("执行注册模块第二个案例:注册用户名是空,注册失败")
     res = resister(self.session, None, '123456', '123456',
                    config_utils.REGISTER_EMAIL, self.token01)
     rep = res.content.decode('utf-8')
     # print(rep)
     self.assertIn('错误提示 - phpwind 9.0 - Powered by phpwind', rep)
Beispiel #4
0
 def test_register_success_01(self):
     self._testMethodDoc = '执行注册模块第一个案例:注册信息正确,注册成功'
     logger.info("执行注册模块第一个案例:注册信息正确,注册成功")
     res = resister(self.session, config_utils.REGISTER_NAME, '123456',
                    '123456', config_utils.REGISTER_EMAIL, self.token01)
     rep = res.content.decode('utf-8')
     # print(rep)
     self.assertIn(',恭喜您注册成为phpwind 9.0会员!', rep)
 def test_post_title_null_fail_04(self):
     """执行发帖模块第四个案例:发贴接口标题送None"""
     logger.info("执行发帖模块第四个案例:发贴接口标题送None")
     # login_auth(self.session)
     post_req04= post_info(self.session,
                    title = None,
                    content = "ljl0709发帖"+time.strftime('%Y-%m-%d-%H-%M-%S'),
                    token = self.token)
     post_rep04 = post_req04.content.decode('utf-8')
     # print(post_rep04)
     self.assertEqual(post_req04.json()['state'], "fail")
 def test_post_wrong_token_fail_03(self):
     """执行发帖模块第三个案例:发贴接口上送错误的token"""
     logger.info("执行发帖模块第三个案例:发贴接口上送错误的token")
     # login_auth(self.session)
     post_req03= post_info(self.session,
                    title = "ljl0709发帖"+ time.strftime('%Y-%m-%d-%H-%M-%S'),
                    content = "ljl0709发帖"+time.strftime('%Y-%m-%d-%H-%M-%S'),
                    token = "111111")
     post_rep03 = post_req03.content.decode('utf-8')
     # print(post_rep03)
     self.assertEqual(post_req03.json()['state'], "fail")
 def test_post_no_auth_fail_02(self):
     """执行发帖模块第二个案例:登录后不进行授权进行发贴"""
     logger.info("执行发帖模块第二个案例:登录后不进行授权进行发贴")
     # login_auth(self.session)
     post_req02= post_info(self.session,
                    title = "ljl0709发帖"+ time.strftime('%Y-%m-%d-%H-%M-%S'),
                    content = "ljl0709发帖"+time.strftime('%Y-%m-%d-%H-%M-%S'),
                    token = self.token)
     post_rep02 = post_req02.content.decode('utf-8')
     # print(post_rep02)
     self.assertEqual(post_req02.json()['state'], "fail")
 def test_post_sucess_01(self):
     """执行发帖模块第一个案例:登录授权后进行发贴"""
     logger.info("执行发帖模块第一个案例:登录授权后进行发贴")
     login_auth(self.session)
     post_req01= post_info(self.session,
                    title = "ljl0709发帖"+ time.strftime('%Y-%m-%d-%H-%M-%S'),
                    content = "ljl0709发帖"+time.strftime('%Y-%m-%d-%H-%M-%S'),
                    token = self.token)
     post_rep01 = post_req01.content.decode('utf-8')
     # print(post_rep01)
     self.assertEqual(post_req01.json()['state'], "success")
 def test_login_fail_wrong_pw_03(self):
     self._testMethodDoc = '执行登录模块第三个案例:错误的密码登录'
     logger.info("执行登录模块第三个案例:错误的密码登录")
     req3 = login(self.session, "sophia.liu", "12345", self.token)
     self.assertEqual(req3.json()['state'], "fail")
 def test_login_fail_wrong_usr_02(self):
     self._testMethodDoc = '执行登录模块第二个案例:错误的用户名登录'
     logger.info("执行登录模块第二个案例:错误的用户名登录")
     req2 = login(self.session, "sophia", "123456", self.token)
     self.assertEqual(req2.json()['state'], "fail")