Commit 92d2738ccc4efcea09296771a52784a644ee6165
1 parent
ec235181
删除冗余文件
Showing
2 changed files
with
0 additions
and
100 deletions
testcase/doAudit/__init__.py deleted
100644 → 0
testcase/doAudit/test_doAudit.py deleted
100644 → 0
1 | -#!/usr/bin/python | ||
2 | -# -*- coding: UTF-8 -*- | ||
3 | -import unittest | ||
4 | -import urllib3 | ||
5 | -import commons.ConfigDB as db | ||
6 | -from commons import common as com | ||
7 | -from commons.MySession import my | ||
8 | -from commons.api.fieldConfig import fieldConfig | ||
9 | -from commons.api.doAudit import doAudit | ||
10 | -from commons.api.doAdd import doAdd | ||
11 | -#作用为禁用请求安全提示,平时默认加上上面的urllib3语句就行 | ||
12 | -urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) | ||
13 | -ad=doAdd() | ||
14 | -au=doAudit() | ||
15 | -field=fieldConfig() | ||
16 | - | ||
17 | - | ||
18 | - | ||
19 | -class test_doAudit(unittest.TestCase): | ||
20 | - | ||
21 | - "登记单审核接口" | ||
22 | - @classmethod | ||
23 | - def setUpClass(cls): | ||
24 | - #通过字段配置接口提前配置新增页的字段配置 | ||
25 | - my.post(url=field.url,headers=field.header,json=field.body) | ||
26 | - | ||
27 | - def setUp(self): | ||
28 | - #准备数据:新增一条登记单 | ||
29 | - my.post(url=ad.url,headers=ad.header,json=ad.body) | ||
30 | - #获取数据:从MYSQL获取新增登记单的id号--因为响应没有id,需要数据库查询 | ||
31 | - self.code=db.mysql_selectOne("SELECT id FROM `dili_trace`.register_bill ORDER BY id DESC LIMIT 1")[0] | ||
32 | - print("db id",self.code) | ||
33 | - | ||
34 | - @unittest.case_mark(my.mark()) | ||
35 | - def test_doAudit_01(self): | ||
36 | - "审核通过" | ||
37 | - #请求url中的需要替换为新增登记单的id | ||
38 | - url=au.url.replace("5888", str(self.code)) | ||
39 | - print("数据处理后的url",url) | ||
40 | - #进行GET请求 | ||
41 | - re=my.get(url=url,headers=au.header) | ||
42 | - #打印请求结果(可删除该代码,一般只在调试时使用) | ||
43 | - print(re.json()) | ||
44 | - #断言请求过程是否成功 | ||
45 | - self.assertEqual(re.status_code, 200) | ||
46 | - #断言响应数据中是否存在期望字符串 | ||
47 | - self.assertTrue("'result':'操作成功'" in str(re.json()).replace(" ","")) | ||
48 | - | ||
49 | - | ||
50 | - @unittest.case_mark(my.mark()) | ||
51 | - def test_doAudit_02(self): | ||
52 | - "审核不通过" | ||
53 | - #请求url中的需要替换为新增登记单的id | ||
54 | - url=au.url.replace("5888", str(self.code)).replace("verifyStatus=20", "verifyStatus=30") | ||
55 | - #进行GET请求 | ||
56 | - re=my.get(url=url,headers=au.header) | ||
57 | - #打印请求结果(可删除该代码,一般只在调试时使用) | ||
58 | - print(re.json()) | ||
59 | - #断言请求过程是否成功 | ||
60 | - self.assertEqual(re.status_code, 200) | ||
61 | - #断言响应数据中是否存在期望字符串 | ||
62 | - self.assertTrue("'result':'操作成功'" in str(re.json()).replace(" ","")) | ||
63 | - | ||
64 | - | ||
65 | - @unittest.case_mark(my.mark()) | ||
66 | - def test_doAudit_03(self): | ||
67 | - "审核不通过" | ||
68 | - #请求url中的需要替换为新增登记单的id | ||
69 | - url=au.url.replace("5888", str(self.code)).replace("verifyStatus=20", "verifyStatus=10") | ||
70 | - #进行GET请求 | ||
71 | - re=my.get(url=url,headers=au.header) | ||
72 | - #打印请求结果(可删除该代码,一般只在调试时使用) | ||
73 | - print(re.json()) | ||
74 | - #断言请求过程是否成功 | ||
75 | - self.assertEqual(re.status_code, 200) | ||
76 | - #断言响应数据中是否存在期望字符串 | ||
77 | - self.assertTrue("'result':'操作成功'" in str(re.json()).replace(" ","")) | ||
78 | - | ||
79 | - @unittest.case_mark(my.mark()) | ||
80 | - def test_doAudit_04(self): | ||
81 | - "审核一个已经完成审核的登记单" | ||
82 | - #进行GET请求 | ||
83 | - re=my.get(url=au.url,headers=au.header) | ||
84 | - #打印请求结果(可删除该代码,一般只在调试时使用) | ||
85 | - print(re.json()) | ||
86 | - #断言请求过程是否成功 | ||
87 | - self.assertEqual(re.status_code, 200) | ||
88 | - #断言响应数据中是否存在期望字符串 | ||
89 | - self.assertTrue("'result':'操作失败,数据状态已改变'" in str(re.json()).replace(" ","")) | ||
90 | - | ||
91 | - @classmethod | ||
92 | - def tearDownClass(cls): | ||
93 | - pass | ||
94 | - | ||
95 | - | ||
96 | -if __name__ == "__main__": | ||
97 | - | ||
98 | - # unittest.main(verbosity=2) | ||
99 | - | ||
100 | - com.run_one(test_doAudit("test_doAudit_01")) |