Beispiel #1
0
    def test_accout02(self):
        u'推广收益接口'
        self.log.info('开始测试推广收益接口..')
        url = 'http://api-rec.sunnycare.cc/v1/promotion/incomelist'
        json_data = {
            'token': self.to,
            'timestamp': str(int(time.time())),
            'nonce': get_digit()
        }
        json_data['sign'] = get_sign(json_data)
        #请求
        r = self.s.post(url,headers = self.header,json=json_data)
        self.log.info('推广收益接口返回:%s' % r.json())
        #断言
        self.assertEqual(200,r.json()['code'],msg='返回状态码不是200')
        self.assertEqual('请求成功',r.json()['note'])
        #收益列表中income_code
        data = r.json()['data']['list'][0]['items']

        n = 0
        d = {}
        for i in data:
            d['income_code'+ str(n)] = i['income_code']
            n += 1
        #将收益code写入excel
        self.excel.write_value(21,6,d)
        self.log.info('推广收益接口测试结束\n')
Beispiel #2
0
    def testColumnInfo(self):
        u'测试专栏信息接口'
        url = 'http://api.lesson.sunnycare.cc/v1/spe'
        #将所有专栏的code放进list
        column_list = json.loads(self.EXCEL.read_value(4, 6))
        print(column_list)

        new_column_list = []
        for x in column_list.values():
            new_column_list.append(x)
        #详情介绍链接
        detail_links = []
        for i in new_column_list:
            json_data = {
                "spe_code": i,
                "timestamp": str(int(time.time())),
                "token": self.uid_token,
                "nonce": get_digit()
            }
            json_data['sign'] = get_sign(json_data)
            r = self.s.post(url,
                            headers=self.header,
                            json=json_data,
                            verify=False)
            #print(r.json())
            detail_links.append(r.json()['data']['detail_link'])
            self.assertEqual('请求成功.',
                             r.json()['note'],
                             msg='专栏信息返回的状态不是请求成功,有问题!')
        #下面测试专栏介绍的链接

        for link in detail_links:
            r2 = self.s.get(link, verify=False)
            self.assertEqual(200, r2.status_code, msg='专栏介绍链接返回状态码不是200!')
Beispiel #3
0
    def test_update_contacts01(self):
        u'更新联系人-更新名字'
        #先读取一个参会人code然后更新其信息
        read_code = self.excel.read_value(15, 6)
        be_use_code = json.loads(read_code)
        update_url = 'http://api.meet.sunnycare.cc/v2/contact/update'

        json_data = {
            "token": self.uid_token,
            "name": '更新后的名字',
            "contact_code": be_use_code['contact_code1'],
            "phone": '13605246089',
            "sex": '0',
            "address": '江苏省南京市江宁区',
            "company": '南京麦澜德',
            "job": 'xxx',
            "job_title": 'sss',
            "is_from_base": '1',
            "timestamp": str(int(time.time())),
            "nonce": get_digit()
        }
        #入参加密
        json_data['sign'] = get_sign(json_data)
        r = self.s.post(update_url, headers=self.header, json=json_data)
        self.assertEqual(200, r.json()['code'])
Beispiel #4
0
 def test_goods01(self):
     u'商品列表接口'
     self.log.info('开始测试商品列表接口...')
     url = 'http://api-rec.sunnycare.cc/v1/goods/list'
     json_data = {
         'token': self.to,
         'timestamp': str(int(time.time())),
         'nonce': get_digit(),
         'page': '1',
         'type': '1'
     }
     json_data['sign'] = get_sign(json_data)
     r = self.s.post(url, headers=self.header, json=json_data)
     self.log.info('商品列表返回:%s' % r.json())
     self.assertEqual(200, r.json()['code'], msg='返回状态码不是200')
     self.assertEqual('请求成功', r.json()['note'])
     #获取商品列表code
     data = r.json()['data']['goodslist']
     n = 0
     d = {}
     #循环给d字典赋值
     for i in data:
         d['goods_code' + str(n)] = i['goods_code']
         n += 1
     #赋值后将包含活动code写入excel
     self.excel.write_value(19, 6, d)
     self.log.info('商品列表接口测试结束...\n')
Beispiel #5
0
    def login(self):
        mytest = test_login002
        url = "http://api.lesson.sunnycare.cc/v1/lesson"
        headers = {
            'User-Agent':
            'PelvicFloorPersonal/4.1.1 (iPad; iOS 10.1.1; Scale/2.00)',
            'Accept-Encoding': 'gzip, deflate',
            'Accept-Language': 'zh-Hans-CN;q=1',
            'Content-Type': 'application/json',
            'requestApp': '2',
            'requestclient': '2',
            'versionForApp': '4.1.1',
            'Authorization':
            'Basic YXBpTGFudGluZ0BtZWRsYW5kZXIuY29tOkFwaVRobWxkTWxkQDIwMTM=',
            'Connection': 'keep-alive'
        }

        data = {
            "token": auto_login_by_UID(),
            "lesson_code": "K00098",
            "timestamp": str(int(time.time())),
            "nonce": get_digit()
        }
        data['sign'] = get_sign(data)
        r = requests.post(url=url, headers=headers, json=data)
        print(r.json()['code'])
        ResponseTime = float(r.elapsed.microseconds) / 1000
        mytest.times.append(ResponseTime)
        if r.status_code != 200:
            mytest.error.append("0")
Beispiel #6
0
    def testLessonInfo(self):
        u'测试课程信息'
        self.log.info('------开始测试课程信息接口---------')
        url = 'http://api.lesson.sunnycare.cc/v1/lesson'

        #从txt读取上个接口的lesson_codes来循环post
        with open(r'C:\Users\Administrator\Desktop\test_data.txt', 'r') as f:
            lesson_codes = (f.readlines())
        #因为readline读取的列表元素末尾有'\n' 所以利用字符串的strip()去除
        #print(lesson_codes)
        need_codes = []
        for x in lesson_codes:
            need_codes.append(x.strip())
        print('需要的need_codes:%s' % need_codes, '长度是:%s' % len(need_codes))

        #下面循环post课程 来断言课程详情是否获取成功
        for n in need_codes:
            json_data = {
                "lesson_code": n,
                "token": self.uid_token,
                "timestamp": str(int(time.time())),
                "nonce": get_digit()
            }
            json_data['sign'] = get_sign(json_data)
            r2 = self.s.post(url,
                             headers=self.header,
                             json=json_data,
                             verify=False)
            self.log.info('%s课程信息返回:%s' % (n, r2.json()))
            self.assertEqual('请求成功.', r2.json()['note'])

        self.log.info('------------测试结束---------------')
Beispiel #7
0
    def test_ColumnList(self):
        u'测试专栏列表接口'
        self.log.info('开始测试专栏列表接口....')
        url = 'http://api.lesson.sunnycare.cc/v1/spe/list'
        json_data = {
            "timestamp": str(int(time.time())),
            "token": self.uid_token,
            "time": "0"
        }
        #加入nonce参数
        json_data['nonce'] = get_digit()
        json_data['sign'] = get_sign(json_data)
        print(json_data)

        r = self.s.post(url, headers=self.header, json=json_data, verify=False)
        self.EXCEL.write_value(4, 5, r.json())
        print(r.json())

        self.assertEqual('请求成功.', r.json()['note'])
        data = r.json()['data']
        content = data['list']  #专栏列表的内容
        self.assertTrue(len(content) >= 1, msg='专栏列表为空,肯定有问题!')

        spe_codes = {}
        n = 1
        for i in r.json()['data']['list']:
            spe_codes['spe_code' + str(n)] = i['spe_code']
            n += 1
        self.EXCEL.write_value(4, 6, (spe_codes))
        self.log.info('专栏列表接口测试结束!!')
Beispiel #8
0
 def test_order01(self):
     u'我的订单列表接口'
     self.log.info('订单列表接口测试开始...')
     url = 'http://api-rec.sunnycare.cc/v1/order/list'
     json_data = {
         'token': self.to,
         'timestamp': str(int(time.time())),
         'nonce': get_digit()
     }
     json_data['sign'] = get_sign(json_data)
     r = self.s.post(url, headers=self.header, json=json_data)
     self.log.info('订单列表返回:%s' % r.json())
     #断言
     self.assertEqual(200, r.json()['code'], msg='返回状态码不是200')
     self.assertEqual('请求成功', r.json()['note'])
     #订单列表中订单code
     data = r.json()['data']['list']
     n = 0
     d = {}
     for i in data:
         d['order_code' + str(n)] = i['order_code']
         n += 1
     #将订单code写入excel
     self.excel.write_value(20, 6, d)
     self.log.info('订单列表接口测试结束!\n')
Beispiel #9
0
    def test_getbanner(self):
        u'测试获取banner链接接口'
        self.log.info('----------开始测试获取banner接口-----------')
        url = 'http://api.meet.sunnycare.cc/v2/banner'
        json_data = {
            "token":self.uid_token,
            'timestamp': str(int(time.time())),
            'nonce':get_digit()
        }
        json_data['sign'] = get_sign(json_data)
        r = self.s.post(url=url,headers = self.header,json=json_data)
        self.log.info('返回的内容是:%s' % r.json())
        try:
            self.assertEqual('请求成功.',r.json()['note'])
            self.assertEqual(200,r.json()['code'])
            self.log.info('接口返回状态成功!')
        except Exception as e:
            self.log.error('请求失败,原因是:%s' % e)
            raise AssertionError

        #取出json中banner链接依次进行get
        links = r.json()['data']
        for link in links:
            super_link = link['image']
            r2 = self.s.get(url=super_link,headers = self.header)
            try:
                self.assertEqual(200,r2.status_code)
                self.log.info('banner链接请求成功')
            except Exception as e:
                self.log.error('banner链接请求失败,原因:%s' % e)
                raise AssertionError
        self.log.info('----------banner接口测试结束-----------')
Beispiel #10
0
 def test_add_contacts05(self):
     u'添加联系人-新增人数过多'
     self.log.info('新增参会人-新增人数过多')
     url = 'http://api.meet.sunnycare.cc/v2/contact/add'
     for i in range(105):
         json_data = {
             "token": self.uid_token,
             "name": '司马上官',
             "phone": phone_nember(),
             "sex": '0',
             "address": ' 南京南京',
             "company": '南京麦澜德',
             "job": 'xxx',
             "job_title": 'sss',
             "is_from_base": '1',
             "timestamp": str(int(time.time())),
             "nonce": get_digit()
         }
         json_data['sign'] = get_sign(json_data)
         r = self.s.post(url,headers = self.header,json=json_data)
         while  i == 101:
             self.assertEqual('数量达到上限',r.json()['note'])
             self.log.info('新增参会人-新增人数过多返回结果是:%s' % r.json())
             break
     self.log.info('新增参会人-新增人数过多情况测试结束!')
Beispiel #11
0
 def test_meet_list01(self):
     u'会议列表接口-获取会议列表'
     self.log.info('会议列表接口')
     url = 'http://api.meet.sunnycare.cc/v2/meet/records'
     json_data = {
         "token": self.uid_token,
         "time": '0',
         "timestamp": str(int(time.time())),
         "nonce": get_digit()
     }
     json_data['sign'] = get_sign(json_data)
     #print(self.uid_token)
     r = self.s.post(url, headers=self.header, json=json_data)
     self.log.info('列表返回的内容是:%s' % r.json())
     self.assertEqual(200, r.json()['code'])
     self.assertEqual('请求成功.', r.json()['note'])
     #获取json中会议编号
     li = r.json()['data']['list']
     code = {}
     j = 1
     for i in li:
         code['code' + str(j)] = i['code']
         j += 1
     #将会议code写入excel
     self.excel.write_value(14, 6, code)
     self.log.info('会议列表接口测试结束!')
Beispiel #12
0
 def test_meet_list02(self):
     u'会议详情接口-获取详情'
     self.log.info('会议详情接口')
     #读取code
     read = self.excel.read_value(14, 6)
     use_read = json.loads(read)
     #下面调用详情接口
     info_url = 'http://api.meet.sunnycare.cc/v2/meet'
     for v in use_read.values():
         #print(type(v))
         info_json_data = {
             "token": self.uid_token,
             "meet_code": v,
             "timestamp": str(int(time.time())),
             "nonce": get_digit()
         }
         #入参加密
         info_json_data['sign'] = get_sign(info_json_data)
         #print(self.uid_token)
         r2 = self.s.post(info_url,
                          headers=self.header,
                          json=info_json_data)
         self.log.info('会议:%s返回详情是:%s' % (v, r2.json()))
         self.assertEqual('请求成功.', r2.json()['note'])
     self.log.info('会议详情接口测试结束!!')
Beispiel #13
0
 def test_recommender02(self):
     u'推广活动列表'
     self.log.info('开始测试推广活动列表接口..')
     url = 'http://api-rec.sunnycare.cc/v1/promotion/list'
     json_data = {
         'token': self.to,
         'timestamp': str(int(time.time())),
         'nonce': get_digit()
     }
     json_data['sign'] = get_sign(json_data)
     r = self.s.post(url,headers = self.header,json=json_data)
     self.log.info('活动列表返回:%s' % r.json())
     self.assertEqual(200,r.json()['code'])
     self.assertEqual('请求成功',r.json()['note'])
     #获取活动列表code
     get_code = []
     data = r.json()['data']['list']
     n = 0
     d = {}
     #循环给d字典赋值
     for i in data:
         get_code.append(i['promotion_code'])
         d['promotion_code'+str(n)] = i['promotion_code']
         n += 1
     #print(d)
     #赋值后将包含活动code写入excel
     self.excel.write_value(18,6,d)
     self.log.info('推广活动列表接口测试结束!\n')
Beispiel #14
0
    def test_add_contacts01(self):
        u'添加联系人-各个入参正常'

        self.log.info('开始测试添加参会人接口-参数正常')
        url = 'http://api.meet.sunnycare.cc/v2/contact/add'
        #for i in range(3):
        json_data = {
            "token": self.uid_token,
            "name": '你不知道我是谁',
            "phone": phone_nember(),
            "sex": '0',
            "address": '江苏省南京市江宁区',
            "company": '南京麦澜德',
            "job": 'xxx',
            "job_title": 'sss',
            "is_from_base": '1',
            "timestamp": str(int(time.time())),
            "nonce": get_digit()
        }
        #入参加密
        json_data['sign'] = get_sign(json_data)
        r = self.s.post(url,headers = self.header,json=json_data)
        self.log.info('添加参会人返回结果:%s' % r.json())
        self.assertEqual(200, r.json()['code'])
        self.assertEqual('请求成功.',r.json()['note'])
        self.log.info('添加参会人接口-参数正常情况测试结束!\n')
Beispiel #15
0
    def test_add_study_chap(self):
        u'测试增加课程的学习进度接口'
        self.log.info('====开始测试增加课程的学习进度接口=====')
        #先通过课程接口来获取章节
        url = 'http://api.lesson.sunnycare.cc/v1/lesson'
        lesson_codes = json.loads(self.excel.read_value(7,6))

        #定义全局变量
        global chap_codes
        chap_codes = []
        for value in lesson_codes.values():
            json_data = {
                "lesson_code":value,
                "token":self.uid_token,
                "timestamp": str(int(time.time())),
                "nonce": get_digit()
                     }
            json_data['sign'] = get_sign(json_data)
            r = self.s.post(url,headers = self.header,json=json_data,verify=False)
            #断言,我的学习中的每一个课程的标签都应是‘已加入学习’
            print(r.json())
            self.assertEqual('已加入学习',r.json()['data']['btn'][0]['btn_name'])

            #将chap_code 加入chap_codes列表
            for y in (r.json()['data']['chap_list']):
                chap_codes.append(y['chap_code'])
        print('chap_codes:',chap_codes)

        url_2 = 'http://api.lesson.sunnycare.cc/v1/learn/chapadd'

        for i in chap_codes:
            json_data2 = {
                "chap_code":i,
                "timestamp":str(int(time.time())),
                "token":self.uid_token,
                "nonce": get_digit()
                       }
            json_data2['sign'] = get_sign(json_data2)
            r2 = self.s.post(url_2,headers = self.header,json=json_data2,verify=False)
            self.assertEqual('请求成功',r2.json()['note'],msg='增加课程的学习进度失败')

        self.log.info('====测试增加课程的学习进度接口结束=====')
 def test_checkin_live01(self):
     u'进入直播课堂接口'
     self.log.info('进入直播课堂接口测试开始..')
     url = 'http://api-live.sunnycare.cc/v1/live/checkIn'
     json_data = {
         'token': self.uid_token,
         'timestamp': str(int(time.time())),
         'live_code': 'L2018091135930',
         'nonce': get_digit()
     }
     json_data['sign'] = get_sign(json_data)
     r = self.s.post(url, headers=self.header, json=json_data)
     self.log.info('进入直播课堂返回:%s' % r.json())
     self.log.info('进入直播课堂接口测试结束\n')
Beispiel #17
0
 def post(self):
     self.json_data = {
         "token": self.t,
         "lesson_code": "K00098",
         "timestamp": str(int(time.time())),
         "nonce": get_digit()
     }
     self.json_data['sign'] = get_sign(self.json_data)
     try:
         r = self.s.post(url=self.url,
                         headers=self.header,
                         json=self.json_data)
         print(r.json())
     except Exception as e:
         print(e)
Beispiel #18
0
 def test_recommender01(self):
     u'获取推广大使信息接口'
     self.log.info('开始测试获取推广大使信息接口..')
     url = 'http://api-rec.sunnycare.cc/v1/level/mine'
     json_data = {
         'token': self.to,
         'timestamp': str(int(time.time())),
         'nonce': get_digit()
     }
     json_data['sign'] = get_sign(json_data)
     r = self.s.post(url,headers = self.header,json=json_data)
     self.log.info('获取推广大使返回:%s' % r.json())
     self.assertEqual(200,r.json()['code'],msg='返回状态码不是200')
     self.assertEqual('请求成功',r.json()['note'])
     self.log.info('推广大使信息接口测试结束!\n')
Beispiel #19
0
 def test_my_follow_room03(self):
     u'我关注的直播间接口'
     self.log.info('我关注的直播间列表接口测试开始..')
     url = 'http://api-live.sunnycare.cc/v1/room/followlist'
     json_data = {
         'token': self.uid_token,
         'timestamp': str(int(time.time())),
         'nonce': get_digit(),
         'page': '1'
     }
     json_data['sign'] = get_sign(json_data)
     r = self.s.post(url, headers=self.header, json=json_data)
     self.log.info('我关注的直播间列表返回:%s' % r.json())
     self.assertEqual(200, r.json()['code'])
     self.log.info('我关注的直播间列表接口测试结束\n')
Beispiel #20
0
 def test_invite_gust02(self):
     u'主持人邀请嘉宾接口-嘉宾存在'
     self.log.info('邀请嘉宾接口-邀请自己 测试开始...')
     url = 'http://api-live.sunnycare.cc/v1/live/invite'
     json_data = {
         'token': self.uid_token,
         'timestamp': str(int(time.time())),
         'live_code': 'L2018091982508',
         'phone': '15651797525',
         'nonce': get_digit()
     }
     json_data['sign']= get_sign(json_data)
     r = self.s.post(url,headers = self.header,json=json_data)
     self.log.info('邀请邀请自己返回结果是:%s' % r.json())
     self.assertEqual(200,r.json()['code'])
     self.log.info('邀请嘉宾接口-邀请自己 测试结束!\n')
Beispiel #21
0
 def test_attach_list(self):
     u'讲义列表接口'
     self.log.info('开始测试讲义列表接口')
     url = 'http://api.meet.sunnycare.cc/v2/attach/list'
     json_data = {
         "token": self.uid_token,
         "meet_code": 'M2018072025468',
         "timestamp": str(int(time.time())),
         "nonce": get_digit()
     }
     #入参加密
     json_data['sign'] = get_sign(json_data)
     r = self.s.post(url, headers=self.header, json=json_data)
     self.log.info('该会议讲义列表接口返回内容是:%s' % r.json())
     self.assertEqual('请求成功.', r.json()['note'])
     self.log.info('讲义接口测试结束!')
Beispiel #22
0
 def test_my_follow_room02(self):
     u'去关注直播间接口'
     self.log.info('取消关注直播间接口测试开始..')
     url = 'http://api-live.sunnycare.cc/v1/room/setfollow'
     json_data = {
         'token': self.uid_token,
         'timestamp': str(int(time.time())),
         'room_code': 'R2018091851448',
         'status': '0',
         'nonce': get_digit()
     }
     json_data['sign'] = get_sign(json_data)
     r = self.s.post(url, headers=self.header, json=json_data)
     self.log.info('取消关注直播间返回:%s' % r.json())
     self.assertEqual(200, r.json()['code'])
     self.log.info('取消关注直播间接口测试结束\n')
 def test_live_lesson_detail02(self):
     u'直播课程详情接口-不存在的live_code'
     self.log.info('直播课程详情接口测试开始..')
     url = 'http://api-live.sunnycare.cc/v1/live/detail'
     json_data = {
         'token': self.uid_token,
         'timestamp': str(int(time.time())),
         'live_code': 'L2',
         'nonce': get_digit()
     }
     json_data['sign'] = get_sign(json_data)
     r = self.s.post(url, headers=self.header, json=json_data)
     self.log.info('%s课程返回的详情是:%s' % (json_data['live_code'], r.json()))
     self.assertEqual(202, r.json()['code'])
     self.assertEqual('无效的直播课', r.json()['note'])
     self.log.info('直播课程详情接口测试结束!\n')
Beispiel #24
0
 def test_accout04(self):
     u'提现记录接口'
     self.log.info('开始测试提现记录接口..')
     url = 'http://api-rec.sunnycare.cc/v1/withdraw/records'
     json_data = {
             'token': self.to,
             'timestamp': str(int(time.time())),
             'nonce': get_digit()
         }
     json_data['sign'] = get_sign(json_data)
     r = self.s.post(url,headers = self.header,json=json_data)
     self.log.info('提现记录返回:%s' % (r.json()))
     #断言
     self.assertEqual(200,r.json()['code'],msg='返回状态码不是200')
     self.assertEqual('请求成功',r.json()['note'])
     self.log.info('提现记录接口测试结束..')
Beispiel #25
0
 def test_my_attach(self):
     u'测试我的讲义接口'
     self.log.info('开始测试我的讲义接口')
     url = 'http://api.meet.sunnycare.cc/v2/attach/mine'
     json_data = {
         "token":self.uid_token,
         "timestamp": str(int(time.time())),
         "nonce": get_digit()
     }
     #入参加密
     json_data['sign'] = get_sign(json_data)
     r = self.s.post(url,headers= self.header,json=json_data)
     self.log.info('我的讲义返回的结果是:%s' % r.json())
     self.assertEqual(200,r.json()['code'])
     self.assertEqual('请求成功.',r.json()['note'])
     #下面将讲义的code写入excel供后面用例调用
     self.log.info('我的讲义接口测试结束!')
Beispiel #26
0
 def test_live_list02(self):
     u'我的直播课列表-角色为讲师'
     self.log.info('我的直播列表测试开始..')
     url = 'http://api-live.sunnycare.cc/v1/live/mine'
     json_data = {
         'token': self.uid_token,
         'timestamp': str(int(time.time())),
         'pageIndex': '1',
         'isTeacher': '1',  #1:讲师 0:听众
         'nonce': get_digit()
     }
     json_data['sign'] = get_sign(json_data)
     r = self.s.post(url, headers=self.header, json=json_data)
     self.log.info('我的直播列表返回:%s' % r.json())
     self.assertEqual(200, r.json()['code'])
     self.assertEqual('请求成功', r.json()['note'])
     self.log.info('我的直播列表测试结束\n')
Beispiel #27
0
 def test_bind_account02(self):
     u'解除绑定账号接口'
     self.log.info('开始测试解除绑定账号接口..')
     url = 'http://api-rec.sunnycare.cc/v1/account/unbind'
     json_data = {
         'token': self.to,
         'timestamp': str(int(time.time())),
         'type': '0',  #0,支付宝;1,微信
         'nonce': get_digit()
     }
     json_data['sign'] = get_sign(json_data)
     r = self.s.post(url, headers=self.header, json=json_data)
     self.log.info('解除绑定支付宝返回:%s' % r.json())
     #断言
     self.assertEqual(200, r.json()['code'], msg='返回状态码不是200')
     self.assertEqual('请求成功', r.json()['note'])
     self.log.info('解除绑定账号接口测试结束!\n')
 def test_live_lesson_list02(self):
     u'直播课程列表接口-进行中的直播'
     self.log.info('直播课程列表接口-进行中状态列表')
     url = 'http://api-live.sunnycare.cc/v1/live/index'
     json_data = {
         'token': self.uid_token,
         'timestamp': str(int(time.time())),
         'pageIndex': '1',
         'pageLimit': '10',
         'nonce': get_digit(),
         'status': '1'  #直播课程状态 0.未开始 1.进行中 2.已结束(可选)
     }
     json_data['sign'] = get_sign(json_data)
     r = self.s.post(url, headers=self.header, json=json_data)
     self.log.info('进行中的直播课程返回:%s' % r.json())
     self.assertEqual(200, r.json()['code'])
     self.log.info('直播课程列表接口-进行中列表测试结束!\n')
Beispiel #29
0
 def test_bind_account01(self):
     u'绑定提现账号接口'
     self.log.info('开始测试绑定账号接口..')
     url = 'http://api-rec.sunnycare.cc/v1/account/bind'
     json_data = {
         'token': self.to,
         'timestamp': str(int(time.time())),
         'alipay_account': '2088012687108144',
         'real_name': '许广会',
         'nick_name': '许广会',
         'nonce': get_digit()
     }
     json_data['sign'] = get_sign(json_data)
     r = self.s.post(url, headers=self.header, json=json_data)
     self.log.info('绑定支付宝返回:%s' % r.json())
     #断言
     self.assertEqual(200, r.json()['code'], msg='返回状态码不是200')
     self.assertEqual('请求成功', r.json()['note'])
     self.log.info('绑定账号接口测试结束!\n')
Beispiel #30
0
 def test_buyed_lesson3(self):
     u'这是测试已购课程接口-课程类型为所有专栏'
     self.log.info('-----开始测试已购课程接口(课程类型是所有专栏)------')
     url = 'http://api.lesson.sunnycare.cc/v1/orders'
     json_data = {
         "timestamp":str(time.time()),
         "product_type":"3",
         "token":self.uid_token,
         "time":"0",
         "nonce": get_digit()
     }
     json_data['sign'] = get_sign(json_data)
     r = self.s.post(url,headers = self.header,json=json_data)
     try:
         self.log.info('断言请求接口是否成功!')
         self.log.info('返回的内容是:%s' % r.json())
         self.assertEqual('请求成功.',r.json()['note'])
     except Exception as e:
         raise AssertionError
         self.log.error('请求已购课程接口失败,原因:%s' % e)