Example #1
0
    def test_password_login_02(self, phone="15300752900", password="******"):
        '''密码登录--手机号未注册,phone: 15300752900,password: 111111'''
        log.info("***手机号未注册登录***")
        host = re_data_yaml.get_host()
        h = re_data_yaml.get_headers()
        url = host + "/api/user_password_login"
        body = {"phone": phone, "password": password}
        r = requests.post(url, headers=h, data=body)
        result = r.json()

        self.assertEqual(result['code'], 201)
        self.assertEqual(result['message'], '用户未注册')
Example #2
0
    def test_send_verify_code_01(self, phone="153", request_id="tjg0w4"):
        '''验证码登录--手机号码长度错误,phone: 153'''
        log.info("***手机号错误登录***")
        host = re_data_yaml.get_host()
        h = re_data_yaml.get_headers()
        url = host + "/api/send_verify_code"
        body = {"phone": phone, "request_id": request_id}
        r = requests.post(url, headers=h, data=body)
        result = r.json()

        self.assertEqual(result['code'], 204)
        self.assertEqual(result['message'], '手机号码格式不对')
Example #3
0
    def test_password_login_01(self, phone="15300752800", password="******"):
        '''密码登录--密码错误,phone: 15300752800,password: 222222'''
        log.info("***密码错误登录***")
        host = re_data_yaml.get_host()
        h = re_data_yaml.get_headers()
        url = host + "/api/user_password_login"
        body = {"phone": phone, "password": password}
        r = requests.post(url, headers=h, data=body)
        result = r.json()

        self.assertEqual(result['code'], 201)
        self.assertEqual(result['message'], '密码错误')
Example #4
0
    def test_space_visitor(self, space_id=23):
        '''【H5】访客登记获取空间'''
        host = re_data_yaml.get_host()
        h = re_data_yaml.get_headers()
        url = host + "/api/space_visitor"
        body = {"space_id": space_id}
        r = requests.post(url, headers=h, data=body)
        result = r.json()

        self.assertEqual(result['code'], 200)
        self.assertEqual(result['message'], '成功')
        self.assertEqual(result['data']['sapce_name'], '米域太平18楼')
Example #5
0
    def test_send_verify_code(self, phone="15300752800", request_id="tjg0w4"):
        '''正确验证码登录,phone: 15300752800'''
        log.info("***正确验证码登录***")
        host = re_data_yaml.get_host()
        h = re_data_yaml.get_headers()
        url = host + "/api/send_verify_code"
        body = {"phone": phone, "request_id": request_id}
        r = requests.post(url, headers=h, data=body)
        result = r.json()

        self.assertEqual(result['code'], 200)
        self.assertEqual(result['message'], '验证码发送成功')
        self.assertIsNotNone(result['data'], 'code')
Example #6
0
    def test_password_login_03(self, phone="153", password="******"):
        '''密码登录--手机号码长度错误,phone: 153,password: 111111'''
        log.info("***手机号错误登录***")
        host = re_data_yaml.get_host()
        h = re_data_yaml.get_headers()
        url = host + "/api/user_password_login"
        body = {"phone": phone, "password": password}
        r = requests.post(url, headers=h, data=body)
        result = r.json()

        self.assertEqual(result['code'], 204)
        self.assertEqual(result['message'], '手机号码格式不对')
        log.info("======密码登录接口测试结束======")
    def test_meeting_option(self):
        '''会议室筛选参数信息获取接口'''
        log.info("***会议室筛选参数信息获取接口测试***")
        host = re_data_yaml.get_host()
        h = re_data_yaml.get_headers()
        url = host + "/api/meeting_option"
        r = requests.post(url, headers=h)
        result = r.json()

        self.assertEqual(result['code'], 200)
        self.assertEqual(result['message'], '成功')
        self.assertEqual(result['data']["seat_num_option"][0]["value"], "2")
        self.assertEqual(result['data']["seat_num_option"][1]["name"], "4人")
Example #8
0
    def test_send_verify_code_02(self, phone="15300752800", request_id=""):
        '''验证码登录--request_id参数为空,phone: 15300752800'''
        log.info("***request_id参数为空***")
        host = re_data_yaml.get_host()
        h = re_data_yaml.get_headers()
        url = host + "/api/send_verify_code"
        body = {"phone": phone, "request_id": request_id}
        r = requests.post(url, headers=h, data=body)
        result = r.json()

        self.assertEqual(result['code'], 204)
        self.assertEqual(result['message'], '验证码错误')
        log.info("======验证码登录接口测试结束======")
Example #9
0
    def test_password_login(self, phone="15300752800", password="******"):
        '''正确密码登录,phone: 15300752800,password: 111111'''
        log.info("***正确密码登录***")
        host = re_data_yaml.get_host()
        h = re_data_yaml.get_headers()
        url = host + "/api/user_password_login"
        body = {"phone": phone, "password": password}
        r = requests.post(url, headers=h, data=body)
        result = r.json()

        self.assertEqual(result['code'], 200)
        self.assertEqual(result['message'], '成功')
        self.assertTrue(result['data']['token'], msg=None)
    def test_meeting_order_create_01(self):
        '''预定会议室接口-预定已过时间的会议室'''
        log.info("***预定会议室接口-预定已过时间的会议室接口测试***")
        number = random.randint(1, 54)
        host = re_data_yaml.get_host()
        h = re_data_yaml.get_headers()
        url = host + "/api/meeting_order_create"
        body = {
            "office_id": "%s" % number,  # 会议室id
            "start_time": "2019-03-13 15:00:00",  # 预定会议室开始时间
            "end_time": "2019-03-13 16:00:00"  # 预定会议室结束时间
        }
        r = requests.post(url, headers=h, data=body)
        result = r.json()

        self.assertEqual(result["code"], 201)
        self.assertEqual(result["message"], "参数错误,无法预定会议室")
Example #11
0
    def test_visitor_register_03(self):
        '''【H5】访客登记--手机号输入错误'''
        host = re_data_yaml.get_host()
        h = re_data_yaml.get_headers()
        url = host + "/api/visitor_register"
        body = {
            "space_id": "23",
            "source": "0eeetibszk",
            "name": "自动化测试数据",
            "mobile": "188",
            "aim": "2"
        }
        r = requests.post(url, data=body, headers=h)
        result = r.json()

        self.assertEqual(result['code'], 204)
        self.assertEqual(result['message'], '手机号格式不正确')
Example #12
0
    def test_visitor_register_01(self):
        '''【H5】访客登记--同一用户十分钟内重复提交'''
        host = re_data_yaml.get_host()
        h = re_data_yaml.get_headers()
        url = host + "/api/visitor_register"
        body = {
            "space_id": "23",
            "source": "0eeetibszk",
            "name": "自动化测试数据",
            "mobile": "%s" % mobile,
            "aim": "2"
        }
        r = requests.post(url, data=body, headers=h)
        result = r.json()

        self.assertEqual(result['code'], 201)
        self.assertEqual(result['message'], '已提交,请勿重复提交')
Example #13
0
    def test_booking_edit(self):
        '''官网预约成功后选择行业、人数、时间'''
        host = re_data_yaml.get_host()
        h = re_data_yaml.get_headers()
        url = host + "/api/booking_edit"
        body = {
            "id": "23",
            "wish": "1",
            "nums": "1",
            "region": "1",
            "trade": "4"
        }
        r = requests.post(url, data=body, headers=h)
        result = r.json()

        self.assertEqual(result['code'], 201)
        self.assertEqual(result['message'], '成功')
Example #14
0
    def test_visitor_register(self):
        '''【H5】访客登记--正常提交'''
        host = re_data_yaml.get_host()
        h = re_data_yaml.get_headers()
        url = host + "/api/visitor_register"
        body = {
            "space_id": "23",  # 空间id
            "source": "0eeetibszk",  # 访客登记标识
            "name": "自动化测试数据",  # 姓名
            "mobile": "%s" % mobile,  # 手机号
            "aim": "2"  # 来访目的:1、办公选址;2、拍照;3、约活动场地;4、商务合作;5、参加面试;6、参观空间;7、参加活动
        }
        r = requests.post(url, data=body, headers=h)
        result = r.json()

        self.assertEqual(result['code'], 200)
        self.assertEqual(result['message'], '成功')
        self.assertIsNotNone(result['data']['member_list'])
    def test_meeting_order_create_02(self):
        '''预定会议室接口-已登陆正常预定'''
        log.info("***预定会议室接口-已登陆正常预定测试***")
        number = random.randint(1, 54)
        host = re_data_yaml.get_host()
        h = re_data_yaml.get_headers()
        url = host + "/api/meeting_order_create"
        body = {
            "office_id": "%s" % number,
            "start_time": "%s" % get_time.whole_semih_time(),
            "end_time": "%s" % get_time.whole_semih_times()
        }
        r = requests.post(url, headers=h, data=body)
        result = r.json()

        self.assertTrue(result["data"]["order_code"])
        self.assertEqual(result["code"], 200)
        self.assertEqual(result["message"], "下单成功")
Example #16
0
    def test_booking_submit(self):
        '''官网预约--正常预约'''
        host = re_data_yaml.get_host()
        h = re_data_yaml.get_headers()
        url = host + "/api/booking_submit"
        body = {
            "space_id": "23",
            "sign": "80cb71a85f144b564614d4a9882d45fa",
            "name": "自动化测试数据",
            "tel": "18800000000",
            "aim": "2",
            "url": "www.mixpace.com/#/space/taiping?source_code=etaefhgspr"
        }
        r = requests.post(url, data=body, headers=h)
        result = r.json()

        self.assertEqual(result['code'], 200)
        self.assertEqual(result['message'], '成功')
Example #17
0
    def test_booking_submit_01(self):
        '''官网预约--渠道号错误'''
        host = re_data_yaml.get_host()
        h = re_data_yaml.get_headers()
        url = host + "/api/booking_submit"
        body = {
            "space_id": "23",
            "sign": "80cb71a85f144b564614d4a9882d45fa",
            "name": "自动化测试数据",
            "tel": "18888888888",
            "aim": "2",
            "url":
            "www.mixpace.com/#/space/taiping?source_code=111111aaaaa11"  # source_code参数为渠道编号
        }
        r = requests.post(url, data=body, headers=h)
        result = r.json()

        self.assertEqual(result['code'], 204)
        self.assertEqual(result['message'], '参数错误')
    def test_order_pay(self):
        '''会议室订单支付接口'''
        log.info("***会议室订单支付接口***")
        p = open(os.path.join(curPath, "common", "order_code.yaml"),
                 encoding='UTF-8')
        t1 = yaml.load(p.read(), Loader=yaml.Loader)
        order_code = t1["order_code"]

        host = re_data_yaml.get_host()
        h = re_data_yaml.get_headers()
        url = host + "/api/order_pay"
        body = {
            "order_code": "%s" % order_code,
            "pay_way": 1,
            "account_id": 73,
            "coupon_id": 1547705
        }
        r = requests.post(url, headers=h, data=body)
        result = r.json()

        self.assertEqual(result["code"], 200)
        self.assertEqual(result["message"], "成功")
        self.assertEqual(result["data"]["data"]["status"], "True")
        self.assertEqual(result["data"]["pay_way_name"], "米粒")
Example #19
0
import os,yaml
import requests
import random
import common
from common import get_time
from common import re_data_yaml
curPath = os.path.abspath(os.path.join(os.path.dirname("__file__"), os.path.pardir))

p = open(os.path.join(curPath, "common", "order_code.yaml"), encoding='UTF-8')
t1 = yaml.load(p.read(), Loader=yaml.Loader)
order_code = t1["order_code"]

host = re_data_yaml.get_host()
h = re_data_yaml.get_headers()
url = host + "/api/order_pay"
body = {
    "order_code": "%s" % order_code,
    "pay_way": 1,
    "account_id": 73,
    "coupon_id": 1547705
}
r = requests.post(url, headers=h, data=body)
result = r.json()
print(r)
print(result)