Commit 8ff5b6632999f9299767416858250e1168100ac4
1 parent
2cf80244
更新
Showing
11 changed files
with
171 additions
and
237 deletions
report/cardSystem/__init__.py deleted
100644 → 0
report/cardSystem/test_addCard.py deleted
100644 → 0
1 | -# -*- coding: utf-8 -*- | |
2 | - | |
3 | -# @Time : 2021/7/16 14:44 | |
4 | -# @Author : Ljq | |
5 | -# @File : test_addCard.py | |
6 | -# @Software: PyCharm | |
7 | - | |
8 | -""" | |
9 | -卡片入库测试 | |
10 | -""" | |
11 | - | |
12 | -import unittest | |
13 | -import time | |
14 | -import math | |
15 | -import commons.api.cardStorageIn as cSI | |
16 | -import commons.api.cardStock as cS | |
17 | -import commons.api.cardStorageOut as cSO | |
18 | -from commons.scripts.readConf import readConfig | |
19 | -from commons.api.doLogin import doLogin | |
20 | - | |
21 | - | |
22 | -class test_addCard(unittest.TestCase): | |
23 | - @classmethod | |
24 | - def setUpClass(cls): | |
25 | - # 获取登录信息和可用headers | |
26 | - rC = readConfig() | |
27 | - cls.cardHost = rC.returnOptionsItems("host", "cardHost") | |
28 | - cls.webHeaders,cls.clientHeaders,cls.userInfo = doLogin().loginUser() | |
29 | - cls.applyUserName = cls.userInfo["data"]["user"]["realName"] | |
30 | - cls.applyUserId = cls.userInfo["data"]["user"]["id"] | |
31 | - cls.applyUserCode = cls.userInfo["data"]["user"]["userName"] | |
32 | - # print("self.webHeaders", cls.webHeaders) | |
33 | - # print("self.clientHeaders", cls.clientHeaders) | |
34 | - # print("self.userInfo", cls.userInfo) | |
35 | - | |
36 | - def setUp(self) -> None: | |
37 | - time.sleep(2) | |
38 | - | |
39 | - def test_cardType(self): | |
40 | - """ | |
41 | - 卡类型校验 | |
42 | - :return: | |
43 | - """ | |
44 | - resCardType = cSI.getCardType(cardHost=self.cardHost, webHeaders=self.webHeaders) | |
45 | - preRes = [{"text":"-- 全部 --","value":""},{"text":"主卡","value":10},{"text":"副卡","value":20}] | |
46 | - assert resCardType.json()==preRes,"卡类型信息错误" | |
47 | - | |
48 | - def test_cardFaceCheck(self): | |
49 | - """ | |
50 | - 市场卡面信息校验 | |
51 | - :return: | |
52 | - """ | |
53 | - resCardFace = cSI.getCardFace(cardHost=self.cardHost,webHeaders=self.webHeaders) | |
54 | - print(resCardFace.json()) | |
55 | - if self.userInfo["data"]["user"]["firmId"] == 8: | |
56 | - # 预期结果定义 | |
57 | - preRes = [{'text': '-- 请选择 --', 'value': ''}, {'text': '买方卡', 'value': 'buyer'}, {'text': 'VIP买方卡', 'value': 'buyer_vip'}, {'text': '卖方卡', 'value': 'seller'}, {'text': '司机卡', 'value': 'driver'}] | |
58 | - assert resCardFace.json()==preRes,"当 firmId = 8 时卡面信息错误" | |
59 | - else: | |
60 | - preRes = [{"text":"-- 无--","value":""}] | |
61 | - assert resCardFace.json() == preRes, "当 firmId != 8 时卡面信息错误" | |
62 | - | |
63 | - def test_doCardStorageIn(self): | |
64 | - """ | |
65 | - 卡片入库测试,新添加的卡片能正常的入库 | |
66 | - :return: | |
67 | - """ | |
68 | - # 获取卡面信息 | |
69 | - resCardFace = cSI.getCardFace(cardHost=self.cardHost,webHeaders=self.webHeaders) | |
70 | - cardFace = cSI.returnFaceValue(resCardFace=resCardFace,faceNum=3) | |
71 | - startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime())) | |
72 | - endCardNo = startCardNo + 1 | |
73 | - # 执行入库 | |
74 | - resSavaCard = cSI.savaCard(cardHost=self.cardHost,webHeaders=self.webHeaders,startCardNo=startCardNo,endCardNo=endCardNo,cardFace=cardFace) | |
75 | - # print(resSavaCard.json()) | |
76 | - assert resSavaCard.json()["message"]=="OK","入库失败" | |
77 | - resQueryList = cSI.queryList(cardHost=self.cardHost,webHeaders=self.webHeaders) | |
78 | - # 入库卡片号段校验 | |
79 | - assert resQueryList.json()["rows"][0]["cardNoRange"]==str(startCardNo)+"-"+str(endCardNo),"入库的卡片在入库列表不能被查询到" | |
80 | - # 入库数量校验 | |
81 | - assert resQueryList.json()["rows"][0]["amount"]==2,"入库数量错误" | |
82 | - # 入库角色校验 | |
83 | - assert resQueryList.json()["rows"][0]["creator"]==self.userInfo["data"]["user"]["realName"],"入库角色记录正确" | |
84 | - assert resQueryList.json()["rows"][0]["creatorId"] == self.userInfo["data"]["user"]["id"], "入库角色记录正确" | |
85 | - # resQueryList.json()["rows"][0]["cardFaceText"] | |
86 | - if self.userInfo["data"]["user"]["firmId"] == 8: | |
87 | - assert cardFace==resQueryList.json()["rows"][0]["cardFace"],"记录的卡面信息与实际卡面不一致" | |
88 | - else: | |
89 | - assert "cardFaceText" not in resQueryList.text,"记录的卡面信息与实际卡面不一致" | |
90 | - | |
91 | - def test_duplicateStorageIn(self): | |
92 | - """ | |
93 | - 测试卡片不能被重复入库 | |
94 | - :return: | |
95 | - """ | |
96 | - resCardFace = cSI.getCardFace(cardHost=self.cardHost,webHeaders=self.webHeaders) | |
97 | - cardFace = cSI.returnFaceValue(resCardFace=resCardFace,faceNum=3) | |
98 | - startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime())) | |
99 | - endCardNo = startCardNo+1 | |
100 | - resSavaCard = cSI.savaCard(cardHost=self.cardHost,webHeaders=self.webHeaders,startCardNo=startCardNo,endCardNo=endCardNo,cardFace=cardFace) | |
101 | - assert resSavaCard.json()["message"]=="OK","入库失败" | |
102 | - resSavaCard = cSI.savaCard(cardHost=self.cardHost,webHeaders=self.webHeaders,startCardNo=startCardNo,endCardNo=endCardNo,cardFace=cardFace) | |
103 | - assert resSavaCard.json()["message"]=="入库失败,包含重复卡号%s~%s"%(startCardNo,endCardNo),"卡片不能重复入库验证失败" | |
104 | - | |
105 | - def test_openCardStorageIn(self): | |
106 | - """ | |
107 | - 入库列表查询测试 | |
108 | - :return: | |
109 | - """ | |
110 | - # 全列表查询 | |
111 | - resQueryList = cSI.queryList(cardHost=self.cardHost, webHeaders=self.webHeaders) | |
112 | - # print(resQueryList.json()["total"]) | |
113 | - assert resQueryList.json()["total"]>200,"页数小于10,查询结果可能存在错误" | |
114 | - | |
115 | - # 查询当天入库的入库记录,判断所得的查询记录的日期都是当天的为测试通过 | |
116 | - startDate = str(time.strftime("%Y-%m-%d 00:00:00", time.localtime())) | |
117 | - endDate = str(time.strftime("%Y-%m-%d 23:59:59", time.localtime())) | |
118 | - resQueryLista = cSI.queryList(cardHost=self.cardHost,webHeaders=self.webHeaders,startDate=startDate,endDate=endDate) | |
119 | - dateList=[] | |
120 | - pageNums = math.ceil(resQueryLista.json()["total"]/10) | |
121 | - for pageNum in range(pageNums): | |
122 | - resQueryLista = cSI.queryList(cardHost=self.cardHost, webHeaders=self.webHeaders, startDate=startDate, | |
123 | - endDate=endDate,page=str(pageNum+1)) | |
124 | - dateList = dateList+[i["createTime"] for i in resQueryLista.json()["rows"]] | |
125 | - assert [] == [i for i in dateList if i<startDate or i>endDate],"查询结果错误,查询出非当天的入库信息" | |
126 | - | |
127 | - def test_addMasterCard(self): | |
128 | - """ | |
129 | - 添加主卡 | |
130 | - :return: | |
131 | - """ | |
132 | - resCardType = cSI.getCardType(cardHost=self.cardHost,webHeaders=self.webHeaders) | |
133 | - resCardFace = cSI.getCardFace(cardHost=self.cardHost,webHeaders=self.webHeaders) | |
134 | - cardFace = cSI.returnFaceValue(resCardFace=resCardFace,faceNum=3) | |
135 | - startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime())) | |
136 | - endCardNo = startCardNo+1 | |
137 | - resSavaCard = cSI.savaCard(cardHost=self.cardHost,webHeaders=self.webHeaders,startCardNo=startCardNo,endCardNo=endCardNo,cardFace=cardFace) | |
138 | - resQueryList = cSI.queryList(cardHost=self.cardHost, webHeaders=self.webHeaders) | |
139 | - assert resQueryList.json()["rows"][0]["cardType"]==10,"卡片类型错误" | |
140 | - | |
141 | - | |
142 | - def test_addSlaveCard(self): | |
143 | - """ | |
144 | - 添加副卡 | |
145 | - :return: | |
146 | - """ | |
147 | - resCardType = cSI.getCardType(cardHost=self.cardHost,webHeaders=self.webHeaders) | |
148 | - startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime())) | |
149 | - endCardNo = startCardNo+1 | |
150 | - resSavaCard = cSI.savaCard(cardHost=self.cardHost,webHeaders=self.webHeaders,startCardNo=startCardNo,endCardNo=endCardNo,cardType=20) | |
151 | - print(resSavaCard.json()) | |
152 | - resQueryList = cSI.queryList(cardHost=self.cardHost, webHeaders=self.webHeaders) | |
153 | - assert resQueryList.json()["rows"][0]["cardType"] == 20, "卡片类型错误" | |
154 | - assert resQueryList.json()["rows"][0]["cardTypeText"] == "副卡", "卡片类型错误" | |
155 | - assert "cardFaceText" not in str(resQueryList.json()["rows"][0]),"副卡不应该存在卡面" | |
156 | - | |
157 | - | |
158 | - def test_delStorageInRecord(self): | |
159 | - """ | |
160 | - 正常删除卡片记录 | |
161 | - :return: | |
162 | - """ | |
163 | - # 新增加一条入库记录用于删除 | |
164 | - resCardFace = cSI.getCardFace(cardHost=self.cardHost,webHeaders=self.webHeaders) | |
165 | - cardFace = cSI.returnFaceValue(resCardFace=resCardFace,faceNum=3) | |
166 | - startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime())) | |
167 | - endCardNo = startCardNo + 1 | |
168 | - resSavaCard = cSI.savaCard(cardHost=self.cardHost,webHeaders=self.webHeaders,startCardNo=startCardNo,endCardNo=endCardNo,cardFace=cardFace) | |
169 | - assert resSavaCard.json()["message"]=="OK","入库失败" | |
170 | - resQueryList = cSI.queryList(cardHost=self.cardHost, webHeaders=self.webHeaders) | |
171 | - ida = resQueryList.json()['rows'][0]['id'] | |
172 | - resDel = cSI.delCard(cardHost=self.cardHost,webHeaders=self.webHeaders,ids=ida) | |
173 | - assert resDel.json()["message"]=="OK","删除失败,入库记录未被成功删除" | |
174 | - resQueryListB = cSI.queryList(cardHost=self.cardHost, webHeaders=self.webHeaders) | |
175 | - idb = resQueryListB.json()['rows'][0]['id'] | |
176 | - print(ida,"----------------",idb) | |
177 | - assert ida!=idb,"删除功能异常,记录未被删除" | |
178 | - | |
179 | - def test_delStorageInRecordFail_delCard(self): | |
180 | - """ | |
181 | - 已作废的卡片不能被删除 | |
182 | - :return: | |
183 | - """ | |
184 | - resCardFace = cSI.getCardFace(cardHost=self.cardHost,webHeaders=self.webHeaders) | |
185 | - cardFace = cSI.returnFaceValue(resCardFace=resCardFace,faceNum=3) | |
186 | - startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime())) | |
187 | - endCardNo = startCardNo+1 | |
188 | - resSavaCard = cSI.savaCard(cardHost=self.cardHost,webHeaders=self.webHeaders,startCardNo=startCardNo,endCardNo=endCardNo,cardFace=cardFace) | |
189 | - # 卡片作废 | |
190 | - cS.cardVoid(cardHost=self.cardHost,webHeaders=self.webHeaders,cardNo=startCardNo) | |
191 | - # 删除入库记录 | |
192 | - resQueryList = cSI.queryList(cardHost=self.cardHost, webHeaders=self.webHeaders) | |
193 | - ida = resQueryList.json()['rows'][0]['id'] | |
194 | - resDel = cSI.delCard(cardHost=self.cardHost, webHeaders=self.webHeaders, ids=ida) | |
195 | - print(resDel.json()) | |
196 | - assert resDel.json()["message"]=="有部分卡片已出库或作废,删除失败","已作废的卡片不能被删除" | |
197 | - | |
198 | - def test_delStorageInRecordFail_cardOut(self): | |
199 | - """ | |
200 | - 存在出库卡片的入库记录,不能进行删除 | |
201 | - :return: | |
202 | - """ | |
203 | - resCardFace = cSI.getCardFace(cardHost=self.cardHost, webHeaders=self.webHeaders) | |
204 | - cardFace = cSI.returnFaceValue(resCardFace=resCardFace, faceNum=3) | |
205 | - startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime())) | |
206 | - endCardNo = startCardNo + 1 | |
207 | - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startCardNo, | |
208 | - endCardNo=endCardNo, cardFace=cardFace) | |
209 | - # 卡片出库 | |
210 | - acc = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=str(startCardNo),applyUserName=self.applyUserName,applyUserCode=self.applyUserCode,applyUserId=self.applyUserId) | |
211 | - # print(acc.json()) | |
212 | - # 删除入库记录 | |
213 | - resQueryList = cSI.queryList(cardHost=self.cardHost, webHeaders=self.webHeaders) | |
214 | - ida = resQueryList.json()['rows'][0]['id'] | |
215 | - resDel = cSI.delCard(cardHost=self.cardHost, webHeaders=self.webHeaders, ids=ida) | |
216 | - # print(resDel.json()) | |
217 | - assert resDel.json()["message"] == "有部分卡片已出库或作废,删除失败", "已出库的卡片不能被删除" | |
218 | - | |
219 | - @classmethod | |
220 | - def tearDownClass(cls): | |
221 | - print("tearDown") | |
222 | - | |
223 | - def tearDown(self) -> None: | |
224 | - pass | |
225 | - | |
226 | -if __name__== "__main__": | |
227 | - unittest.main() | |
228 | 0 | \ No newline at end of file |
testCase/cardSystem/test_addCard.py
... | ... | @@ -45,6 +45,177 @@ class test_addCard(unittest.TestCase): |
45 | 45 | preRes = [{"text":"-- 全部 --","value":""},{"text":"主卡","value":10},{"text":"副卡","value":20}] |
46 | 46 | assert resCardType.json()==preRes,"卡类型信息错误" |
47 | 47 | |
48 | + def test_cardFaceCheck(self): | |
49 | + """ | |
50 | + 市场卡面信息校验 | |
51 | + :return: | |
52 | + """ | |
53 | + resCardFace = cSI.getCardFace(cardHost=self.cardHost,webHeaders=self.webHeaders) | |
54 | + print(resCardFace.json()) | |
55 | + if self.userInfo["data"]["user"]["firmId"] == 8: | |
56 | + # 预期结果定义 | |
57 | + preRes = [{'text': '-- 请选择 --', 'value': ''}, {'text': '买方卡', 'value': 'buyer'}, {'text': 'VIP买方卡', 'value': 'buyer_vip'}, {'text': '卖方卡', 'value': 'seller'}, {'text': '司机卡', 'value': 'driver'}] | |
58 | + assert resCardFace.json()==preRes,"当 firmId = 8 时卡面信息错误" | |
59 | + else: | |
60 | + preRes = [{"text":"-- 无--","value":""}] | |
61 | + assert resCardFace.json() == preRes, "当 firmId != 8 时卡面信息错误" | |
62 | + | |
63 | + def test_doCardStorageIn(self): | |
64 | + """ | |
65 | + 卡片入库测试,新添加的卡片能正常的入库 | |
66 | + :return: | |
67 | + """ | |
68 | + # 获取卡面信息 | |
69 | + resCardFace = cSI.getCardFace(cardHost=self.cardHost,webHeaders=self.webHeaders) | |
70 | + cardFace = cSI.returnFaceValue(resCardFace=resCardFace,faceNum=3) | |
71 | + startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime())) | |
72 | + endCardNo = startCardNo + 1 | |
73 | + # 执行入库 | |
74 | + resSavaCard = cSI.savaCard(cardHost=self.cardHost,webHeaders=self.webHeaders,startCardNo=startCardNo,endCardNo=endCardNo,cardFace=cardFace) | |
75 | + # print(resSavaCard.json()) | |
76 | + assert resSavaCard.json()["message"]=="OK","入库失败" | |
77 | + resQueryList = cSI.queryList(cardHost=self.cardHost,webHeaders=self.webHeaders) | |
78 | + # 入库卡片号段校验 | |
79 | + assert resQueryList.json()["rows"][0]["cardNoRange"]==str(startCardNo)+"-"+str(endCardNo),"入库的卡片在入库列表不能被查询到" | |
80 | + # 入库数量校验 | |
81 | + assert resQueryList.json()["rows"][0]["amount"]==2,"入库数量错误" | |
82 | + # 入库角色校验 | |
83 | + assert resQueryList.json()["rows"][0]["creator"]==self.userInfo["data"]["user"]["realName"],"入库角色记录正确" | |
84 | + assert resQueryList.json()["rows"][0]["creatorId"] == self.userInfo["data"]["user"]["id"], "入库角色记录正确" | |
85 | + # resQueryList.json()["rows"][0]["cardFaceText"] | |
86 | + if self.userInfo["data"]["user"]["firmId"] == 8: | |
87 | + assert cardFace==resQueryList.json()["rows"][0]["cardFace"],"记录的卡面信息与实际卡面不一致" | |
88 | + else: | |
89 | + assert "cardFaceText" not in resQueryList.text,"记录的卡面信息与实际卡面不一致" | |
90 | + | |
91 | + def test_duplicateStorageIn(self): | |
92 | + """ | |
93 | + 测试卡片不能被重复入库 | |
94 | + :return: | |
95 | + """ | |
96 | + resCardFace = cSI.getCardFace(cardHost=self.cardHost,webHeaders=self.webHeaders) | |
97 | + cardFace = cSI.returnFaceValue(resCardFace=resCardFace,faceNum=3) | |
98 | + startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime())) | |
99 | + endCardNo = startCardNo+1 | |
100 | + resSavaCard = cSI.savaCard(cardHost=self.cardHost,webHeaders=self.webHeaders,startCardNo=startCardNo,endCardNo=endCardNo,cardFace=cardFace) | |
101 | + assert resSavaCard.json()["message"]=="OK","入库失败" | |
102 | + resSavaCard = cSI.savaCard(cardHost=self.cardHost,webHeaders=self.webHeaders,startCardNo=startCardNo,endCardNo=endCardNo,cardFace=cardFace) | |
103 | + assert resSavaCard.json()["message"]=="入库失败,包含重复卡号%s~%s"%(startCardNo,endCardNo),"卡片不能重复入库验证失败" | |
104 | + | |
105 | + def test_openCardStorageIn(self): | |
106 | + """ | |
107 | + 入库列表查询测试 | |
108 | + :return: | |
109 | + """ | |
110 | + # 全列表查询 | |
111 | + resQueryList = cSI.queryList(cardHost=self.cardHost, webHeaders=self.webHeaders) | |
112 | + # print(resQueryList.json()["total"]) | |
113 | + assert resQueryList.json()["total"]>200,"页数小于10,查询结果可能存在错误" | |
114 | + | |
115 | + # 查询当天入库的入库记录,判断所得的查询记录的日期都是当天的为测试通过 | |
116 | + startDate = str(time.strftime("%Y-%m-%d 00:00:00", time.localtime())) | |
117 | + endDate = str(time.strftime("%Y-%m-%d 23:59:59", time.localtime())) | |
118 | + resQueryLista = cSI.queryList(cardHost=self.cardHost,webHeaders=self.webHeaders,startDate=startDate,endDate=endDate) | |
119 | + dateList=[] | |
120 | + pageNums = math.ceil(resQueryLista.json()["total"]/10) | |
121 | + for pageNum in range(pageNums): | |
122 | + resQueryLista = cSI.queryList(cardHost=self.cardHost, webHeaders=self.webHeaders, startDate=startDate, | |
123 | + endDate=endDate,page=str(pageNum+1)) | |
124 | + dateList = dateList+[i["createTime"] for i in resQueryLista.json()["rows"]] | |
125 | + assert [] == [i for i in dateList if i<startDate or i>endDate],"查询结果错误,查询出非当天的入库信息" | |
126 | + | |
127 | + def test_addMasterCard(self): | |
128 | + """ | |
129 | + 添加主卡 | |
130 | + :return: | |
131 | + """ | |
132 | + resCardType = cSI.getCardType(cardHost=self.cardHost,webHeaders=self.webHeaders) | |
133 | + resCardFace = cSI.getCardFace(cardHost=self.cardHost,webHeaders=self.webHeaders) | |
134 | + cardFace = cSI.returnFaceValue(resCardFace=resCardFace,faceNum=3) | |
135 | + startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime())) | |
136 | + endCardNo = startCardNo+1 | |
137 | + resSavaCard = cSI.savaCard(cardHost=self.cardHost,webHeaders=self.webHeaders,startCardNo=startCardNo,endCardNo=endCardNo,cardFace=cardFace) | |
138 | + resQueryList = cSI.queryList(cardHost=self.cardHost, webHeaders=self.webHeaders) | |
139 | + assert resQueryList.json()["rows"][0]["cardType"]==10,"卡片类型错误" | |
140 | + | |
141 | + | |
142 | + def test_addSlaveCard(self): | |
143 | + """ | |
144 | + 添加副卡 | |
145 | + :return: | |
146 | + """ | |
147 | + resCardType = cSI.getCardType(cardHost=self.cardHost,webHeaders=self.webHeaders) | |
148 | + startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime())) | |
149 | + endCardNo = startCardNo+1 | |
150 | + resSavaCard = cSI.savaCard(cardHost=self.cardHost,webHeaders=self.webHeaders,startCardNo=startCardNo,endCardNo=endCardNo,cardType=20) | |
151 | + print(resSavaCard.json()) | |
152 | + resQueryList = cSI.queryList(cardHost=self.cardHost, webHeaders=self.webHeaders) | |
153 | + assert resQueryList.json()["rows"][0]["cardType"] == 20, "卡片类型错误" | |
154 | + assert resQueryList.json()["rows"][0]["cardTypeText"] == "副卡", "卡片类型错误" | |
155 | + assert "cardFaceText" not in str(resQueryList.json()["rows"][0]),"副卡不应该存在卡面" | |
156 | + | |
157 | + | |
158 | + def test_delStorageInRecord(self): | |
159 | + """ | |
160 | + 正常删除卡片记录 | |
161 | + :return: | |
162 | + """ | |
163 | + # 新增加一条入库记录用于删除 | |
164 | + resCardFace = cSI.getCardFace(cardHost=self.cardHost,webHeaders=self.webHeaders) | |
165 | + cardFace = cSI.returnFaceValue(resCardFace=resCardFace,faceNum=3) | |
166 | + startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime())) | |
167 | + endCardNo = startCardNo + 1 | |
168 | + resSavaCard = cSI.savaCard(cardHost=self.cardHost,webHeaders=self.webHeaders,startCardNo=startCardNo,endCardNo=endCardNo,cardFace=cardFace) | |
169 | + assert resSavaCard.json()["message"]=="OK","入库失败" | |
170 | + resQueryList = cSI.queryList(cardHost=self.cardHost, webHeaders=self.webHeaders) | |
171 | + ida = resQueryList.json()['rows'][0]['id'] | |
172 | + resDel = cSI.delCard(cardHost=self.cardHost,webHeaders=self.webHeaders,ids=ida) | |
173 | + assert resDel.json()["message"]=="OK","删除失败,入库记录未被成功删除" | |
174 | + resQueryListB = cSI.queryList(cardHost=self.cardHost, webHeaders=self.webHeaders) | |
175 | + idb = resQueryListB.json()['rows'][0]['id'] | |
176 | + print(ida,"----------------",idb) | |
177 | + assert ida!=idb,"删除功能异常,记录未被删除" | |
178 | + | |
179 | + def test_delStorageInRecordFail_delCard(self): | |
180 | + """ | |
181 | + 已作废的卡片不能被删除 | |
182 | + :return: | |
183 | + """ | |
184 | + resCardFace = cSI.getCardFace(cardHost=self.cardHost,webHeaders=self.webHeaders) | |
185 | + cardFace = cSI.returnFaceValue(resCardFace=resCardFace,faceNum=3) | |
186 | + startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime())) | |
187 | + endCardNo = startCardNo+1 | |
188 | + resSavaCard = cSI.savaCard(cardHost=self.cardHost,webHeaders=self.webHeaders,startCardNo=startCardNo,endCardNo=endCardNo,cardFace=cardFace) | |
189 | + # 卡片作废 | |
190 | + cS.cardVoid(cardHost=self.cardHost,webHeaders=self.webHeaders,cardNo=startCardNo) | |
191 | + # 删除入库记录 | |
192 | + resQueryList = cSI.queryList(cardHost=self.cardHost, webHeaders=self.webHeaders) | |
193 | + ida = resQueryList.json()['rows'][0]['id'] | |
194 | + resDel = cSI.delCard(cardHost=self.cardHost, webHeaders=self.webHeaders, ids=ida) | |
195 | + print(resDel.json()) | |
196 | + assert resDel.json()["message"]=="有部分卡片已出库或作废,删除失败","已作废的卡片不能被删除" | |
197 | + | |
198 | + def test_delStorageInRecordFail_cardOut(self): | |
199 | + """ | |
200 | + 存在出库卡片的入库记录,不能进行删除 | |
201 | + :return: | |
202 | + """ | |
203 | + resCardFace = cSI.getCardFace(cardHost=self.cardHost, webHeaders=self.webHeaders) | |
204 | + cardFace = cSI.returnFaceValue(resCardFace=resCardFace, faceNum=3) | |
205 | + startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime())) | |
206 | + endCardNo = startCardNo + 1 | |
207 | + resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startCardNo, | |
208 | + endCardNo=endCardNo, cardFace=cardFace) | |
209 | + # 卡片出库 | |
210 | + acc = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=str(startCardNo),applyUserName=self.applyUserName,applyUserCode=self.applyUserCode,applyUserId=self.applyUserId) | |
211 | + # print(acc.json()) | |
212 | + # 删除入库记录 | |
213 | + resQueryList = cSI.queryList(cardHost=self.cardHost, webHeaders=self.webHeaders) | |
214 | + ida = resQueryList.json()['rows'][0]['id'] | |
215 | + resDel = cSI.delCard(cardHost=self.cardHost, webHeaders=self.webHeaders, ids=ida) | |
216 | + # print(resDel.json()) | |
217 | + assert resDel.json()["message"] == "有部分卡片已出库或作废,删除失败", "已出库的卡片不能被删除" | |
218 | + | |
48 | 219 | @classmethod |
49 | 220 | def tearDownClass(cls): |
50 | 221 | print("tearDown") | ... | ... |
report/cardSystem/test_cardStorage.py renamed to testCase/cardSystem/test_cardStorage.py
report/cardSystem/test_changeCard.py renamed to testCase/cardSystem/test_changeCard.py
report/cardSystem/test_lossCard.py renamed to testCase/cardSystem/test_lossCard.py
report/cardSystem/test_openMasterCard.py renamed to testCase/cardSystem/test_openMasterCard.py
report/cardSystem/test_openSlaveCard.py renamed to testCase/cardSystem/test_openSlaveCard.py
report/cardSystem/test_outCard.py renamed to testCase/cardSystem/test_outCard.py
report/cardSystem/test_pwdModify.py renamed to testCase/cardSystem/test_pwdModify.py
report/cardSystem/test_pwdReset.py renamed to testCase/cardSystem/test_pwdReset.py