def test_02(self):
     '''发送验证码,并校验'''
     phone = '13152637543'
     # print(phone)
     # H5Method().H5_Post_register(phone,'ff123456') #注册成功
     # self.logger.info('------------注册成功-----------')
     # print(phone)
     H5Method().reset_post_password(phone)  #发送验证码
     code = MyMethod().redisCode_key(
         'mall:shoppingmall:smsVeriCode:FIND_BACK_LOGIN_PWD:', phone)
     # print(code,type(code))
     # print(eval(code),type(eval(code)))
     # response=H5Method().reset_password(phone,eval(code))
     # key=response.json()['data']['key'] #获取key
     dict = H5Method().Excel_Dict('H5商城', '忘记密码', 2, 6, 3, 2)  #核验验证码
     dict['data']['phoneNum'] = phone
     # dict['data']['key']=key
     dict['data']['code'] = eval(code)
     dict['headers']['Referer'] = 'http://192.168.12.21:81/forgetpsw/2'
     data = json.dumps(dict['data'])
     response = H5Method().Post_H5(dict['url'], dict['headers'],
                                   data)  #输入验证码
     print(response.json())
     self.assertEqual(response.json()['msg'],
                      MyMethod().duQu_Excel('H5商城', '忘记密码', 2, 8),
                      msg='点击忘记密码,无法获取或验核验验证码')
Ejemplo n.º 2
0
 def test04(self):
     '''密码为空'''
     url = MyMethod().duQu_Excel('H5商城', '登录', 4, 4)
     headers = MyMethod().duQu_Excel('H5商城', '登录', 4, 3)
     json = MyMethod().duQu_Excel('H5商城', '登录', 4, 2)
     response = H5Method.login_H5(url, eval(headers), json)  # eval  执行字符串表达式,并返回值!
     self.logger.info('登录返回:%s' % response.json())
     self.assertIn(MyMethod().duQu_Excel('H5商城', '登录', 4, 8), response.json()['msg'],
                      msg='*********Test_login—test04-密码为空--登录异常********')
Ejemplo n.º 3
0
 def  test03(self):
     '''账号正确、密码错误,shopid正确'''
     url = MyMethod().duQu_Excel('H5商城', '登录', 3, 4)
     headers = MyMethod().duQu_Excel('H5商城', '登录', 3, 3)
     json = MyMethod().duQu_Excel('H5商城', '登录', 3, 2)
     response = H5Method.login_H5(url, eval(headers), json)  # eval  执行字符串表达式,并返回值!
     self.logger.info('登录返回:%s' % response.json())
     self.assertEqual(MyMethod().duQu_Excel('H5商城', '登录', 3, 8), response.json()['msg'],
                      msg='账号正确、密码错误,shopid正确--登录异常')
Ejemplo n.º 4
0
 def  test02(self):
     '''账号密码正确,shopid不正确'''
     url = MyMethod().duQu_Excel('H5商城', '登录', 2, 4)
     headers = MyMethod().duQu_Excel('H5商城', '登录', 2, 3)
     json = MyMethod().duQu_Excel('H5商城', '登录', 2, 2)
     response = H5Method.login_H5(url, eval(headers), json)  # eval  执行字符串表达式,并返回值!
     self.logger.info('登录返回:%s' % response.json())
     self.assertEqual(MyMethod().duQu_Excel('H5商城', '登录', 2, 8), response.json()['msg'],
                      msg='账号跨店铺登录--异常')
Ejemplo n.º 5
0
 def test01(self):
     '''账号密码正确登录'''
     url=MyMethod().duQu_Excel('H5商城','登录',1,4)
     headers=MyMethod().duQu_Excel('H5商城','登录',1,3)
     json=MyMethod().duQu_Excel('H5商城','登录',1,2)
     response=H5Method.login_H5(url,eval(headers),json)  #eval  执行字符串表达式,并返回值!
     self.logger.info('登录返回:%s'%response.json())
     self.assertEqual(MyMethod().duQu_Excel('H5商城','登录',1,8),response.json()['msg'],
                      msg='正确账号密码、shop_id,登录失败')
Ejemplo n.º 6
0
 def test06(self):
     '''账号错误,密码正确'''
     url = MyMethod().duQu_Excel('H5商城', '登录', 6, 4)
     headers = MyMethod().duQu_Excel('H5商城', '登录', 6, 3)
     json = MyMethod().duQu_Excel('H5商城', '登录', 6, 2)
     response = H5Method.login_H5(url, eval(headers), json)  # eval  执行字符串表达式,并返回值!
     self.logger.info('登录返回:%s' % response.json())
     self.assertEqual(MyMethod().duQu_Excel('H5商城', '登录', 6, 8), response.json()['msg'],
                   msg='*********Test_login—test05-账号错误,密码正确--登录异常********')
Ejemplo n.º 7
0
 def Post_register(ExcelName, SheetName, Row, column_url, column_header,
                   column_data):
     url = MustCode['url'] + MyMethod().duQu_Excel(ExcelName, SheetName,
                                                   Row, column_url)
     headers = MyMethod().duQu_Excel(ExcelName, SheetName, Row,
                                     column_header)
     data = MyMethod().duQu_Excel(ExcelName, SheetName, Row, column_data)
     response = requests.post(url,
                              headers=eval(headers),
                              data=data,
                              verify=False)
     return response
Ejemplo n.º 8
0
 def Excel_Dict(ExcelName, SheetName, Row, column_url, column_header,
                column_data):
     url = MustCode['url'] + MyMethod().duQu_Excel(ExcelName, SheetName,
                                                   Row, column_url)
     headers = MyMethod().duQu_Excel(ExcelName, SheetName, Row,
                                     column_header)
     data = MyMethod().duQu_Excel(ExcelName, SheetName, Row, column_data)
     Excel_Dict_Code = {
         'url': url,
         'headers': eval(headers),
         'data': eval(data)
     }
     return Excel_Dict_Code
    def test03(self):
        '''验证一分种内只能申请一次'''
        a = H5Method().Excel_Dict('H5商城', '注册', 3, 4, 3, 2)
        self.logger.info('注册登录/注册-Excel表格获取内容为:\n%s' % a)
        phoneNum = MyMethod().createPhone()
        self.logger.info('随机生成手机号码为:%s' % phoneNum)
        data = {'phoneNum': phoneNum, 'shopId': str(a['data'])}
        data = json.dumps(data)
        self.logger.info('待传入json格式内容data是:%s' % data)

        msg_ = MyMethod().duQu_Excel('H5商城', '注册', 3, 8)
        H5Method().Post_H5(a['url'], a['headers'], data)
        response1 = H5Method().Post_H5(a['url'], a['headers'], data)
        self.assertEqual(msg_, response1.json()['msg'], msg='连续发送验证码存在异常')
Ejemplo n.º 10
0
 def set_password():
     phoneNumCode = MyMethod().createPhone()
     url = MustCode['url'] + MyMethod().duQu_Excel('H5商城', '注册', 4, 4)
     headers = MyMethod().duQu_Excel('H5商城', '注册', 4, 3)
     shop_id = MyMethod().duQu_Excel('H5商城', '注册', 4, 2)
     data = {'phoneNum': phoneNumCode, 'shopId': shop_id}
     data = json.dumps(data)
     H5Method().Post_H5(url, eval(headers), data)  # 注册
     redisCode = MyMethod().redisCode(phoneNumCode)
     data = json.loads(data)
     data['code'] = eval(redisCode)
     data = json.dumps(data)
     url = MustCode[
         'url'] + '/shoppingmall/anon/compareIdentifyingCode'  #填写验证码
     response = H5Method().Post_H5(url, eval(headers), data)
     return response
    def test01(self):
        '''未注册手机号码第一次注册'''

        msg_ = MyMethod().duQu_Excel('H5商城', '注册', 1, 8)
        response = H5Method().Post_register('H5商城', '注册', 1, 4, 3, 2)

        self.assertEqual(msg_, response.json()['msg'], msg='短信验证码未发送成功')
 def test_01(self):
     '''发送验证码'''
     response = H5Method().Post_register('H5商城', '忘记密码', 1, 4, 3, 2)
     print(response.json()['msg'])
     self.assertEqual(MyMethod().duQu_Excel('H5商城', '忘记密码', 1, 8),
                      response.json()['msg'],
                      msg='忘记密码,无法发送验证码')
 def test_07(self):
     '''验证码小于六位'''
     phone = '15220331480'
     response = H5Method().resetPassWordMthod(phone, 7, '12345')  # 修改密码
     self.assertEqual(response.json()['msg'],
                      MyMethod().duQu_Excel('H5商城', '忘记密码', 7, 8),
                      msg='修改密码失败')
    def test_06(self):
        '''密码存数字'''
        phone = '18670030712'
        response = H5Method().resetPassWordMthod(phone, 6, '123456')  #修改密码

        self.assertEqual(response.json()['msg'],
                         MyMethod().duQu_Excel('H5商城', '忘记密码', 6, 8),
                         msg='修改密码失败')
 def test_08(self):
     '''验证码大于20位'''
     phone = '15090451148'
     response = H5Method().resetPassWordMthod(
         phone, 8, '123456789912345678991')  # 修改密码
     self.assertEqual(response.json()['msg'],
                      MyMethod().duQu_Excel('H5商城', '忘记密码', 8, 8),
                      msg='修改密码失败')
 def test_05(self):
     '''密码纯英文'''
     phone = '15843675850'
     response = H5Method().resetPassWordMthod(phone, 5, 'fffffff')
     self.logger.info('修改密码为:fffffff')
     self.assertEqual(MyMethod().duQu_Excel('H5商城', '忘记密码', 5, 8),
                      response.json()['msg'],
                      msg='修改密码失败')
 def test08(self):
     '''输入密码低于六位'''
     response = H5Method().set_password()
     key = response.json()['data']['key']
     a = H5Method().Excel_Dict('H5商城', '注册', 8, 4, 3, 2)
     data = a['data']
     data['key'] = key
     data = json.dumps(data)
     print(type(data), data)
     response = H5Method().Post_H5(a['url'], a['headers'], data)
     self.assertEqual(MyMethod().duQu_Excel('H5商城', '注册', 8, 8),
                      response.json()['msg'],
                      msg='注册不成功')
Ejemplo n.º 18
0
 def Address_add(token, a, b, c, d):  #添加修改收货地址
     timeCode = time.strftime('%y%d%H%M%S', time.localtime())
     phone = MyMethod().createPhone()
     userName = '******'
     detail = 'test地址' + timeCode
     dict = H5Method().Excel_Dict('H5商城', '收货地址', a, b, c, d)
     dict['headers']['token'] = token
     dict['data']['phone'] = phone
     dict['data']['userName'] = userName
     dict['data']['detail'] = detail
     response = H5Method().Post_H5(dict['url'], dict['headers'],
                                   json.dumps(dict['data']))
     return response.json()
Ejemplo n.º 19
0
 def resetPassWordMthod(phone, Row, password):
     H5Method().reset_post_password(phone)  # 发送验证码
     code = MyMethod().redisCode_key(
         'mall:shoppingmall:smsVeriCode:FIND_BACK_LOGIN_PWD:', phone)
     dict = H5Method().Excel_Dict('H5商城', '忘记密码', 2, 6, 3, 2)  # 核验验证码
     dict['data']['phoneNum'] = phone
     dict['data']['code'] = eval(code)
     dict['headers']['Referer'] = 'http://192.168.12.21:81/forgetpsw/2'
     data = json.dumps(dict['data'])
     response = H5Method().Post_H5(dict['url'], dict['headers'],
                                   data)  # 输入验证码
     key = response.json()['data']['key']  # 获取key
     dict = H5Method().Excel_Dict('H5商城', '忘记密码', Row, 4, 3, 2)
     dict['headers']['Referer'] = 'http://192.168.12.21:81/forgetpsw/3'
     dict['data']['key'] = key
     dict['data']['password'] = password
     data = json.dumps(dict['data'])
     response = H5Method().Post_H5(dict['url'], dict['headers'], data)
     return response
 def test_09(self):
     '''输入正确密码'''
     phone = '15279684727'
     password = '******' + ''.join(
         random.sample([
             '1',
             '2',
             '3',
             '4',
             '5',
             '6',
             '7',
             '8',
             '9',
         ], 5))
     response = H5Method().resetPassWordMthod(phone, 9, password)  #修改密码
     self.logger.info('***********修改密码成功**************')
     self.assertEqual(response.json()['msg'],
                      MyMethod().duQu_Excel('H5商城', '忘记密码', 4, 8),
                      msg='修改密码失败')
Ejemplo n.º 21
0
 def H5_Post_register(phone, password):
     dict = H5Method().Excel_Dict('H5商城', '注册', 1, 4, 3, 2)  #发送验证码
     dict['data']['phoneNum'] = phone
     data = json.dumps(dict['data'])
     H5Method().Post_H5(dict['url'], dict['headers'], data)
     code = MyMethod().redisCode(phone)  # 获取验证码
     dict = H5Method().Excel_Dict('H5商城', '注册', 1, 4, 3, 2)  #填写验证码
     url = MustCode['url'] + '/shoppingmall/anon/compareIdentifyingCode'
     dict['url'] = url
     dict['data']['code'] = eval(code)
     dict['data']['phoneNum'] = phone
     print(1, dict)
     data = json.dumps(dict['data'])
     print(data)
     response = H5Method().Post_H5(dict['url'], dict['headers'], data)
     print(response.json())
     key = response.json()['data']['key']  #输入密码
     a = H5Method().Excel_Dict('H5商城', '注册', 5, 4, 3, 2)
     a['data']['password'] = password
     a['data']['key'] = key
     data = json.dumps(a['data'])
     H5Method().Post_H5(a['url'], a['headers'], data)
 def test_04(self):
     '''新旧密码相同'''
     response = H5Method().resetPassWordMthod('18803119452', 4, 'ff123456')
     #
     # phone = '17700000000'
     # H5Method().reset_post_password(phone)  # 发送验证码
     # code = MyMethod().redisCode_key('mall:shoppingmall:smsVeriCode:FIND_BACK_LOGIN_PWD:', phone)
     # dict = H5Method().Excel_Dict('H5商城', '忘记密码', 4, 6, 3, 2)  # 核验验证码
     # dict['data']['phoneNum'] = phone
     # dict['data']['code'] = eval(code)
     # dict['headers']['Referer'] = 'http://192.168.12.21:81/forgetpsw/2'
     # data = json.dumps(dict['data'])
     # response = H5Method().Post_H5(dict['url'], dict['headers'], data)  # 输入验证码
     # key=response.json()['data']['key'] #获取key
     # dict=H5Method().Excel_Dict('H5商城', '忘记密码', 4, 4, 3, 2)
     # # dict['headers']['Referer']='http://192.168.12.21:81/forgetpsw/3'
     # dict['data']['key']=key
     # data=json.dumps(dict['data'])
     # response=H5Method().Post_H5(dict['url'],dict['headers'],data)
     self.assertEqual(response.json()['msg'],
                      MyMethod().duQu_Excel('H5商城', '忘记密码', 4, 8),
                      msg='新密码可以与旧密码相同')
 def test02(self):
     '''已注册手机号码'''
     response = H5Method().Post_register('H5商城', '注册', 2, 4, 3, 2)
     msg_ = MyMethod().duQu_Excel('H5商城', '注册', 2, 8)
     self.assertEqual(response.json()['msg'], msg_, msg='短信验证码未发送成功')