Ejemplo n.º 1
0
    def test_basic_01(self, action):
        """
            不在活动时间内
        """
        mysql = Mysql.Mysql()
        time = Tools.acttime()
        outtime = time[0]
        print(outtime)
        sql = "update 111 set `value` = '%s' where `key` = '111'" % outtime
        mysql.update(sql)  # 更改活动时间
        Tools.refresh()  # 刷新配置项

        print("hello")
        conf = Config()
        data = MyTest()
        test = Assert.Assertions()
        request = Request.Request(action)

        host = conf.host_test
        req_url = 'http://' + host
        print(req_url)
        urls = data.url
        params = data.data
        print(params)
        headers = data.header
        api_url = req_url + urls[0]

        response = request.get_request(api_url, params[0], headers[0])
        print(response)

        # assert test.assert_code(response['code'], 200)
        assert test.assert_body(response['body'], 'code', '600000')
        # assert test.assert_time(response['time_consuming'], 100)
        Consts.RESULT_LIST.append('True')
Ejemplo n.º 2
0
    def test_NUMB(self):
        zc_resp = request.post_request(
            url='http://192.168.60.132:1811/user/signup',
            json={
                "phone": Tools.phone_num(),
                "pwd": 'ab12345',
                "rePwd": 'ab12345',
                "userName": Tools.random_str_abc(3) + Tools.random_123(3)
            })
        assertions.assert_code(zc_resp.status_code, 200)
        zc_resp_json = zc_resp.json()

        assertions.assert_in_text(zc_resp_json["respCode"], '0')
Ejemplo n.º 3
0
 def test_signup1(self):
     signup_resp = request.post_request(url=url + 'user/signup',
                                        json={
                                            "phone":
                                            Tools.phone_num(),
                                            "pwd":
                                            'aaa123456',
                                            "rePwd":
                                            'aaa123456',
                                            "userName":
                                            Tools.random_str_abc(3) +
                                            Tools.random_123(3)
                                        })
     assertions.assert_code(signup_resp.status_code, 200)
     resp_json = signup_resp.json()
     assertions.assert_in_text(resp_json['respCode'], '0')
Ejemplo n.º 4
0
from Common import Request, Assert, read_excel, Tools
import pytest, allure

tool_pwd = Tools.random_str_abc(3) + str(Tools.random_123(3))
tool_username = Tools.random_str_abc(3) + str(Tools.random_123(1))
tool_phone = Tools.phone_num()
request = Request.Request()
assertions = Assert.Assertions()


@allure.feature('注册模块')
class Test_zhuce:
    @allure.story('注册新用户')
    def test_zhuce(self):
        zhuce_resp = request.post_request(
            url='http://192.168.60.132:1811/user/signup',
            json={
                "phone": tool_phone,
                "pwd": tool_pwd,
                "rePwd": tool_pwd,
                "userName": tool_username
            })
        assertions.assert_code(zhuce_resp.status_code, 200)
        resp_json = zhuce_resp.json()
        assertions.assert_in_text(resp_json['respDesc'], '成功')
Ejemplo n.º 5
0
from Common import Request, Assert, Tools
import allure
import pytest
phone = Tools.phone_num()
pwd = Tools.random_str_abc(2) + Tools.random_123(4)
rePwd = pwd
userName = Tools.random_str_abc(3) + Tools.random_123(2)
newPwd = Tools.random_str_abc(3) + Tools.random_123(4)
oldPwd = pwd
reNewPwd = newPwd

request = Request.Request()
assertion = Assert.Assertions()

url = 'http://192.168.1.137:1811/'
head = {}


@allure.feature('注册登录测试')
class Test_logon:
    @allure.story('注册测试')
    def test_signup(self):
        json = {
            "phone": phone,
            "pwd": pwd,
            "rePwd": rePwd,
            "userName": userName
        }
        signup_resp = request.post_request(url=url + '/user/signup', json=json)
        resp_json = signup_resp.json()
        assertion.assert_code(signup_resp.status_code, 200)
Ejemplo n.º 6
0
 def test_yhzc(self,phone,pwd,rePwd,userName,code):
     yhzc_resp = request.post_request(url='http://192.168.60.132:1811/user/signup',
                                         json={"phone": Tools.phone_num(), "pwd":'a123456', "rePwd":'a123456', "userName": Tools.random_str_abc(3)+Tools.random_123(3)})
     assertions.assert_code(yhzc_resp.status_code, 200)
     yhzc_resp_json = yhzc_resp.json()
     assertions.assert_in_text(yhzc_resp_json['respCode'],code)
Ejemplo n.º 7
0
import allure
import pytest
from Common import Request,Assert,read_excel,Login,Tools

request = Request.Request()
assertions = Assert.Assertions()
num = Tools.phone_num()


excel_list = read_excel.read_excel_list('../document/用户注册.xlsx')
ids_list = []

for i in range(len(excel_list)):
    ids_pop = excel_list[i].pop()
    ids_list.append(ids_pop)

@allure.feature("用户注册模块")
class Test_yhzc:

    @allure.story("注册")
    @pytest.mark.parametrize('phone,pwd,rePwd,userName,code',excel_list,ids=ids_list)
    def test_yhzc(self,phone,pwd,rePwd,userName,code):
        yhzc_resp = request.post_request(url='http://192.168.60.132:1811/user/signup',
                                            json={"phone": Tools.phone_num(), "pwd":'a123456', "rePwd":'a123456', "userName": Tools.random_str_abc(3)+Tools.random_123(3)})
        assertions.assert_code(yhzc_resp.status_code, 200)
        yhzc_resp_json = yhzc_resp.json()
        assertions.assert_in_text(yhzc_resp_json['respCode'],code)