Exemplo n.º 1
0
class Feedback(unittest.TestCase):
    def setUp(self):
        self.s = requests.session()
        self.lgin = LG(self.s)  #实例化登录类
        self.uid_token = self.lgin.get_token()  #直接取账号登录的token
        self.auto_login_token = self.lgin.get_autologin_token()  #取自动登录的token
        self.header = {
            'User-Agent': 'LanTingDoctor/2.0.2 (iPad; iOS 10.1.1; Scale/2.00)',
            'Accept-Encoding': 'gzip, deflate',
            'Accept-Language': 'zh-Hans-CN;q=1',
            'Content-Type': 'application/json',
            'requestApp': '3',
            'requestclient': '2',
            'versionForApp': '2.0',
            'Authorization':
            'Basic YXBpTGFudGluZ0BtZWRsYW5kZXIuY29tOkFwaVRobWxkTWxkQDIwMTM=',
            'Connection': 'keep-alive'
        }
        self.log = Log()

    @unittest.skip('无理由跳过!')
    def test_feedback(self):
        u'测试一键反馈接口'
        self.log.info('测试意见反馈只反馈文字')
        url = 'http://api.rih.medohealth.com/API/V1/UserFeedBack/addAUserFeedBack'
        json_data = {
            "ufbTitle": "反馈信息",
            "ufbUIUID": "IKxSa8XhbiJH1CYlwQvkW50oLefZ62uB",
            "ufbDesc": "urjrjfjfjfjfjfjrjrjjffjj",
            "token": self.auto_login_token,
            "ufbImages": "[]",
        }
        r = self.s.post(url, headers=self.header, json=json_data)
        print(r.json())
        self.assertEqual('反馈成功', r.json()['msg'], msg='只反馈文字出错了')
        self.log.info('意见反馈只反馈文字成功!')

        self.log.info('测试意见反馈反馈图片和文字:')
        json_data2 = {
            "ufbTitle": "反馈信息",
            "ufbUIUID": "IKxSa8XhbiJH1CYlwQvkW50oLefZ62uB",
            "ufbDesc": "南京今天",
            "ufbImages": "[\"feedbackimages\/23411.png\"]",
            "token": ""
        }
        r2 = self.s.post(url, headers=self.header, json=json_data2)
        print('r2', r2.json())
        self.assertEqual('反馈成功', r.json()['msg'], msg='反馈出错了')
        self.log.info('测试意见反馈反馈图片和文字成功!')

    def tearDown(self):
        self.s.close()
Exemplo n.º 2
0
 def setUp(self):
     self.s = requests.session()
     self.lgin = LG(self.s) #实例化登录类
     self.uid_token = self.lgin.login() #登录
     self.header = {'User-Agent': 'LanTingDoctor/1.3.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': '3',
                    'requestclient': '2',
                    'versionForApp': '2.0',
                    'Authorization': 'Basic YXBpTGFudGluZ0BtZWRsYW5kZXIuY29tOkFwaVRobWxkTWxkQDIwMTM=',
                    'Connection': 'keep-alive'}
     self.log = Log()
Exemplo n.º 3
0
class Query(unittest.TestCase):
    def setUp(self):
        self.log = Log()
        self.s = requests.session()
        self.lgin = LG(self.s)  #实例化登录类
        self.uid_token = self.lgin.gettoken_loginbyUID()  #直接取第二部登录
        self.header = {
            'User-Agent': 'LanTingDoctor/1.3.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': '3',
            'requestclient': '2',
            'versionForApp': '2.0',
            'Authorization':
            'Basic YXBpTGFudGluZ0BtZWRsYW5kZXIuY29tOkFwaVRobWxkTWxkQDIwMTM=',
            'Connection': 'keep-alive'
        }

    @unittest.skip('no reason')
    def test_query_hosName(self):
        u'模糊查询医院接口'
        url = 'http://api.rih.medohealth.com/API/V1/DoctorInfo/SeacherHosName'
        content = [' ', '南京', '02182', '麦澜德']  #模糊查询的内容

        for i in content:
            print(i)
            json_data = {"token": self.uid_token, "query": i}
            print(json_data)

            r = self.s.post(url, headers=self.header, json=json_data)
            self.assertEqual('Success', r.json()['msg'], '查询出错')

    def tearDown(self):
        self.s.close()
Exemplo n.º 4
0
class AddLearnRecord(unittest.TestCase):
    def setUp(self):
        self.s = requests.session()
        self.lgin = LG(self.s)  #实例化登录类
        self.uid_token = self.lgin.login()  #直接取第二部登录
        self.header = {
            'User-Agent': 'LanTingDoctor/1.3.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': '3',
            'requestclient': '2',
            'versionForApp': '2.0',
            'Authorization':
            'Basic YXBpTGFudGluZ0BtZWRsYW5kZXIuY29tOkFwaVRobWxkTWxkQDIwMTM=',
            'Connection': 'keep-alive'
        }
        self.log = Log()

    def test_addlearn_record(self):
        u'测试增加学习记录接口'
        self.log.info('--------开始测试增加学习记录接口---------')
        url = 'http://api.lesson.sunnycare.cc/v1/learn/chapadd'
        L = ['J00201']
        for i in L:
            #加入nonce
            json_data = {
                "chap_code": i,
                "timestamp": str(int(time.time())),
                "token": self.uid_token,
                "nonce": get_digit()
            }
            #加入sign
            json_data['sign'] = get_sign(json_data)
            r = self.s.post(url, headers=self.header, json=json_data)
            try:
                self.log.info('请求返回的数据是%s' % r.json())
                self.assertEqual('请求成功', r.json()['note'])
            except Exception as e:
                raise AssertionError
                self.log.error('增加章节学习记录请求失败,原因是:%s' % e)
        '''
        #数据库查询出章节code,循环加入学习
        i = 0
        while i < len(chapters):

            json_data = {"chap_code":chapters[i][0].__str__(),
                         "timestamp":str(time.time()),
                         "token":self.uid_token}
            r = self.s.post(url,headers = self.header,json=json_data)
            try:
                self.log.info('请求返回的数据是%s' % r.json())
                self.assertEqual('请求成功',r.json()['note'])
            except Exception as e:
                self.log.error('增加'+ chapters[i][0].__str__() +'章节学习记录请求失败,原因是:%s' % e )
            i += 1
        '''

    def tearDown(self):
        self.s.close()
Exemplo n.º 5
0
class Attach(unittest.TestCase):
    def setUp(self):
        self.s = requests.session()
        self.lgin = LG(self.s)  #实例化登录类
        self.uid_token = self.lgin.gettoken_loginbyUID()  #直接取第二部登录
        self.header = {
            'User-Agent': 'LanTingDoctor/1.3.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': '3',
            'requestclient': '2',
            'versionForApp': '2.0',
            'Authorization':
            'Basic YXBpTGFudGluZ0BtZWRsYW5kZXIuY29tOkFwaVRobWxkTWxkQDIwMTM=',
            'Connection': 'keep-alive'
        }
        self.log = Log()  #实例化日志的类

    @unittest.skip('无理由')
    def test_download_attach(self):
        u'下载讲义接口'
        url = 'http://api.meet.sunnycare.com/v2/attach/mine'
        json_data = {"token": self.uid_token, "attach_code": 'ss'}
        r = self.s.post(url, headers=self.header, json=json_data)

    def tearDown(self):
        self.s.close()
Exemplo n.º 6
0
 def setUp(self):
     #banner获取接口
     self.s = requests.session()
     self.lgin = LG(self.s) #实例化登录类
     self.uid_token = self.lgin.login() #直接取第二部登录
     self.header = {'User-Agent': 'LanTingDoctor/1.3.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': '3',
                    'requestclient': '2',
                    'versionForApp': '2.0',
                    'Authorization': 'Basic YXBpTGFudGluZ0BtZWRsYW5kZXIuY29tOkFwaVRobWxkTWxkQDIwMTM=',
                    'Connection': 'keep-alive'
                    }
     self.log = Log()
     self.EXCEL = Excel_util(r'C:\Users\Administrator\Desktop\Interface_testcase.xls')
Exemplo n.º 7
0
class Test_pay(unittest.TestCase):
    def setUp(self):
        self.s = requests.session()
        self.lgin = LG(self.s)  #实例化登录类
        self.uid_token = self.lgin.login()  #登录
        self.header = {
            'User-Agent': 'LanTingDoctor/1.3.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': '3',
            'requestclient': '2',
            'versionForApp': '2.0',
            'Authorization':
            'Basic YXBpTGFudGluZ0BtZWRsYW5kZXIuY29tOkFwaVRobWxkTWxkQDIwMTM=',
            'Connection': 'keep-alive'
        }

    def test_lesson_frontpage(self):
        u'测试课程首页接口'
        url = 'http://api.lesson.sunnycare.cc/v1/rec'  #测试环境接口
        json_data = {
            "timestamp": "1523937360",
            "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())
        #判断返回状态
        try:
            self.assertEqual('请求成功.', r.json()['note'], msg='请求返回状态不是200,有问题')
        except Exception as e:
            raise AssertionError
            print('首页请求失败:%s' % e)

        imagelinks = []
        links = []
        L = r.json()['data']['banner_list']
        print(L)
        #将返回json中所有照片链接放进[]
        for i in L:
            imagelinks.append(i['image'])
            links.append(i['link'])
        print('照片链接:%s' % imagelinks)
        print('内容链接:%s' % links)
        #下面测试banner=图片链接是否可用
        for image in imagelinks:
            r1 = self.s.get(image)
            self.assertEqual(200, r1.status_code, msg='banner图片链接打开失败')
        #下面测试banner链接是否可用
        for link in links:
            r2 = self.s.get(link)
            self.assertEqual(200, r2.status_code, msg='banner链接打开失败')

    def tearDown(self):
        self.s.close()
Exemplo n.º 8
0
class ColumnInfo(unittest.TestCase):
    def setUp(self):
        self.s = requests.session()
        self.lgin = LG(self.s)  #实例化登录类
        self.uid_token = self.lgin.login()  #登录澜渟医生测试环境
        self.header = {
            'User-Agent': 'LanTingDoctor/1.3.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': '3',
            'requestclient': '2',
            'versionForApp': '2.0',
            'Authorization':
            'Basic YXBpTGFudGluZ0BtZWRsYW5kZXIuY29tOkFwaVRobWxkTWxkQDIwMTM=',
            'Connection': 'keep-alive'
        }
        self.EXCEL = Excel_util(
            r'C:\Users\Administrator\Desktop\Interface_testcase.xls')

    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!')

    def tearDown(self):
        self.s.close()
Exemplo n.º 9
0
class ColumnList(unittest.TestCase):
    def setUp(self):
        self.s = requests.session()
        self.lgin = LG(self.s)  #实例化登录类
        self.uid_token = self.lgin.login()
        self.header = {
            'User-Agent': 'LanTingDoctor/1.3.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': '3',
            'requestclient': '2',
            'versionForApp': '2.0',
            'Authorization':
            'Basic YXBpTGFudGluZ0BtZWRsYW5kZXIuY29tOkFwaVRobWxkTWxkQDIwMTM=',
            'Connection': 'keep-alive'
        }
        self.EXCEL = Excel_util(
            r'C:\Users\Administrator\Desktop\Interface_testcase.xls')
        self.log = Log()

    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('专栏列表接口测试结束!!')

    def tearDown(self):
        self.s.close()
Exemplo n.º 10
0
class TestInvoice(unittest.TestCase):
    def setUp(self):
        self.s = requests.session()
        self.lgin = LG(self.s)  #实例化登录类
        self.uid_token = self.lgin.login()  #登录
        self.excel = Excel_util(
            r'C:\Users\Administrator\Desktop\Interface_testcase.xls')
        self.header = {
            'User-Agent': 'LanTingDoctor/1.3.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': '3',
            'requestclient': '2',
            'versionForApp': '1.3',
            'Authorization':
            'Basic YXBpTGFudGluZ0BtZWRsYW5kZXIuY29tOkFwaVRobWxkTWxkQDIwMTM=',
            'Connection': 'keep-alive'
        }

    def test_invoice(self):
        u'测试我的发票获取接口'
        url = 'http://api.exam.sunnycare.cc/v1/myInvoices'

        json_data2 = {"token": self.uid_token}  #请求的参数上一接口返回的token
        print(json_data2)
        r = self.s.post(url, headers=self.header, json=json_data2)
        self.excel.write_value(6, 5, r.json())
        self.assertEqual('请求成功.', r.json()['note'], msg='请求我的发票接口没有成功')
        list1 = r.json()['data']['list']
        global d
        d = {}
        x = 1
        for i in list1:
            d['code' + str(x)] = i['code']
            x += 1
        self.excel.write_value(6, 6, d)

    def test_invoice_detail(self):
        u'测试查看发票详情接口'
        url = 'http://api.exam.sunnycare.cc/v1/myInvoiceDetail'

        #for循环一次去请求每张发票详情
        for value in d.values():
            print('value', value)
            json_data = {"token": self.uid_token, "inv_code": value}
            r = self.s.post(url, headers=self.header, json=json_data)
            print(r.json())
            self.assertEqual('请求成功.', r.json()['note'], msg='发票详情获取失败!')

    def tearDown(self):
        self.s.close()
Exemplo n.º 11
0
    def test_banner(self):
        u'首页banner接口'
        self.s = requests.session()
        lgin = LG(self.s)  #实例化登录类
        uid_token = lgin.login()  #直接取第二部登录
        url = 'http://api.meet.sunnycare.cc/v2/banner'
        json_data = {"token": uid_token, "timestamp": int(time.time())}
        r = self.s.post(url, headers=self.header, json=json_data)
        d = r.json()['data']
        #取出链接,打开,判断状态码
        print(d)
        '''
        links = [x['link'] for x in d]
        for n in links:
            re = self.s.get(n)
            self.assertEqual(200,re.status_code,msg='这个链接有问题'+n+'!')
        '''
        #取出图片链接,打开,判断状态码
        image_links = [x['image'] for x in d]

        for y in image_links:
            re = self.s.get(y)
            self.assertEqual(200, re.status_code, msg='这个链接有问题' + y + '!')
Exemplo n.º 12
0
class Con(unittest.TestCase):
    def setUp(self):
        self.s = requests.session()
        self.lgin = LG(self.s)  #实例化登录类
        self.uid_token = self.lgin.login()  #直接取第二部登录
        self.header = {
            'User-Agent': 'LanTingDoctor/1.3.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': '3',
            'requestclient': '2',
            'versionForApp': '2.0',
            'Authorization':
            'Basic YXBpTGFudGluZ0BtZWRsYW5kZXIuY29tOkFwaVRobWxkTWxkQDIwMTM=',
            'Connection': 'keep-alive'
        }
        self.log = Log()  #实例化日志的类
        self.exel = Excel_util(
            r'C:\Users\Administrator\Desktop\interface_testcase.xls')

    def test_delete_contacts(self):
        u'删除联系人接口'
        self.log.info('删除联系人接口测试开始!')
        url = 'http://api.meet.sunnycare.cc/v2/contact/del'
        #读取contact_code
        code = self.exel.read_value(15, 6)
        be_code = json.loads(code)
        #如果非空
        if code:
            for v in be_code.values():
                json_data = {
                    "token": self.uid_token,
                    "contact_code": v,  #读取excel中的code,
                    "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'])
        else:
            self.log.warning('参会人code为空')
        self.log.info('删除联系人接口测试结束!!')

    def tearDown(self):
        self.s.close()
Exemplo n.º 13
0
class Tickets(unittest.TestCase):
    def setUp(self):
        self.s = requests.session()
        self.lgin = LG(self.s)  #实例化登录类
        self.uid_token = self.lgin.login()  #直接取第二部登录
        self.header = {
            'User-Agent': 'LanTingDoctor/1.3.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': '3',
            'requestclient': '2',
            'versionForApp': '2.0',
            'Authorization':
            'Basic YXBpTGFudGluZ0BtZWRsYW5kZXIuY29tOkFwaVRobWxkTWxkQDIwMTM=',
            'Connection': 'keep-alive'
        }
        self.log = Log()  #实例化日志的类
        self.excel = Excel_util(
            r'C:\Users\Administrator\Desktop\Interface_testcase.xls')

    def test_ticke_info(self):
        u'会议门票详情接口'
        self.log.info('开始测试会议门票详情接口')
        url = 'http://api.meet.sunnycare.cc/v2/ticket/order'
        #读取ticket_order_code
        read_code = self.excel.read_value(16, 6)
        be_use_code = json.loads(read_code)
        for v in be_use_code.values():
            json_data = {
                "token": self.uid_token,
                "ticket_order_code": v,
                "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的门票详情返回的结果是:%s' % (v, r.json()))
            self.assertEqual('请求成功.', r.json()['note'])

        self.log.info('会议门票详情接口测试结束!')

    def tearDown(self):
        self.s.close()
Exemplo n.º 14
0
class ColumnInfo(unittest.TestCase):
    def setUp(self):
        self.s = requests.session()
        self.lgin = LG(self.s)  #实例化登录类
        self.uid_token = self.lgin.login()  #直接取第二部登录
        self.header = {
            'User-Agent': 'LanTingDoctor/1.3.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': '3',
            'requestclient': '2',
            'versionForApp': '2.0',
            'Authorization':
            'Basic YXBpTGFudGluZ0BtZWRsYW5kZXIuY29tOkFwaVRobWxkTWxkQDIwMTM=',
            'Connection': 'keep-alive'
        }
        self.log = Log()  #实例化日志的类

    def testAvailabelCoupon(self):
        u'测试可领用优惠券列表接口'
        self.log.info('-----开始测试可领的优惠券列表接口-------')
        url = 'http://api.lesson.sunnycare.cc/v1/coupon/canget'
        json_DATA = {
            "where_code": "K00112",
            "timestamp": str(int(time.time())),
            "for_where": "2",
            "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)
        try:
            self.log.info('开始断言请求该接口返回的状态是否成功')
            self.assertEqual('请求成功.', r.json()['note'])
        except Exception as e:
            raise AssertionError
            self.log.error('请求接口返回不成功,原因:%s' % e)
        self.log.info('---------------测试接口结束--------------------')
        print(r.json())

    def tearDown(self):
        self.s.close()
Exemplo n.º 15
0
class Contact(unittest.TestCase):
    def setUp(self):
        self.s = requests.session()
        self.lgin = LG(self.s) #实例化登录类
        self.uid_token = self.lgin.login() #直接取第二部登录
        self.header = {'User-Agent': 'LanTingDoctor/1.3.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': '3',
                       'requestclient': '2',
                       'versionForApp': '2.0',
                       'Authorization': 'Basic YXBpTGFudGluZ0BtZWRsYW5kZXIuY29tOkFwaVRobWxkTWxkQDIwMTM=',
                       'Connection': 'keep-alive'}
        self.log = Log()#实例化日志的类
        self.excel = Excel_util(r'C:\Users\Administrator\Desktop\interface_testcase.xls')

    def test_contact_list(self):
        u'联系人列表接口'
        self.log.info('参会人列表接口测试开始')
        url = 'http://api.meet.sunnycare.cc/v2/contact/records'
        json_data = {
            "token":self.uid_token,
            "nonce": get_digit(),
            "timestamp": str(int(time.time()))
        }
        #入参加密
        json_data['sign'] = get_sign(json_data)
        r = self.s.post(url,headers = self.header,json=json_data)
        self.log.info('参会人列表返回内容是:%s' % r.json())
        conten = r.json()['data']['content']
        contact_code = {}
        j = 1
        for i in conten:
            contact_code['contact_code'+str(j)] = i['contact_code']
            j += 1
        #将contact_code写入excel供其他借口调用
        self.excel.write_value(15,6,contact_code)
        self.log.info('参会人列表接口测试结束!')

    def tearDown(self):
        self.s.close()
Exemplo n.º 16
0
class MyInvitation(unittest.TestCase):
    def setUp(self):
        self.s = requests.session()
        self.lgin = LG(self.s) #实例化登录类
        self.uid_token = self.lgin.login() #登录
        self.header = {'User-Agent': 'LanTingDoctor/1.3.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': '3',
                       'requestclient': '2',
                       'versionForApp': '2.0',
                       'Authorization': 'Basic YXBpTGFudGluZ0BtZWRsYW5kZXIuY29tOkFwaVRobWxkTWxkQDIwMTM=',
                       'Connection': 'keep-alive'}
        self.log = Log()

    def test_my_invitation(self):
        u'测试我的邀请接口'
        self.log.info('--------开始测试我的邀请接口--------')
        url = 'http://api.lesson.sunnycare.cc/v1/invite/mine'
        json_data = {
            "token":self.uid_token,
            "time":"0",
            "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)
        try:
            self.assertEqual('请求成功.',r.json()['note'])
            self.assertEqual(200,r.json()['code'])
            self.log.info('我的邀请接口请求成功!')
        except Exception as e:
            raise AssertionError
            print(e)
            self.log.error('我的邀请接口请求失败,原因:%s' % e)
        self.log.info('--------我的邀请接口测试结束!--------')

    def tearDown(self):
        self.s.close()
Exemplo n.º 17
0
    def setUpClass(cls):

        cls.s = requests.session()
        cls.lgin = LG(cls.s)  #实例化登录类
        cls.uid_token = cls.lgin.login()  #直接取第二部登录
        cls.header = {
            'RequestClient': '1',
            'RequestApp': '3',
            'VersionForApp': '2.1.0',
            'User-Agent':
            'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.108 Safari/537.36 2345Explorer/8.0.0.13547',
            'Cache-Control': 'max-age=0',
            'Upgrade-Insecure-Requests': '1',
            'X-Requested-With': 'XMLHttpRequest',
            'Content-Type': 'application/json; charset=utf-8',
            #'Content-Length': '55',
            'Connection': 'Keep-Alive',
            'Accept-Encoding': 'gzip'
        }
        cls.log = Log()  #实例化日志的类
        cls.excel = Excel_util(
            r'C:\Users\Administrator\Desktop\Interface_testcase.xls')
Exemplo n.º 18
0
class Attach(unittest.TestCase):
    def setUp(self):
        self.s = requests.session()
        self.lgin = LG(self.s)  #实例化登录类
        self.uid_token = self.lgin.login()  #直接取第二部登录
        self.header = {
            'User-Agent': 'LanTingDoctor/1.3.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': '3',
            'requestclient': '2',
            'versionForApp': '2.0',
            'Authorization':
            'Basic YXBpTGFudGluZ0BtZWRsYW5kZXIuY29tOkFwaVRobWxkTWxkQDIwMTM=',
            'Connection': 'keep-alive'
        }
        self.log = Log()  #实例化日志的类

    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('讲义接口测试结束!')

    def tearDown(self):
        self.s.close()
Exemplo n.º 19
0
class Trian_record(unittest.TestCase):
    def setUp(self):
        self.s = requests.session()
        self.lgin = LG(self.s)  #实例化登录类
        self.uid_token = self.lgin.get_token()  #直接取账号登录的token
        #self.auto_login_token = self.lgin.get_autologin_token() #取自动登录的token
        self.header = {
            'User-Agent': 'LanTingDoctor/2.0.2 (iPad; iOS 10.1.1; Scale/2.00)',
            'Accept-Encoding': 'gzip, deflate',
            'Accept-Language': 'zh-Hans-CN;q=1',
            'Content-Type': 'application/json',
            'requestApp': '3',
            'requestclient': '2',
            'versionForApp': '2.0',
            'Authorization':
            'Basic YXBpTGFudGluZ0BtZWRsYW5kZXIuY29tOkFwaVRobWxkTWxkQDIwMTM=',
            'Connection': 'keep-alive'
        }
        self.log = Log()
        self.excel = Excel_util(
            r'C:\Users\Administrator\Desktop\Interface_testcase.xls')

    def test_get_user_trian_record(self):
        #测试前提是该医生有已绑定的用户
        u'医生根据日期查看用户训练记录接口'
        self.log.info('开始测试医生根据日期查看用户训练记录接口.....')

        #'这是获取已绑定的列表'
        url = 'http://api.rih.sunnycare.cc/API/V1/DoctorToUserReleationShip/getReleathionShipInfo'
        json_data = {"token": self.uid_token}
        r = self.s.post(url, headers=self.header, json=json_data)
        Patients = r.json()['data']
        User_UID = []
        for i in Patients:
            User_UID.append(i['UserUID'])
        print('当前医生绑定的用户的User_UID是:', User_UID)

        #判断当前医生是否有绑定的用户来执行不同操作
        if len(User_UID) >= 1:
            #如果有绑定的用户则:
            url2 = 'http://api.rih.sunnycare.cc/API/V1/UserTrainRecord/getUserTrainRecordByDoctorAndYearMonth'
            #列表存的是月份
            L = ['01', '02', '03', '04', '05', '06']
            for i in L:
                json_data2 = {
                    "userUID": "hms7W3a1nG54IeBD6C9qtiuw82TjZVMQ",
                    "year": "2018",
                    "token": self.uid_token,
                    "month": i
                }
                r2 = self.s.post(url2, headers=self.header, json=json_data2)
                print(r2.json())
                self.assertEqual(200, r2.json()['code'])

        else:
            self.log.warning('该医生还没有绑定的用户!')

        self.log.info('医生根据日期查看用户训练记录接口测试结束!!')

    def test_user_plan_trian_record(self):
        u'医生查看用户某一方案的治疗记录'
        self.log.info('开始测试医生查看用户某一方案训练记录接口.....')

        #'这是获取已绑定的列表'
        url = 'http://api.rih.sunnycare.cc/API/V1/DoctorToUserReleationShip/getReleathionShipInfo'
        json_data = {"token": self.uid_token}
        r = self.s.post(url, headers=self.header, json=json_data)
        Patients = r.json()['data']
        User_UID = []
        for i in Patients:
            User_UID.append(i['UserUID'])
        print('当前医生绑定的用户的User_UID是:', User_UID)

        #判断当前医生是否有绑定的用户来执行不同操作
        if len(User_UID) >= 1:
            #将excel中courseid 读取出来
            read_course_id = self.excel.read_value(11, 6)
            #将json转换成可用的dict
            need_course_id = json.loads(read_course_id)
            print(need_course_id)

            for c in need_course_id.values():
                url3 = 'http://api.rih.sunnycare.cc/API/V1/UserTrainRecord/getUserTrainRecordByCourseUIDForDoctor'
                json_data3 = {
                    "token": self.uid_token,
                    "userUID": User_UID[0],
                    "courseUID": c
                }
                r3 = self.s.post(url3, headers=self.header, json=json_data3)
                #断言结果
                self.assertEqual(200, r3.json()['code'])

        else:
            self.log.warning('该医生还没有绑定的用户!')

        self.log.info('医生查看用户某一方案训练记录接口测试结束!!')

    def tearDown(self):
        self.s.close()
Exemplo n.º 20
0
class Trian(unittest.TestCase):
    def setUp(self):
        self.s = requests.session()
        self.lgin = LG(self.s)  #实例化登录类
        self.uid_token = self.lgin.get_token()  #直接取账号登录的token
        self.auto_login_token = self.lgin.get_autologin_token()  #取自动登录的token
        self.header = {
            'User-Agent': 'LanTingDoctor/2.0.2 (iPad; iOS 10.1.1; Scale/2.00)',
            'Accept-Encoding': 'gzip, deflate',
            'Accept-Language': 'zh-Hans-CN;q=1',
            'Content-Type': 'application/json',
            'requestApp': '3',
            'requestclient': '2',
            'versionForApp': '2.0',
            'Authorization':
            'Basic YXBpTGFudGluZ0BtZWRsYW5kZXIuY29tOkFwaVRobWxkTWxkQDIwMTM=',
            'Connection': 'keep-alive'
        }
        self.log = Log()
        self.excel = Excel_util(
            r'C:\Users\Administrator\Desktop\Interface_testcase.xls')

    def test_get_user_plan(self):
        u'医生获取用户训练方案接口'
        self.log.info('开始测试医生查看用户训练方案接口.....')

        #'这是获取已绑定的列表'
        url = 'http://api.rih.medohealth.com/API/V1/DoctorToUserReleationShip/getReleathionShipInfo'
        json_data = {"token": self.auto_login_token}
        r = self.s.post(url, headers=self.header, json=json_data)
        Patients = r.json()['data']
        User_UID = []
        for i in Patients:
            User_UID.append(i['UserUID'])
        print(User_UID)

        #判断当前医生是否有绑定的用户来执行不同操作
        if len(User_UID) >= 1:
            #当绑定不为空时,医生再去获取用户的方案
            for id in User_UID:
                url_2 = 'http://api.rih.medohealth.com/API/V1/UserTrainCourse/getUserTrainCourseByDoctor'
                json_data_2 = {"token": self.auto_login_token, "userUID": id}
                r2 = self.s.post(url_2, headers=self.header, json=json_data_2)
                self.assertEqual(200, r2.json()['code'])
                plans = r2.json()['data']
            #将方案的course id写入excel供调用
            course_ids = {}
            n = 1
            for p in plans:
                #print(p)
                course_ids['corse_id_' + str(n)] = p['utcUID']
                n += 1
            self.excel.write_value(11, 6, course_ids)

        else:
            self.log.warning('该医生还没有绑定的用户!')

        self.log.info('医生查看用户训练方案接口测试结束!')

    def test_get_doctor_plan(self):
        u'医生获取训练方案接口'
        self.log.info('开始测试医生的训练方案接口.....')
        url = 'http://api.rih.medohealth.com/API/V1/DoctorTrainCourse/getTrainCourseForDoctor'
        json_data = {"token": self.auto_login_token}
        r = self.s.post(url, headers=self.header, json=json_data)
        print(r.json())
        self.assertEqual(200, r.json()['code'])
        self.log.info('医生的训练方案接口测试结束!!')

    def tearDown(self):
        self.s.close()
Exemplo n.º 21
0
class Adress(unittest.TestCase):
    def setUp(self):
        self.log = Log()
        self.s = requests.session()
        self.lgin = LG()  #实例化登录类
        self.uid_token = self.lgin.gettoken_loginbyUID()  #直接取第二部登录
        self.header = {
            'User-Agent': 'LanTingDoctor/1.3.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': '3',
            'requestclient': '2',
            'versionForApp': '2.0',
            'Authorization':
            'Basic YXBpTGFudGluZ0BtZWRsYW5kZXIuY29tOkFwaVRobWxkTWxkQDIwMTM=',
            'Connection': 'keep-alive'
        }
        self.set_nonce = Hash.get_md5(Hash.get_str())
        self.set_sign = Hash.get_md5(Hash.get_str())

    @unittest.skip('无条件跳过')
    def test_All_Adress(self):
        u'获取用户的全部收货地址接口'
        self.log.info('开始测试获取用户的全部收货地址接口')
        url = 'http://api.common.wrightin.com/v1/address/records'
        print(self.set_sign)
        print(self.set_nonce)
        json_data = {
            "nonce": self.set_nonce,
            "timestamp": str(time.time()),
            #"sign":self.set_sign,
            "token": self.uid_token
        }
        r = self.s.post(url, headers=self.header, json=json_data)
        print(r.json())

        if self.assertEqual('请求成功.', r.json()['note']):
            self.log.info('获取用户的全部收货地址接口成功')
        else:
            self.log.error('获取用户的全部收货地址接口失败')

        self.log.info('测试获取用户的全部收货地址接口结束')

    @unittest.skip('无条件跳过')
    def testAddAdress(self):
        u'测试增加收货地址接口'
        self.log.info('开始测试新增收货地址接口')
        url = 'http://api.common.wrightin.com/v1/address/apend'
        json_data = {
            "zone": "江苏省南京市江宁区",
            "content": "南京江宁区气象台",
            "contact_call": "15651797525",
            "contact_name": "许下会",
            "token": self.uid_token,
            "timestamp": "1525674917",
        }
        r = self.s.post(url, headers=self.header, json=json_data)
        print(r.json())
        self.assertEqual('请求成功.', r.json()['note'])

    def tearDown(self):
        self.s.close()
Exemplo n.º 22
0
class Buyed_lesson(unittest.TestCase):
    def setUp(self):
        self.s = requests.session()
        self.lgin = LG(self.s) #实例化登录类
        self.uid_token = self.lgin.login() #登录测试环境澜渟医生
        self.header = {'User-Agent': 'LanTingDoctor/1.3.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': '3',
                       'requestclient': '2',
                       'versionForApp': '2.0',
                       'Authorization': 'Basic YXBpTGFudGluZ0BtZWRsYW5kZXIuY29tOkFwaVRobWxkTWxkQDIwMTM=',
                       'Connection': 'keep-alive'}
        self.log = Log()

    def test_buyed_lesson(self):
        u'这是测试已购课程接口-课程类型为所有'
        self.log.info('-----开始测试已购课程接口(课程类型是所有)------')
        url = 'http://api.lesson.sunnycare.cc/v1/orders'
        json_data = {
            "timestamp":str(int(time.time())),
            "product_type":"",
            "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)


    def test_buyed_lesson2(self):
        u'这是测试已购课程接口-课程类型为所有课程'
        self.log.info('-----开始测试已购课程接口(课程类型是所有课程)------')
        url = 'http://api.lesson.sunnycare.cc/v1/orders'
        json_data = {
            "timestamp":str(int(time.time())),
            "product_type":"2",
            "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)

    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)

    def tearDown(self):
        self.s.close()
Exemplo n.º 23
0
class Contact(unittest.TestCase):
    def setUp(self):
        self.s = requests.session()
        self.lgin = LG(self.s) #实例化登录类
        self.uid_token = self.lgin.login() #直接取第二部登录
        self.header = {'User-Agent':  'LanTingDoctor/1.3.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':  '3',
                       'requestclient':  '2',
                       'versionForApp':  '2.0',
                       'Authorization':  'Basic YXBpTGFudGluZ0BtZWRsYW5kZXIuY29tOkFwaVRobWxkTWxkQDIwMTM=',
                       'Connection':  'keep-alive'}
        self.log = Log()#实例化日志的类
        self.exel = Excel_util(r'C:\Users\Administrator\Desktop\interface_testcase.xls')


    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')

    def test_add_contacts02(self):
        u'添加联系人-姓名过长'
        self.log.info('新增参会人-名称过长')
        url = 'http://api.meet.sunnycare.cc/v2/contact/add'
        json_data = {
            "token": self.uid_token,
            "name": '大于32个字的名字大于32个字的名字大于32个字的名字大于32个字的名字大于32个字的名字大于32个字的名字',
            "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('请求成功.',r.json()['note'])
        self.log.info('新增参会人-名称过长情况测试结束!\n')

    def test_add_contacts03(self):
        u'添加联系人-手机号码格式不正确'
        self.log.info('新增参会人-手机号格式不正确')
        url = 'http://api.meet.sunnycare.cc/v2/contact/add'
        json_data = {
            "token": self.uid_token,
            "name": '司马上官',
            "phone": '6666111122',
            "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(203, r.json()['code'])
        self.log.info('新增参会人-手机号格式不正确情况测试结束!\n')

    def test_add_contacts04(self):
        u'添加联系人-地址为空'
        self.log.info('新增参会人-地址为空')
        url = 'http://api.meet.sunnycare.cc/v2/contact/add'
        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(203, r.json()['code'])
        self.log.info('新增参会人-地址为空情况测试结束!\n')

    @unittest.skip('无理由')
    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('新增参会人-新增人数过多情况测试结束!')

    def tearDown(self):
        self.s.close()
Exemplo n.º 24
0
class ConfigInfo(unittest.TestCase):
    def setUp(self):
        self.s = requests.session()
        self.lgin = LG()  #实例化登录类
        self.uid_token = self.lgin.get_token()  #直接取账号登录的token
        self.auto_login_token = self.lgin.get_autologin_token()  #取自动登录的token
        self.header = {
            'User-Agent': 'LanTingDoctor/2.0.2 (iPad; iOS 10.1.1; Scale/2.00)',
            'Accept-Encoding': 'gzip, deflate',
            'Accept-Language': 'zh-Hans-CN;q=1',
            'Content-Type': 'application/json',
            'requestApp': '3',
            'requestclient': '2',
            'versionForApp': '2.0',
            'Authorization':
            'Basic YXBpTGFudGluZ0BtZWRsYW5kZXIuY29tOkFwaVRobWxkTWxkQDIwMTM=',
            'Connection': 'keep-alive'
        }
        self.log = Log()

    @unittest.skip('无条件跳过')
    def test_config_info(self):
        u'设置医生实名认证信息接口'
        self.log.info('开始测试医生实名认证接口.....')
        url = 'http://api.rih.medohealth.com/API/V1/DoctorInfo/setDoctorInfoandTitle'
        json_data = {
            "id_card": "321324199103041432",
            "image":
            "RightInDoctrorFiles\/Distribute\/TitleAuthentication\/IKxSa8XhbiJH1CYlwQvkW50oLefZ62uB\/84810175026042607520180515134933.png",
            "huid": "A596D422B726308EA01A9EB27D4417C0",
            "key": random.randint(0, 9),
            "token": self.auto_login_token,
            "kuid": "457BDE586E8AD22B683AB5740EDBA9F9",
            "name": "许家印"
        }
        r = self.s.post(url, headers=self.header, json=json_data)
        print(r.json())
        self.assertEqual('更新医生资料成功', r.json()['msg'])
        self.log.info('医生实名认证接口测试结束!')

    @unittest.skip('无条件跳过')
    def test_doctor_profession(self):
        u'设置医生职称接口'
        self.log.info('开始测试设置医生职称.....')
        url = 'http://api.rih.medohealth.com/API/V1/DoctorInfo/SetDoctorTitle'
        json_data = {
            "token": self.auto_login_token,
            "duid": "IKxSa8XhbiJH1CYlwQvkW50oLefZ62uB",
            "data": [{
                #"image":'',
                "key": "learn",
                "code": random.randint(0, 6)
            }]
        }
        r = self.s.post(url, headers=self.header, json=json_data)
        print(r.json())

        self.log.info('设置医生职称接口测试结束!')

    def tearDown(self):
        self.s.close()
Exemplo n.º 25
0
class SystemInfo(unittest.TestCase):
    def setUp(self):
        self.s = requests.session()
        self.lgin = LG(self.s)  #实例化登录类
        self.lgin.login()
        self.uid_token = self.lgin.gettoken_loginbyUID()  #直接取第二部登录
        self.header = {
            'User-Agent': 'LanTingDoctor/2.0.0 (iPad; iOS 10.1.1; Scale/2.00)',
            'Accept-Encoding': 'gzip, deflate',
            'Accept-Language': 'zh-Hans-CN;q=1',
            'Content-Type': 'application/json',
            'requestApp': '3',
            'requestclient': '2',
            'versionForApp': '2.0',
            'Authorization':
            'Basic YXBpTGFudGluZ0BtZWRsYW5kZXIuY29tOkFwaVRobWxkTWxkQDIwMTM=',
            'Connection': 'keep-alive'
        }
        self.log = Log()
        self.Excel = Excel_util(
            r'C:\Users\Administrator\Desktop\Interface_testcase.xls')

    def test_sysinfo_list(self):
        u'测试系统消息列表接口'
        self.log.info('------> 开始测试系统消息列表接口 <-------')
        url = 'http://api.rih.medohealth.com/API/V1/DoctorInfo/doctorInfoWithTelephone'
        url_1 = 'http://api.common.wrightin.com/v1/note/unread'
        url_2 = 'http://api.common.wrightin.com/v1/note/records'
        json_data = {"token": self.uid_token, "Telephone": "15651797525"}

        json_data_1 = {
            "token": self.uid_token,
            "timestamp": '1525245187.2932727'
        }

        json_data_2 = {
            "timestamp": str(time.time()),
            "type": 0,
            "token": self.uid_token,
            "page": 1
        }
        try:
            r = self.s.post(url, headers=self.header, json=json_data)
            r1 = self.s.post(url_1, headers=self.header, json=json_data_1)
            r2 = self.s.post(url_2, headers=self.header, json=json_data_2)
            print(r.json())
            print(r1.json())
            print(r2.json())
        except Exception as e:
            self.log.error('请求系统消息列表失败,原因:%s' % e)
        #self.assertEqual('请求成功.',r.json()['note'])
        self.log.info('------> 测试系统消息列表接口结束 <-------')

    #def test_read_sysinfo(self):
    #  u'测试读取系统信息接口'
    #   self.log.info('------> 开始读取系统信息接口 <-------')
    #   url = 'http://api.common.wrightin.com/v1/note/read'
    #   json_data = {"code":"cd95705e442444ba88d3b1fb8b348484",
    #                "token":self.uid_token}

    def tearDown(self):
        self.s.close()
Exemplo n.º 26
0
class Test_pay(unittest.TestCase):
    def setUp(self):
        self.s = requests.session()
        self.lgin = LG(self.s)  #实例化登录类
        self.token = self.lgin.login()
        self.duid = self.lgin.gettoken_loginbyUID()  #取登录成功后的uid
        self.header = {
            'User-Agent': 'LanTingDoctor/1.3.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': '3',
            'requestclient': '2',
            'versionForApp': '2.0',
            'Authorization':
            'Basic YXBpTGFudGluZ0BtZWRsYW5kZXIuY29tOkFwaVRobWxkTWxkQDIwMTM=',
            'Connection': 'keep-alive'
        }

    def testpayment(self):
        u'测试通用-支付接口-微信支付'
        url = 'http://api.rih.sunnycare.cc/API/V1/DoctorLoginForToken/doctorAutoLoginByUID'  #医生用uid自动登录接口
        json_data1 = {
            "UID": self.duid,
        }
        r = self.s.post(
            url, headers=self.header,
            json=json_data1)  ##医生用uid自动登录接口的请求数据又是登录成功后返回的json中的duid
        t = r.json()['data']['Token']  #取到我想要的token

        json_data2 = {
            'pay_method': '1',
            'product_type': '3',
            'timestamp': str(int(time.time())),
            "token": t,
            "product_code": "Z00028",
            'nonce': get_digit()
        }
        json_data2['sign'] = get_sign(json_data2)  #上一接口返回的token现在用来做请求参数
        url2 = 'http://api.pay.sunnycare.cc/v1/pay'  #支付接口地址
        r2 = self.s.post(url2, headers=self.header, json=json_data2)
        print(r2.json())
        self.assertEqual(200, r2.json()['code'])

    def testpayment2(self):
        u'测试通用-支付接口-支付宝支付'
        url = 'http://api.rih.sunnycare.cc/API/V1/DoctorLoginForToken/doctorAutoLoginByUID'  #医生用uid自动登录接口
        json_data1 = {"UID": self.duid}
        ##医生用uid自动登录接口的请求数据又是登录成功后返回的json中的duid
        r = self.s.post(url, headers=self.header, json=json_data1)
        t = r.json()['data']['Token']  #取到我想要的token

        #上一接口返回的token现在用来做请求参数
        json_data2 = {
            'pay_method': '0',
            'product_type': '3',
            'timestamp': str(int(time.time())),
            "token": t,
            "product_code": "Z00028",
            'nonce': get_digit()
        }
        json_data2['sign'] = get_sign(json_data2)
        url2 = 'http://api.pay.sunnycare.cc/v1/pay'  #支付接口地址
        r2 = self.s.post(url2, headers=self.header, json=json_data2)
        print(r2.json())
        self.assertEqual(200, r2.json()['code'])

    def tearDown(self):
        self.s.close()
Exemplo n.º 27
0
class Wechat_login(unittest.TestCase):
    '''
    APP 编号:澜渟 - 1,澜渟私教 - 2,澜婷医生 - 3;
    客户端类型编号:Android - 1,iOS - 2,PC - 3,Web - 4;
    '''

    def setUp(self):
        self.log = Log()
        self.s = requests.session()
        self.lgin = LG(self.s) #实例化登录类
        self.uid_token = self.lgin.gettoken_loginbyUID() #直接取第二部登录
        self.header1 = {'User-Agent': 'LanTingDoctor/1.3.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': '3',
                       'requestclient': '2',
                       'versionForApp': '2.0',
                       'Authorization': 'Basic YXBpTGFudGluZ0BtZWRsYW5kZXIuY29tOkFwaVRobWxkTWxkQDIwMTM=',
                       'Connection': 'keep-alive'
                       }
        self.log = Log()

    def test_login_by_wechat(self):
        u'测试澜渟医生IOS微信登录接口'
        self.log.info('澜渟医生IOS微信登录接口测试开始')
        url = 'http://api.rih.medohealth.com/API/V1/DoctorLoginForToken/doctorLoginByWeChat'
        json_data = {"WeChatOpenID":"ogCzv1U6KPBJxRu0-LgrHBhRiJpI",
                     "WeChatUnionID":"oh3fH06yJfDB6smX6kJACRNlglVY"
                     }
        r = self.s.post(url,headers = self.header1,json=json_data)
        self.assertEqual('登录成功',r.json()['msg'],msg='澜渟医生IOS微信方式登录失败')

        self.log.info('澜渟医生IOS微信登录接口测试结束')

    def test_login_by_wechat2(self):
        u'澜渟医生测试Andriod微信登录接口'
        self.log.info('澜渟医生Andriod微信登录接口测试开始')
        self.header1['requestclient'] = str(1)
        url = 'http://api.rih.medohealth.com/API/V1/DoctorLoginForToken/doctorLoginByWeChat'
        json_data = {"WeChatOpenID":"ogCzv1U6KPBJxRu0-LgrHBhRiJpI",
                     "WeChatUnionID":"oh3fH06yJfDB6smX6kJACRNlglVY"
                     }
        r = self.s.post(url,headers = self.header1,json=json_data)
        self.log.info('澜渟医生Andriod微信登录返回:%s' % r.json())
        self.assertEqual('登录成功',r.json()['msg'],msg='澜渟医生Andriod微信方式登录失败')

        self.log.info('澜渟医生Andriod微信登录接口测试结束')

    def test_login_by_wechat3(self):
        u'澜渟测试Andriod微信登录接口'
        self.header1['requestApp'] = str(1)
        self.log.info('澜渟Andriod微信登录接口测试开始')
        url = 'http://api.rih.medohealth.com/API/V1/DoctorLoginForToken/doctorLoginByWeChat'
        json_data = {"WeChatOpenID":"ogCzv1U6KPBJxRu0-LgrHBhRiJpI",
                     "WeChatUnionID":"oh3fH06yJfDB6smX6kJACRNlglVY"
                     }
        r = self.s.post(url,headers = self.header1,json=json_data)
        self.log.info('澜渟Andriod微信登录返回:%s' % r.json())
        self.assertEqual('登录成功',r.json()['msg'],msg='澜渟Andriod微信方式登录失败')

        self.log.info('澜渟Andriod微信登录接口测试结束')


    def tearDown(self):
        self.s.close()
Exemplo n.º 28
0
class Meet(unittest.TestCase):
    def setUp(self):
        #banner获取接口
        self.s = requests.session()
        self.lgin = LG(self.s) #实例化登录类
        self.uid_token = self.lgin.login() #直接取第二部登录
        self.header = {'User-Agent': 'LanTingDoctor/1.3.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': '3',
                       'requestclient': '2',
                       'versionForApp': '2.0',
                       'Authorization': 'Basic YXBpTGFudGluZ0BtZWRsYW5kZXIuY29tOkFwaVRobWxkTWxkQDIwMTM=',
                       'Connection': 'keep-alive'
                       }
        self.log = Log()
        self.EXCEL = Excel_util(r'C:\Users\Administrator\Desktop\Interface_testcase.xls')

    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接口测试结束-----------')


    def test_get_meets(self):
        u'测试获取会议接口'
        url = 'http://api.exam.wrightin.com/v1/meetNew'
        self.log.info('------开始获取会议接口测试-------')
        json_data = {
            "token":self.uid_token,
            "time":"0"
        }
        r = self.s.post(url,headers = self.header,json=json_data)
        #判断返回状态
        #print(r.json())
        try:
            self.assertEqual('请求成功.',r.json()['note'])
            self.log.info('获取会议接口返回状态成功')
        except Exception as e:
            self.log.error('返回状态不成功,原因:%s' % e)
            raise AssertionError


        #判断会议内容不为空
        meet_list = r.json()['data']['list']
        try:
            self.assertLessEqual(1,len(meet_list))
            self.log.info('会议内容不为空')
        except Exception as e:
            self.log.error('会议内容为空。原因:%s' % e)
        self.log.info('------获取会议接口测试结束-------')

    def test_meet_info(self):
        u'测试每个具体的会议信息'
        self.log.info('=========开始测试会议信息接口==========')
        #要先获取到每个会议的code
        url_1 = 'http://api.meet.sunnycare.cc/v2/meet/records'
        json_data_1 = {
            "token":self.uid_token,
            "time":"0",
            'timestamp': str(int(time.time())),
            'nonce': get_digit()
        }
        json_data_1['sign'] = get_sign(json_data_1)
        #先获取会议列表
        r1 = self.s.post(url_1,headers = self.header,json=json_data_1)
        #从会议列表中取会议code
        response = r1.json()['data']['list']
        codes = []
        for i in response:
            codes.append(i['code'])
        #print('code::::',codes)
        #循环对每一个会议code获取会议信息
        url_2 = 'http://api.meet.sunnycare.cc/v2/meet'
        #创建考试code list
        exam_codes = []

        for code in codes:
            json_data_2 = {
                "token":self.uid_token,
                "meet_code":code,
                'timestamp': str(int(time.time())),
                'nonce': get_digit()
            }
            json_data_2['sign'] = get_sign(json_data_2)
            r2 = self.s.post(url_2,headers = self.header,json=json_data_2)#json_data可以共用
            #print(r2.json())
            #断言每个会议信息的返回状态
            try:
                self.assertEqual('请求成功.',r2.json()['note'])
                self.log.info('会议信息返回状态成功')
            except Exception as e:
                self.log.error('会议信息返回状态失败,原因:%s' % e)
                raise AssertionError

            #获取试卷code作为关联参数
            d = r2.json()['data']
            exam_codes.append(d['exam_code'])

        #去除exam列表中的空元素
        new_exam_codes = []
        for i in exam_codes:
            if i != '':
                new_exam_codes.append(i)
        print('exam code:' ,new_exam_codes)
        #将exam code 以字典格式写入excel
        D = {}
        x = 1
        for i in new_exam_codes:
            D['exam_code'+ str(x)] = i
            x += 1
        self.EXCEL.write_value(3,5,json.dumps(D))
        self.log.info('=========测试会议信息接口结束==========')


    def test_exam_msg(self):
        u'测试获取考试信息 接口'
        self.log.info('-----------开始测试获取考试信息 接口-----------')
        #之前写入excel是str类型,现在转换为dict类型
        exam_codes = json.loads(self.EXCEL.read_value(3,5))
        self.log.info('读取的考试code是:%s' % exam_codes)
        url = 'http://api.exam.sunnycare.cc/v1/examMsgByMeetCode'
        #循环字典的value作为examcode
        for value in exam_codes.values():
            json_data = {
                "token":self.uid_token,
                "examcode":value,
                "userid":"107dfd1c1ade4a0f820e4897491710c6"
            }
            r = self.s.post(url,headers=self.header,json=json_data)
            try:
                self.assertEqual('请求成功.',r.json()['note'])
                self.log.info('考试信息获取成功!')
            except Exception as e:
                self.log.error('考试信息获取失败,原因是:%s' % e)
                raise AssertionError

        self.log.info('-----------开始测试获取考试信息 接口测试结束!-----------')

    def tearDown(self):
        self.s.close()
Exemplo n.º 29
0
class Mystudy(unittest.TestCase):

    def setUp(self):
        self.s = requests.session()
        self.lgin = LG(self.s) #实例化登录类
        self.uid_token = self.lgin.login() #登录
        self.header = {
            'User-Agent': 'LanTingDoctor/2.0.2 (iPad; iOS 10.1.1; Scale/2.00)',
            'Accept-Encoding': 'gzip, deflate',
            'Accept-Language': 'zh-Hans-CN;q=1',
            'Content-Type': 'application/json',
            'requestApp': '3',
            'requestclient': '2',
            'versionForApp': '2.0',
            'Authorization': 'Basic YXBpTGFudGluZ0BtZWRsYW5kZXIuY29tOkFwaVRobWxkTWxkQDIwMTM=',
            'Connection': 'keep-alive'
        }
        self.log = Log()
        self.excel = Excel_util(r'C:\Users\Administrator\Desktop\Interface_testcase.xls')

    def test_mystudy(self):
        u'测试我的学习接口'
        self.log.info('-----开始测试测试我的学习接口-----')
        url = 'http://api.lesson.sunnycare.cc/v1/learns'
        json_data = {
            "token":self.uid_token,
            "time": "0",
            "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()['note'])
        lessons = r.json()['data']['list']

        #定义全局变量 学习code
        global study_codes
        study_codes = []
        for i in lessons:
            study_codes.append(i['code'])
        print('study_codes:  ',study_codes)

        #课程code
        lesson_codes = []
        for x in lessons:
            lesson_codes.append(x['lesson_code'])
        print('lesson_codes',lesson_codes)
        #创建字典 写入excel
        m = {}
        j = 1
        for z in lesson_codes:
            m['lessoncode'+ str(j)] = z
            j += 1
        self.excel.write_value(7,6,m)

        self.log.info('----测试我的学习接口结束----')

    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_remove_study(self):
        u'这是测试取消加入学习接口'
        self.log.info('-----开始测试测试取消加入学习接口--------')
        url = 'https://api.lesson.wrightin.com/v1/learn/remove'
        for i in study_codes:
            json_data = {
                "timestamp":str(time.time()),
                "learn_code":i,
                "token":self.uid_token
            }
            try:
                r2 = self.s.post(url,headers = self.header,json=json_data)
                self.assertEqual('请求成功',r2.json()['note'])
                self.log.info('取消加入学习成功')
            except Exception as e:
                self.log.error('取消介入学习失败。原因:%s' % e)
        self.log.info('-------测试取消加入学习接口结束------')
    '''

    def tearDown(self):
        self.s.close()
Exemplo n.º 30
0
class LessonInfo(unittest.TestCase):
    log = Log()  #实例化记录日志的类

    def setUp(self):
        self.s = requests.session()
        self.lgin = LG(self.s)  #实例化登录类
        self.uid_token = self.lgin.login()
        self.header = {
            'User-Agent': 'LanTingDoctor/1.3.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': '3',
            'requestclient': '2',
            'versionForApp': '2.0',
            'Authorization':
            'Basic YXBpTGFudGluZ0BtZWRsYW5kZXIuY29tOkFwaVRobWxkTWxkQDIwMTM=',
            'Connection': 'keep-alive'
        }

    def testMyCouponList(self):
        u'测试我的优惠券列表接口--可用'
        self.log.info('-----------开始测试我的可用优惠券列表接口-------------')
        url = 'http://api.lesson.sunnycare.cc/v1/coupon/mine'
        #0.不可用/1.可用
        json_data = {
            "can_use": "1",
            "timestamp": str(int(time.time())),
            "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, verify=False)
        self.log.info('返回的可用优惠券参数是:%s' % r.json())

        try:
            self.assertEqual('请求成功.', r.json()['note'])
        except Exception as e:
            raise AssertionError
            self.log.error('请求可用优惠券列表没有成功:%s' % e)
        #判断优惠券个数,如果个数不为0 ,那么优惠券不能重复!
        L = []
        coupons = r.json()['data']['list']
        if len(coupons) != 0:
            for x in coupons:
                L.append(x['code'])
        else:
            self.log.info('可用优惠券个数为空')
        self.log.info('可用优惠券的code是:%s' % L)

        #将code列表转为集合 set set会自动剔除重复的元素 以转为set后的长度来判断是否存在重复code
        s = set(L)
        if len(s) < len(L):
            self.log.error('可用优惠券存在重复的情况')
        self.log.info('--------我的可用优惠券列表接口测试结束----')

    def testMyCouponList2(self):
        u'测试我的优惠券列表接口--不可用'
        self.log.info('-----------开始测试我的不可用优惠券列表接口-------------')
        url = 'http://api.lesson.sunnycare.cc/v1/coupon/mine'
        #0.不可用/1.可用
        json_data = {
            "can_use": "0",
            "timestamp": str(int(time.time())),
            "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, verify=False)
        self.log.info('返回的不可用优惠券json是:%s' % r.json())

        try:
            self.assertEqual('请求成功.', r.json()['note'])
        except Exception as e:
            raise AssertionError
            self.log.error('请求不可用优惠券列表没有成功:%s' % e)
        #判断优惠券个数,如果个数不为0 ,那么优惠券不能重复!
        L = []
        coupons = r.json()['data']['list']

        if len(coupons) != 0:
            for x in coupons:
                L.append(x['code'])
        else:
            self.log.info('不可用优惠券个数为空')
        self.log.info('不可用优惠券的code是:%s' % L)

        #将code列表转为集合 set set会自动剔除重复的元素 以转为set后的长度来判断是否存在重复code
        s = set(L)
        if len(s) < len(L):
            self.log.error('不可用优惠券存在重复的情况')
        self.log.info('--------不可用优惠券列表接口测试结束----')

    def tearDown(self):
        self.s.close()