コード例 #1
0
    def test_04params_null(self):
        json_data = {}
        headers = {"Content-Type": "application/json"}
        response = self.login_api.login(json_data=json_data, headers=headers)

        # 调用断言方法
        assert_text(self, 200, False, 20001, "用户名或密码错误", response)
コード例 #2
0
 def test_05params_None(self):
     json_data = None
     headers = {"Content-Type": "application/json"}
     response = self.login_api.login(json_data=json_data, headers=headers)
     print(response.json())
     # 调用断言方法
     assert_text(self, 200, False, 99999, "抱歉,系统繁忙,请稍后重试", response)
コード例 #3
0
    def test_01login(self):
        json_data = {"mobile": "13800000002", "password": "******"}
        headers = {"Content-Type": "application/json"}
        response = self.login_api.login(json_data=json_data, headers=headers)

        # 调用断言方法
        assert_text(self, 200, True, 10000, "操作成功!", response)
コード例 #4
0
    def test_02null_user(self):
        json_data = {"mobile": "", "password": "******"}
        headers = {"Content-Type": "application/json"}
        response = self.login_api.login(json_data=json_data, headers=headers)

        # 调用断言方法
        assert_text(self, 200, False, 20001, "用户名或密码错误", response)
コード例 #5
0
    def test_01login(self, case_name, request_body, success, code, message,
                     http_code):
        json_data = request_body
        headers = {"Content-Type": "application/json"}
        response = self.login_api.login(json_data=json_data, headers=headers)

        # 调用断言方法
        assert_text(self, http_code, success, code, message, response)
コード例 #6
0
    def test_02add_emp(self):
        response = self.emp_api.add_emp("小船儿飘",
                                        15678881787,
                                        headers=app.HEADERS)
        print(response.json())

        app.EMP_ID = response.json()["data"]["id"]
        assert_text(self, 200, True, 10000, "操作成功!", response)
コード例 #7
0
    def test_01login_suc(self):
        json_data = {"mobile": "13800000002", "password": "******"}
        headers = {"Content-Type": "application/json"}
        response = self.login_api.login(json_data=json_data, headers=headers)
        token = "Bearer " + response.json().get("data")

        app.HEADERS = {
            "Content-Type": "application/json",
            "Authorization": token
        }
        logging.info("把headers保存到全局变量为{}".format(app.HEADERS))
        assert_text(self, 200, True, 10000, "操作成功!", response)
コード例 #8
0
 def test_05del_emp(self):
     response = self.emp_api.del_emp(app.EMP_ID, app.HEADERS)
     assert_text(self, 200, True, 10000, "操作成功!", response)
コード例 #9
0
 def test_04put_emp(self):
     response = self.emp_api.put_emp(app.EMP_ID, {"username": "******"},
                                     app.HEADERS)
     print(response.json())
     assert_text(self, 200, True, 10000, "操作成功!", response)
コード例 #10
0
 def test_03query_emp(self):
     print(app.EMP_ID)
     print(app.HEADERS)
     response = self.emp_api.query_emp(app.EMP_ID, app.HEADERS)
     print(response.json())
     assert_text(self, 200, True, 10000, "操作成功!", response)