Commit 937ad0480fb60f13b75330fe6e31a0bbabc1354f

Authored by liujiqiang
1 parent 8ff5b663

更新

report/test.log
1   -[2021-07-21 10:47:31] [INFO] : 发送邮件
2   -[2021-07-21 10:47:33] [INFO] : 邮件发送完毕
  1 +[2021-07-21 10:51:53] [INFO] : 发送邮件
  2 +[2021-07-21 10:51:55] [INFO] : 邮件发送完毕
... ...
testCase/cardSystem/__init__.py deleted 100644 → 0
1   -# -*- coding: utf-8 -*-
2   -
3   -# @Time : 2021/7/16 14:36
4   -# @Author : Ljq
5   -# @File : __init__.py.py
6   -# @Software: PyCharm
7   -
8   -"""
9   -
10   -"""
testCase/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_cardStorage.py deleted 100644 → 0
1   -#coding=utf-8
2   -
3   -# @Time : 2021/5/24 15:41
4   -# @Author : Ljq
5   -# @File : test_cardStorage.py
6   -# @Software: PyCharm
7   -
8   -
9   -"""
10   - 卡片库存校验
11   -"""
12   -
13   -import unittest
14   -import time
15   -import math
16   -import commons.api.cardStorageIn as cSI
17   -import commons.api.cardStock as cS
18   -import commons.api.cardStorageOut as cSO
19   -from commons.scripts.readConf import readConfig
20   -from commons.api.doLogin import doLogin
21   -
22   -class test_cardStorage(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   -
33   - @classmethod
34   - def tearDownClass(cls):
35   - pass
36   -
37   - def setUp(self):
38   - time.sleep(2)
39   - # pass
40   -
41   - def tearDown(self):
42   - pass
43   -
44   - def test_queryCardStorageList(self):
45   - """
46   - 库存列表测试
47   - :return:
48   - """
49   - resQuery = cS.queryCardStorageList(cardHost=self.cardHost,webHeaders=self.webHeaders)
50   - print(resQuery.json())
51   - assert "200" == resQuery.json()["code"],"查询失败"
52   - # 列表翻页
53   - pageNum = math.ceil(resQuery.json()["total"]/10)
54   - print(pageNum)
55   - for num in range(pageNum):
56   - resQuery = cS.queryCardStorageList(cardHost=self.cardHost, webHeaders=self.webHeaders,page=num+1)
57   - assert "200" == resQuery.json()["code"], "查询失败"
58   - if num >5:
59   - break
60   - elif num>0:
61   - sTime = resQuery.json()["rows"][0]["createTime"]
62   - # print(str(num)+" sTime "+sTime)
63   - # print(str(num) + " eTime " + eTime)
64   - assert sTime <= eTime,"当前页第一列数据的创建时间应该小于上一页的最后一条数据的结束时间"
65   - eTime = resQuery.json()["rows"][9]["createTime"]
66   -
67   - def test_cardVoid(self):
68   - """
69   - 作废功能测试
70   - :return:
71   - """
72   - resCardFace = cSI.getCardFace(cardHost=self.cardHost,webHeaders=self.webHeaders)
73   - cardFace = cSI.returnFaceValue(resCardFace=resCardFace,faceNum=3)
74   - startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
75   - endCardNo = startCardNo+1
76   - resSavaCard = cSI.savaCard(cardHost=self.cardHost,webHeaders=self.webHeaders,startCardNo=startCardNo,endCardNo=endCardNo,cardFace=cardFace)
77   - # 新入库卡片作废
78   - resVoid = cS.cardVoid(cardHost=self.cardHost,webHeaders=self.webHeaders,cardNo=startCardNo)
79   - print(resVoid.json())
80   - assert resVoid.json()["code"]=="200","新入库卡片作废测试失败"
81   -
82   - # 新出库的卡片可以作废
83   - cardNos = str(endCardNo)
84   - amount = 1
85   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=cardNos,
86   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
87   - applyUserCode=self.applyUserCode, amount=amount)
88   - assert outCardRes.json()["code"] == "200", "出库失败"
89   - resVoid = cS.cardVoid(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNo=cardNos)
90   - print(resVoid.json())
91   - assert resVoid.json()["code"] == "200", "新出库卡片作废测试失败"
92   -
93   - # 已开卡的卡片不能进行作废
94   -
95   - def test_searchAllOptions(self):
96   - """
97   - 查询条件测试
98   - :return:
99   - """
100   - resCardFace = cSI.getCardFace(cardHost=self.cardHost,webHeaders=self.webHeaders)
101   - cardFace = cSI.returnFaceValue(resCardFace=resCardFace,faceNum=3)
102   - startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
103   - endCardNo = startCardNo+6
104   - resSavaCard = cSI.savaCard(cardHost=self.cardHost,webHeaders=self.webHeaders,startCardNo=startCardNo,endCardNo=endCardNo,cardFace=cardFace)
105   -
106   - # 新入库卡片作废
107   - resVoid = cS.cardVoid(cardHost=self.cardHost,webHeaders=self.webHeaders,cardNo=startCardNo)
108   - print(resVoid.json())
109   - assert resVoid.json()["code"]=="200","新入库卡片作废测试失败"
110   - # 卡片库存作废状态查询
111   - resQuery = cS.queryCardStorageList(cardHost=self.cardHost, webHeaders=self.webHeaders,cardNo=startCardNo)
112   - assert "200" == resQuery.json()["code"], "查询失败"
113   - assert "3" == str(resQuery.json()["rows"][0]["state"]),"状态查询成功"
114   - # 卡片库存激活状态查询
115   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=startCardNo+1,
116   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
117   - applyUserCode=self.applyUserCode, amount=1)
118   - resQuery = cS.queryCardStorageList(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNo=startCardNo+1)
119   - assert "200" == resQuery.json()["code"], "查询失败"
120   - assert "2" == str(resQuery.json()["rows"][0]["state"]), "状态查询成功"
121   -
122   - # 查询主卡
123   - resQuery = cS.queryCardStorageList(cardHost=self.cardHost, webHeaders=self.webHeaders, type=10)
124   - assert "200" == resQuery.json()["code"], "查询失败"
125   - assert 10 == list(set([i["type"] for i in resQuery.json()["rows"]]))[0], "查库存中的主卡失败"
126   - # 查询副卡
127   - resQuery = cS.queryCardStorageList(cardHost=self.cardHost, webHeaders=self.webHeaders, type=20)
128   - assert "200" == resQuery.json()["code"], "查询失败"
129   - assert 20 == list(set([i["type"] for i in resQuery.json()["rows"]]))[0], "查库存中的副卡失败"
130   -
131   - # 查询卡面
132   - resCardFace = cSI.getCardFace(cardHost=self.cardHost,webHeaders=self.webHeaders)
133   - if len(resCardFace.json())>1:
134   - cardFaceList = [i["value"] for i in resCardFace.json()][1:]
135   - print(cardFaceList)
136   - for cardFaceItem in cardFaceList:
137   - print("1----------------------")
138   - resQuery = cS.queryCardStorageList(cardHost=self.cardHost, webHeaders=self.webHeaders,
139   - cardFace=cardFaceItem)
140   - assert 1 == len(list(set([i["cardFace"] for i in resQuery.json()["rows"]]))), "失败"
141   - assert cardFaceItem == list(set([i["cardFace"] for i in resQuery.json()["rows"]]))[0], "卡面查询校验失败"
142   - else:
143   - print("2----------------------")
144   - resQuery = cS.queryCardStorageList(cardHost=self.cardHost, webHeaders=self.webHeaders)
145   - assert "cardFace" not in resQuery.text, "卡面查询校验失败"
146   -
147   - # 卡号
148   - resQuery = cS.queryCardStorageList(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNo=startCardNo)
149   - # print(len(resQuery.json()["rows"]))
150   - assert 1 == len(resQuery.json()["rows"]),"卡号查询失败"
151   - assert str(startCardNo) == resQuery.json()["rows"][0]["cardNo"], "卡号查询失败"
152   -
153   - # 入库时间查询
154   - startDate = str(time.strftime("%Y-%m-%d 00:00:00", time.localtime()))
155   - endDate = str(time.strftime("%Y-%m-%d 23:59:59", time.localtime()))
156   - resQuery = cS.queryCardStorageList(cardHost=self.cardHost, webHeaders=self.webHeaders,startDate=startDate,endDate=endDate)
157   - pageNums = math.ceil(resQuery.json()["total"]/10)
158   - dateList = []
159   - for pageNum in range(pageNums):
160   - resQuery = cS.queryCardStorageList(cardHost=self.cardHost, webHeaders=self.webHeaders,startDate=startDate,endDate=endDate,page=pageNum)
161   - dateList = dateList+[i["createTime"] for i in resQuery.json()["rows"]]
162   - assert [] == [i for i in dateList if i<startDate or i>endDate],"查询结果错误,查询出非当天的入库信息"
testCase/cardSystem/test_changeCard.py deleted 100644 → 0
1   -#coding=utf-8
2   -
3   -# @Time : 2021/6/1 10:02
4   -# @Author : Ljq
5   -# @File : test_changeCard.py
6   -# @Software: PyCharm
7   -
8   -
9   -"""
10   -
11   -"""
12   -
13   -import unittest
14   -import time
15   -import commons.api.cardStorageIn as cSI
16   -import commons.api.returnCard as reC
17   -import commons.api.cardStorageOut as cSO
18   -import commons.api.openCard as oMC
19   -import commons.api.cardStock as cS
20   -import commons.api.changeCard as cC
21   -from commons.scripts.readConf import readConfig
22   -from commons.api.doLogin import doLogin
23   -
24   -class tset_changeCard(unittest.TestCase):
25   - def setUp(self) -> None:
26   - time.sleep(3)
27   -
28   - def tearDown(self) -> None:
29   - pass
30   -
31   - @classmethod
32   - def setUpClass(cls) -> None:
33   - # 配置信息获取
34   - readC = readConfig()
35   - cls.cardHost = readC.returnOptionsItems("host", "cardHost")
36   - cls.gatewayHost = readC.returnOptionsItems("host", "gatewayHost")
37   - cls.cCNum = readC.returnOptionsItems("testInfo","cCNum")
38   - cls.cCNumB = readC.returnOptionsItems("testInfo", "cCNumB")
39   - cls.cardNum = readC.returnOptionsItems("testInfo", "cardNum")
40   - cls.cardNumRe = readC.returnOptionsItems("testInfo", "cardNumRe")
41   - cls.loginPwd = readC.returnOptionsItems("testInfo", "loginPwd")
42   - # 登录信息获取
43   - cls.webHeaders, cls.clientHeaders, cls.userInfo = doLogin().loginUser()
44   - cls.applyUserName = cls.userInfo["data"]["user"]["realName"]
45   - cls.applyUserId = cls.userInfo["data"]["user"]["id"]
46   - cls.applyUserCode = cls.userInfo["data"]["user"]["userName"]
47   - cls.firmId = cls.userInfo["data"]["user"]["firmId"]
48   -
49   - @classmethod
50   - def tearDownClass(cls) -> None:
51   - pass
52   -
53   - def test_getSimpleInfo(self):
54   - """用户信息获取"""
55   - # 未入库的卡片进行客户信息获取
56   - notInCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
57   - res = cC.getSimpleInfo(gatewayHost=self.gatewayHost,clientHeaders=self.clientHeaders,cardNo=notInCardNo)
58   - print(res.json())
59   - assert "10001" == res.json()["code"], "未入库的卡片进行信息获取,测试不通过"
60   - assert "卡账户不存在" == res.json()["message"], "未入库的卡片进行信息获取,测试不通过"
61   -
62   - # 入库未开卡的卡片进行信息获取
63   - faceNum = 1
64   - startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
65   - endCardNo = startCardNo + 1
66   - resCardFace = cSI.getCardFace(cardHost=self.cardHost, webHeaders=self.webHeaders)
67   - cardFace = cSI.returnFaceValue(resCardFace=resCardFace, faceNum=faceNum)
68   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startCardNo,
69   - endCardNo=endCardNo, cardFace=cardFace)
70   - print("resSavaCard.json() ->", resSavaCard.json())
71   - res = cC.getSimpleInfo(gatewayHost=self.gatewayHost,clientHeaders=self.clientHeaders,cardNo=startCardNo)
72   - print(res.json())
73   - assert "10001" == res.json()["code"], "未出库的卡片进行信息获取,测试不通过"
74   - assert "卡账户不存在" == res.json()["message"], "未出库的卡片进行信息获取,测试不通过"
75   -
76   - # 出库未开卡的卡片进行信息获取
77   - cardNos = str(startCardNo) + "," + str(endCardNo)
78   - print(cardNos)
79   - amount = len([i for i in range(startCardNo, endCardNo)])
80   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=cardNos,
81   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
82   - applyUserCode=self.applyUserCode, amount=amount)
83   - assert outCardRes.json()["code"] == "200", "出库失败"
84   - res = cC.getSimpleInfo(gatewayHost=self.gatewayHost,clientHeaders=self.clientHeaders,cardNo=startCardNo)
85   - print(res.json())
86   - assert "10001" == res.json()["code"], "出库未开卡的卡片进行信息获取,测试不通过"
87   - assert "卡账户不存在" == res.json()["message"], "出库未开卡的卡片进行信息获取,测试不通过"
88   -
89   - # 正常的主卡获取客户信息
90   - resFirstOpen = oMC.openMasterCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
91   - cCNum=self.cCNum, cardNo=startCardNo, applyUserName=self.applyUserName)
92   - print("resFirstOpen", resFirstOpen.json())
93   - assert "200" == resFirstOpen.json()["code"], "第一次开卡,开卡失败"
94   - assert "data" in resFirstOpen.json(), "第一次开卡,开卡失败"
95   - res = cC.getSimpleInfo(gatewayHost=self.gatewayHost,clientHeaders=self.clientHeaders,cardNo=startCardNo)
96   - print(res.json())
97   - assert "200" == res.json()["code"], "正常获取客户信息获取失败"
98   - assert "OK" == res.json()["message"], "正常获取客户信息获取失败"
99   -
100   - # 使用副卡进行信息获取
101   - # 副卡入库-出库-开卡
102   - startSlaveCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
103   - endSlaveCardNo = startSlaveCardNo + 1
104   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startSlaveCardNo,
105   - endCardNo=endSlaveCardNo, cardType=20)
106   - res = oMC.checkNewCardNo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
107   - cardNo=startSlaveCardNo,
108   - cardType=20)
109   - assert "20000" == res.json()["code"], "使用已存在未出库的卡片进行校验校验失败"
110   - assert "该卡状态为[未激活],不能开卡!" == res.json()["message"], "message信息与预期信息不匹配"
111   - slaveCardNos = str(startSlaveCardNo) + "," + str(endSlaveCardNo)
112   - amount = len([i for i in range(startSlaveCardNo, endSlaveCardNo + 1)])
113   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=slaveCardNos,
114   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
115   - applyUserCode=self.applyUserCode, amount=amount)
116   - assert outCardRes.json()["code"] == "200", "出库失败"
117   - resOpenSlaveCard = oMC.openSlaveCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
118   - cardNo=startCardNo, slaveCardNo=startSlaveCardNo,
119   - loginPwd=self.loginPwd, applyUserName=self.applyUserName,
120   - parentLoginPwd=self.loginPwd)
121   - assert "200" == resOpenSlaveCard.json()["code"], "开卡测试失败"
122   - # 以上为测试准备
123   - res = cC.getSimpleInfo(gatewayHost=self.gatewayHost,clientHeaders=self.clientHeaders,cardNo=startSlaveCardNo)
124   - print(res.json())
125   - assert "200" == res.json()["code"], "正常获取客户信息获取失败"
126   - assert "OK" == res.json()["message"], "正常获取客户信息获取失败"
127   -
128   - # 已挂失的卡片进行信息获取
129   -
130   - # 已锁定的卡片进行信息获取
131   -
132   - # 已冻结的卡片进行信息获取
133   -
134   -
135   - # 副卡退卡
136   - reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startSlaveCardNo)
137   - # 主卡退卡
138   - reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo)
139   -
140   -
141   - def test_getChangeCardFee(self):
142   - """换卡工本费信息获取"""
143   - res = cC.getChangeCardFee(gatewayHost=self.gatewayHost,clientHeaders=self.clientHeaders)
144   - print(res.json())
145   - assert "200" == res.json()["code"], "正常获取客户信息获取失败"
146   - assert "OK" == res.json()["message"], "正常获取客户信息获取失败"
147   -
148   - def test_checkCorrectCard(self):
149   - """新卡卡状态校验"""
150   - # 主卡入库-出库-开卡
151   - faceNum = 1
152   - startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
153   - endCardNo = startCardNo + 1
154   - resCardFace = cSI.getCardFace(cardHost=self.cardHost, webHeaders=self.webHeaders)
155   - cardFace = cSI.returnFaceValue(resCardFace=resCardFace, faceNum=faceNum)
156   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startCardNo,
157   - endCardNo=endCardNo, cardFace=cardFace)
158   - print("resSavaCard.json() ->", resSavaCard.json())
159   - cardNos = str(startCardNo) + "," + str(endCardNo)
160   - print(cardNos)
161   - amount = len([i for i in range(startCardNo, endCardNo)])
162   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=cardNos,
163   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
164   - applyUserCode=self.applyUserCode, amount=amount)
165   - assert outCardRes.json()["code"] == "200", "出库失败"
166   - resFirstOpen = oMC.openMasterCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
167   - cCNum=self.cCNum, cardNo=startCardNo, applyUserName=self.applyUserName)
168   - print("resFirstOpen", resFirstOpen.json())
169   - assert "200" == resFirstOpen.json()["code"], "第一次开卡,开卡失败"
170   - assert "data" in resFirstOpen.json(), "第一次开卡,开卡失败"
171   - # 副卡入库-出库-开卡
172   - startSlaveCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
173   - endSlaveCardNo = startSlaveCardNo + 1
174   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startSlaveCardNo,
175   - endCardNo=endSlaveCardNo, cardType=20)
176   - res = oMC.checkNewCardNo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
177   - cardNo=startSlaveCardNo,
178   - cardType=20)
179   - assert "20000" == res.json()["code"], "使用已存在未出库的卡片进行校验校验失败"
180   - assert "该卡状态为[未激活],不能开卡!" == res.json()["message"], "message信息与预期信息不匹配"
181   - slaveCardNos = str(startSlaveCardNo) + "," + str(endSlaveCardNo)
182   - amount = len([i for i in range(startSlaveCardNo, endSlaveCardNo + 1)])
183   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=slaveCardNos,
184   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
185   - applyUserCode=self.applyUserCode, amount=amount)
186   - assert outCardRes.json()["code"] == "200", "出库失败"
187   - resOpenSlaveCard = oMC.openSlaveCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
188   - cardNo=startCardNo, slaveCardNo=startSlaveCardNo,
189   - loginPwd=self.loginPwd, applyUserName=self.applyUserName,
190   - parentLoginPwd=self.loginPwd)
191   - assert "200" == resOpenSlaveCard.json()["code"], "开卡测试失败"
192   - # 以上为测试数据准备
193   -
194   - # 主卡校验
195   - customerId = cC.getSimpleInfo(gatewayHost=self.gatewayHost,clientHeaders=self.clientHeaders,
196   - cardNo=startCardNo).json()["data"]["accountInfo"]["customerId"]
197   - print("customerId",customerId)
198   - resCheckCard = cC.checkCard(gatewayHost=self.gatewayHost,clientHeaders=self.clientHeaders,cardNo=endCardNo,customerId=customerId)
199   - print(resCheckCard.json())
200   - assert "200" == resCheckCard.json()["code"], "正常新主卡校验测试不通过"
201   - assert "OK" == resCheckCard.json()["message"], "正常新主卡校验测试不通过"
202   - assert str(endCardNo) in resCheckCard.text, "正常新主卡校验测试不通过"
203   -
204   - # 副卡校验
205   - resCheckCard = cC.checkCard(gatewayHost=self.gatewayHost,clientHeaders=self.clientHeaders,cardNo=endSlaveCardNo,cardType=20,customerId=customerId)
206   - print(resCheckCard.json())
207   - assert "200" == resCheckCard.json()["code"], "正常新副卡校验测试不通过"
208   - assert "OK" == resCheckCard.json()["message"], "正常新副卡校验测试不通过"
209   - assert str(endSlaveCardNo) in resCheckCard.text, "正常新副卡校验测试不通过"
210   -
211   - # 副卡退卡
212   - reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startSlaveCardNo)
213   - # 主卡退卡
214   - reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo)
215   -
216   - def test_checkErrorCard(self):
217   - """使用错误状态的卡片进行新卡校验"""
218   - # 主卡入库-出库-开卡
219   - faceNum = 1
220   - startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
221   - endCardNo = startCardNo + 2
222   - resCardFace = cSI.getCardFace(cardHost=self.cardHost, webHeaders=self.webHeaders)
223   - cardFace = cSI.returnFaceValue(resCardFace=resCardFace, faceNum=faceNum)
224   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startCardNo,
225   - endCardNo=endCardNo, cardFace=cardFace)
226   - print("resSavaCard.json() ->", resSavaCard.json())
227   - cardNos = str(startCardNo) + "," + str(endCardNo)
228   - print(cardNos)
229   - amount = 2
230   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=cardNos,
231   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
232   - applyUserCode=self.applyUserCode, amount=amount)
233   - assert outCardRes.json()["code"] == "200", "出库失败"
234   - resFirstOpen = oMC.openMasterCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
235   - cCNum=self.cCNum, cardNo=startCardNo, applyUserName=self.applyUserName)
236   - print("resFirstOpen", resFirstOpen.json())
237   - assert "200" == resFirstOpen.json()["code"], "第一次开卡,开卡失败"
238   - assert "data" in resFirstOpen.json(), "第一次开卡,开卡失败"
239   - # 副卡入库-出库-开卡
240   - startSlaveCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
241   - endSlaveCardNo = startSlaveCardNo + 2
242   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startSlaveCardNo,
243   - endCardNo=endSlaveCardNo, cardType=20)
244   - res = oMC.checkNewCardNo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
245   - cardNo=startSlaveCardNo,
246   - cardType=20)
247   - assert "20000" == res.json()["code"], "使用已存在未出库的卡片进行校验校验失败"
248   - assert "该卡状态为[未激活],不能开卡!" == res.json()["message"], "message信息与预期信息不匹配"
249   - slaveCardNos = str(startSlaveCardNo) + "," + str(endSlaveCardNo)
250   - amount = 2
251   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=slaveCardNos,
252   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
253   - applyUserCode=self.applyUserCode, amount=amount)
254   - assert outCardRes.json()["code"] == "200", "出库失败"
255   - resOpenSlaveCard = oMC.openSlaveCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
256   - cardNo=startCardNo, slaveCardNo=startSlaveCardNo,
257   - loginPwd=self.loginPwd, applyUserName=self.applyUserName,
258   - parentLoginPwd=self.loginPwd)
259   - assert "200" == resOpenSlaveCard.json()["code"], "开卡测试失败"
260   - # 开卡结束
261   -
262   - customerId = cC.getSimpleInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
263   - cardNo=startCardNo).json()["data"]["accountInfo"]["customerId"]
264   - print("customerId", customerId)
265   - # 以上为测试数据准备
266   -
267   - """开始测试"""
268   - # 使用未出库的卡片进行校验
269   - resCheckCard = cC.checkCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=999999999999,
270   - customerId=customerId)
271   - print("resCheckCard",resCheckCard.json())
272   - assert "10000" == resCheckCard.json()["code"], "未入库卡片校验测试不通过"
273   - assert "该卡未入库!" == resCheckCard.json()["message"], "未入库卡片校验测试不通过"
274   -
275   - # 使用已作废的卡片进行校验
276   - voidCardNo = startCardNo+1
277   - resVoid = cS.cardVoid(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNo=voidCardNo)
278   - assert resVoid.json()["code"] == "200", "新入库卡片作废测试失败"
279   - resCheckCard = cC.checkCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=voidCardNo,
280   - customerId=customerId)
281   - print("resCheckCard",resCheckCard.json())
282   - assert "20000" == resCheckCard.json()["code"], "[作废]卡片校验测试不通过"
283   - assert "该卡状态为[作废],不能开卡!" == resCheckCard.json()["message"], "[作废]卡片校验测试不通过"
284   -
285   - # 使用不匹配的卡面进行校验 -- 寿光市场
286   - if self.firmId == 8:
287   - pass
288   -
289   - # 使用已开卡的主卡进行校验
290   - resFirstOpen = oMC.openMasterCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
291   - cCNum=self.cCNum, cardNo=endCardNo, applyUserName=self.applyUserName)
292   - print("resFirstOpen", resFirstOpen.json())
293   - assert "200" == resFirstOpen.json()["code"], "第一次开卡,开卡失败"
294   - assert "data" in resFirstOpen.json(), "第一次开卡,开卡失败"
295   - resCheckCard = cC.checkCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=endCardNo,
296   - customerId=customerId)
297   - # print("resCheckCard",resCheckCard.json())
298   - assert "20000" == resCheckCard.json()["code"], "正常新主卡校验测试不通过"
299   - assert "该卡状态为[在用],不能开卡!" == resCheckCard.json()["message"], "正常新主卡校验测试不通过"
300   - reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=endCardNo) #退卡
301   - resCheckCard = cC.checkCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=endCardNo,
302   - customerId=customerId)
303   -
304   - # 使用已退还的卡片可以进行换卡操作校验成功
305   - # print("resCheckCard",resCheckCard.json())
306   - assert "200" == resCheckCard.json()["code"], "已退还的主卡校验测试不通过"
307   - assert "OK" == resCheckCard.json()["message"], "已退还的主卡校验测试不通过"
308   - assert str(endCardNo) in resCheckCard.text, "已退还的主卡校验测试不通过"
309   -
310   - # 主卡换卡时使用副卡校验
311   - resCheckCard = cC.checkCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardType=10,cardNo=endSlaveCardNo,
312   - customerId=customerId)
313   - print("resCheckCard",resCheckCard.json())
314   - assert "20000" == resCheckCard.json()["code"], "使用副卡对主卡进行换卡校验测试不通过"
315   - assert "请使用主卡办理当前业务!" == resCheckCard.json()["message"], "使用副卡对主卡进行换卡校验测试不通过"
316   -
317   - # 副卡换卡时使用主卡进行校验
318   - resCheckCard = cC.checkCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardType=20,cardNo=endCardNo,
319   - customerId=customerId)
320   - print("resCheckCard",resCheckCard.json())
321   - assert "20000" == resCheckCard.json()["code"], "副卡换卡时使用主卡进行校验测试不通过"
322   - assert "请使用副卡办理当前业务!" == resCheckCard.json()["message"], "副卡换卡时使用主卡进行校验测试不通过"
323   -
324   - # 使用未出库的副卡进行校验
325   - resCheckCard = cC.checkCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
326   - cardNo=999999999999, cardType=20, customerId=customerId)
327   - print(resCheckCard.json())
328   - assert "10000" == resCheckCard.json()["code"], "未入库卡片校验测试不通过"
329   - assert "该卡未入库!" == resCheckCard.json()["message"], "未入库卡片校验测试不通过"
330   -
331   - # 使用已开卡的副卡进行校验
332   - resOpenSlaveCard = oMC.openSlaveCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
333   - cardNo=startCardNo, slaveCardNo=endSlaveCardNo,
334   - loginPwd=self.loginPwd, applyUserName=self.applyUserName,
335   - parentLoginPwd=self.loginPwd)
336   - assert "200" == resOpenSlaveCard.json()["code"], "开卡测试失败"
337   - resCheckCard = cC.checkCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
338   - cardNo=endSlaveCardNo, cardType=20, customerId=customerId)
339   - print(resCheckCard.json())
340   - assert "20000" == resCheckCard.json()["code"], "已开卡的卡片进行状态校验测试不通过"
341   - assert "该卡状态为[在用],不能开卡!" == resCheckCard.json()["message"], "已开卡的卡片进行状态校验测试不通过"
342   - reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=endSlaveCardNo)
343   -
344   - """测试完成"""
345   - # 副卡退卡
346   - reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startSlaveCardNo)
347   - # 主卡退卡
348   - reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo)
349   -
350   - def test_changeCard(self):
351   - """换卡正向流程测试"""
352   - # 主卡入库-出库-开卡
353   - faceNum = 1
354   - startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
355   - endCardNo = startCardNo + 2
356   - resCardFace = cSI.getCardFace(cardHost=self.cardHost, webHeaders=self.webHeaders)
357   - cardFace = cSI.returnFaceValue(resCardFace=resCardFace, faceNum=faceNum)
358   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startCardNo,
359   - endCardNo=endCardNo, cardFace=cardFace)
360   - print("resSavaCard.json() ->", resSavaCard.json())
361   - cardNos = str(startCardNo) + "," + str(endCardNo)
362   - amount = 2
363   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=cardNos,
364   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
365   - applyUserCode=self.applyUserCode, amount=amount)
366   - assert outCardRes.json()["code"] == "200", "出库失败"
367   - resFirstOpen = oMC.openMasterCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
368   - cCNum=self.cCNum, cardNo=startCardNo, applyUserName=self.applyUserName)
369   - assert "200" == resFirstOpen.json()["code"], "第一次开卡,开卡失败"
370   - assert "data" in resFirstOpen.json(), "第一次开卡,开卡失败"
371   - # 副卡入库-出库-开卡
372   - startSlaveCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
373   - endSlaveCardNo = startSlaveCardNo + 2
374   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startSlaveCardNo,
375   - endCardNo=endSlaveCardNo, cardType=20)
376   - res = oMC.checkNewCardNo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
377   - cardNo=startSlaveCardNo,
378   - cardType=20)
379   - assert "20000" == res.json()["code"], "使用已存在未出库的卡片进行校验校验失败"
380   - assert "该卡状态为[未激活],不能开卡!" == res.json()["message"], "message信息与预期信息不匹配"
381   - slaveCardNos = str(startSlaveCardNo) + "," + str(endSlaveCardNo)
382   - amount = 2
383   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=slaveCardNos,
384   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
385   - applyUserCode=self.applyUserCode, amount=amount)
386   - assert outCardRes.json()["code"] == "200", "出库失败"
387   - resOpenSlaveCard = oMC.openSlaveCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
388   - cardNo=startCardNo, slaveCardNo=startSlaveCardNo,
389   - loginPwd=self.loginPwd, applyUserName=self.applyUserName,
390   - parentLoginPwd=self.loginPwd)
391   - assert "200" == resOpenSlaveCard.json()["code"], "开卡测试失败"
392   - # 开卡结束 --- > 获取卡账户信息,换卡工本费
393   - serviceFee = cC.getChangeCardFee(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders).json()["data"]
394   - # 以上为测试数据准备
395   - """开始测试"""
396   -
397   - # 主卡换卡正常换卡测试 ---> 换卡成功后原卡片变为激活状态
398   - resSimpleInfo = cC.getSimpleInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
399   - cardNo=startCardNo)
400   - customerId,accountId = resSimpleInfo.json()["data"]["accountInfo"]["customerId"],resSimpleInfo.json()["data"]["accountInfo"]["accountId"]
401   - resChangeCard = cC.changeCard(gatewayHost=self.gatewayHost,clientHeaders=self.clientHeaders,cardNo=startCardNo,
402   - newCardNo=endCardNo,serviceFee=serviceFee,loginPwd=self.loginPwd,accountId=accountId,customerId=customerId)
403   - assert "200" == resChangeCard.json()["code"],"主卡换卡测试不通过"
404   - assert "OK" == resChangeCard.json()["message"],"主卡换卡测试不通过"
405   - resQuery = cS.queryCardStorageList(cardHost=self.cardHost, webHeaders=self.webHeaders,cardNo=startCardNo)
406   - assert "200" == resQuery.json()["code"], "查询失败"
407   - assert "2" == str(resQuery.json()["rows"][0]["state"]),"状态查询成功"
408   -
409   - # 副卡换卡正常换卡测试,换卡成功后原卡片变为激活状态
410   - resSimpleInfo = cC.getSimpleInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
411   - cardNo=startSlaveCardNo)
412   - customerId,accountId = resSimpleInfo.json()["data"]["accountInfo"]["customerId"],resSimpleInfo.json()["data"]["accountInfo"]["accountId"]
413   - resChangeCard = cC.changeCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
414   - cardNo=startSlaveCardNo,
415   - newCardNo=endSlaveCardNo, serviceFee=serviceFee, loginPwd=self.loginPwd,
416   - accountId=accountId, customerId=customerId)
417   - assert "200" == resChangeCard.json()["code"], "主卡换卡测试不通过"
418   - assert "OK" == resChangeCard.json()["message"], "主卡换卡测试不通过"
419   - resQuery = cS.queryCardStorageList(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNo=startSlaveCardNo)
420   - assert "200" == resQuery.json()["code"], "查询失败"
421   - assert "2" == str(resQuery.json()["rows"][0]["state"]), "状态查询成功"
422   -
423   -
424   - """测试完成"""
425   - # 副卡退卡
426   - reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=endSlaveCardNo)
427   - # 主卡退卡
428   - reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=endCardNo)
429   -
430   - def test_changeCardError(self):
431   - """换卡正向流程测试"""
432   - # 主卡入库-出库-开卡
433   - faceNum = 1
434   - startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
435   - endCardNo = startCardNo + 2
436   - resCardFace = cSI.getCardFace(cardHost=self.cardHost, webHeaders=self.webHeaders)
437   - cardFace = cSI.returnFaceValue(resCardFace=resCardFace, faceNum=faceNum)
438   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startCardNo,
439   - endCardNo=endCardNo, cardFace=cardFace)
440   - print("resSavaCard.json() ->", resSavaCard.json())
441   - cardNos = str(startCardNo) + "," + str(endCardNo)
442   - amount = 2
443   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=cardNos,
444   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
445   - applyUserCode=self.applyUserCode, amount=amount)
446   - assert outCardRes.json()["code"] == "200", "出库失败"
447   - resFirstOpen = oMC.openMasterCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
448   - cCNum=self.cCNum, cardNo=startCardNo, applyUserName=self.applyUserName)
449   - assert "200" == resFirstOpen.json()["code"], "第一次开卡,开卡失败"
450   - assert "data" in resFirstOpen.json(), "第一次开卡,开卡失败"
451   - resFirstOpen = oMC.openMasterCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
452   - cCNum=self.cCNum, cardNo=endCardNo, applyUserName=self.applyUserName)
453   - assert "200" == resFirstOpen.json()["code"], "第一次开卡,开卡失败"
454   - assert "data" in resFirstOpen.json(), "第一次开卡,开卡失败"
455   - # 副卡入库-出库-开卡
456   - startSlaveCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
457   - endSlaveCardNo = startSlaveCardNo + 2
458   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startSlaveCardNo,
459   - endCardNo=endSlaveCardNo, cardType=20)
460   - res = oMC.checkNewCardNo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
461   - cardNo=startSlaveCardNo,
462   - cardType=20)
463   - assert "20000" == res.json()["code"], "使用已存在未出库的卡片进行校验校验失败"
464   - assert "该卡状态为[未激活],不能开卡!" == res.json()["message"], "message信息与预期信息不匹配"
465   - slaveCardNos = str(startSlaveCardNo) + "," + str(endSlaveCardNo)
466   - amount = 2
467   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=slaveCardNos,
468   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
469   - applyUserCode=self.applyUserCode, amount=amount)
470   - assert outCardRes.json()["code"] == "200", "出库失败"
471   - resOpenSlaveCard = oMC.openSlaveCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
472   - cardNo=startCardNo, slaveCardNo=startSlaveCardNo,
473   - loginPwd=self.loginPwd, applyUserName=self.applyUserName,
474   - parentLoginPwd=self.loginPwd)
475   - assert "200" == resOpenSlaveCard.json()["code"], "开卡测试失败"
476   - resOpenSlaveCard = oMC.openSlaveCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
477   - cardNo=startCardNo, slaveCardNo=endSlaveCardNo,
478   - loginPwd=self.loginPwd, applyUserName=self.applyUserName,
479   - parentLoginPwd=self.loginPwd)
480   - assert "200" == resOpenSlaveCard.json()["code"], "开卡测试失败"
481   - # 开卡结束 --- > 获取卡账户信息,换卡工本费
482   - serviceFee = cC.getChangeCardFee(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders).json()["data"]
483   - resSimpleInfo = cC.getSimpleInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
484   - cardNo=startCardNo)
485   - customerId,accountId = resSimpleInfo.json()["data"]["accountInfo"]["customerId"],resSimpleInfo.json()["data"]["accountInfo"]["accountId"]
486   - resSimpleInfo = cC.getSimpleInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
487   - cardNo=startSlaveCardNo)
488   - customerIdSlaveCard,accountIdSlaveCard = resSimpleInfo.json()["data"]["accountInfo"]["customerId"],resSimpleInfo.json()["data"]["accountInfo"]["accountId"]
489   - # 以上为测试数据准备
490   - """开始测试"""
491   -
492   - # 使用未入库的主卡卡片和副卡进行换卡
493   - resChangeCard = cC.changeCard(gatewayHost=self.gatewayHost,clientHeaders=self.clientHeaders,cardNo=startCardNo,
494   - newCardNo=999999999999,serviceFee=serviceFee,loginPwd=self.loginPwd,accountId=accountId,customerId=customerId)
495   - assert "10000" == resChangeCard.json()["code"],"主卡换卡测试不通过"
496   - assert "该卡未入库!" == resChangeCard.json()["message"],"主卡换卡测试不通过"
497   - resChangeCard = cC.changeCard(gatewayHost=self.gatewayHost,clientHeaders=self.clientHeaders,cardNo=startSlaveCardNo,
498   - newCardNo=999999999999,serviceFee=serviceFee,loginPwd=self.loginPwd,
499   - accountId=accountIdSlaveCard,customerId=customerIdSlaveCard)
500   - assert "10000" == resChangeCard.json()["code"],"副卡换卡测试不通过"
501   - assert "该卡未入库!" == resChangeCard.json()["message"],"副卡换卡测试不通过"
502   -
503   - # 使用未出库的主卡卡片和副卡进行换卡
504   - resChangeCard = cC.changeCard(gatewayHost=self.gatewayHost,clientHeaders=self.clientHeaders,cardNo=startCardNo,
505   - newCardNo=startCardNo+1,serviceFee=serviceFee,loginPwd=self.loginPwd,accountId=accountId,customerId=customerId)
506   - print(resChangeCard.json())
507   - assert "20000" == resChangeCard.json()["code"],"使用未出库的主卡换卡测试不通过"
508   - assert "该卡状态为[未激活],不能开卡!" == resChangeCard.json()["message"],"使用未出库的主卡换卡测试不通过"
509   - resChangeCard = cC.changeCard(gatewayHost=self.gatewayHost,clientHeaders=self.clientHeaders,cardNo=startSlaveCardNo,
510   - newCardNo=startSlaveCardNo+1,serviceFee=serviceFee,loginPwd=self.loginPwd,
511   - accountId=accountIdSlaveCard,customerId=customerIdSlaveCard)
512   - print(resChangeCard.json())
513   - assert "20000" == resChangeCard.json()["code"],"使用未出库的副卡换卡测试不通过"
514   - assert "该卡状态为[未激活],不能开卡!" == resChangeCard.json()["message"],"使用未出库的副卡换卡测试不通过"
515   -
516   - # 使用已开卡的主卡卡片和副卡进行换卡
517   - resChangeCard = cC.changeCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
518   - cardNo=startCardNo,
519   - newCardNo=endCardNo, serviceFee=serviceFee, loginPwd=self.loginPwd,
520   - accountId=accountId, customerId=customerId)
521   - print(resChangeCard.json())
522   - assert "20000" == resChangeCard.json()["code"], "主卡换卡测试不通过"
523   - assert "该卡状态为[在用],不能开卡!" == resChangeCard.json()["message"], " 使用已开卡的主卡换卡测试不通过"
524   - resChangeCard = cC.changeCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
525   - cardNo=startSlaveCardNo,
526   - newCardNo=endSlaveCardNo, serviceFee=serviceFee, loginPwd=self.loginPwd,
527   - accountId=accountIdSlaveCard, customerId=customerIdSlaveCard)
528   - print(resChangeCard.json())
529   - assert "20000" == resChangeCard.json()["code"], "副卡换卡测试不通过"
530   - assert "该卡状态为[在用],不能开卡!" == resChangeCard.json()["message"], " 使用已开卡的副卡换卡测试不通过"
531   -
532   - """测试完成"""
533   - # 副卡退卡
534   - reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=endSlaveCardNo)
535   - # 副卡退卡
536   - reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startSlaveCardNo)
537   - # 主卡退卡
538   - reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=endCardNo)
539   - # 主卡退卡
540   - reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo)
541   -
testCase/cardSystem/test_lossCard.py deleted 100644 → 0
1   -#coding=utf-8
2   -
3   -# @Time : 2021/6/17 15:56
4   -# @Author : Ljq
5   -# @File : test_lossCard.py
6   -# @Software: PyCharm
7   -
8   -
9   -"""
10   -
11   -"""
12   -
13   -import unittest
14   -import time
15   -import commons.api.cardStorageIn as cardStorageIn
16   -import commons.api.returnCard as returnCard
17   -import commons.api.cardStorageOut as cardStorageOut
18   -import commons.api.openCard as openCard
19   -import commons.api.cardLostAndUnLost as cardLostAndUnLost
20   -from commons.scripts.readConf import readConfig
21   -from commons.api.doLogin import doLogin
22   -
23   -class test_lossCardAndUn(unittest.TestCase):
24   - """卡片挂失,解挂测试"""
25   - def setUp(self) -> None:
26   - # 主卡入库-出库-开卡
27   - faceNum = 1
28   - self.startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
29   - self.endCardNo = self.startCardNo + 2
30   - resCardFace = cardStorageIn.getCardFace(cardHost=self.cardHost, webHeaders=self.webHeaders)
31   - cardFace = cardStorageIn.returnFaceValue(resCardFace=resCardFace, faceNum=faceNum)
32   - resSavaCard = cardStorageIn.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders,
33   - startCardNo=self.startCardNo,
34   - endCardNo=self.endCardNo, cardFace=cardFace)
35   - print("resSavaCard.json() ->", resSavaCard.json())
36   - cardNos = str(self.startCardNo) + "," + str(self.endCardNo)
37   - print(cardNos)
38   - amount = 2
39   - outCardRes = cardStorageOut.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=cardNos,
40   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
41   - applyUserCode=self.applyUserCode, amount=amount)
42   - assert outCardRes.json()["code"] == "200", "出库失败"
43   - resFirstOpen = openCard.openMasterCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
44   - cCNum=self.cCNum, cardNo=self.startCardNo,
45   - applyUserName=self.applyUserName)
46   - print("resFirstOpen", resFirstOpen.json())
47   - assert "200" == resFirstOpen.json()["code"], "第一次开卡,开卡失败"
48   - assert "data" in resFirstOpen.json(), "第一次开卡,开卡失败"
49   - # 副卡入库-出库-开卡
50   - self.startSlaveCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
51   - self.endSlaveCardNo = self.startSlaveCardNo + 2
52   - resSavaCard = cardStorageIn.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders,
53   - startCardNo=self.startSlaveCardNo,
54   - endCardNo=self.endSlaveCardNo, cardType=20)
55   - res = openCard.checkNewCardNo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
56   - cardNo=self.startSlaveCardNo,
57   - cardType=20)
58   - assert "20000" == res.json()["code"], "使用已存在未出库的卡片进行校验校验失败"
59   - assert "该卡状态为[未激活],不能开卡!" == res.json()["message"], "message信息与预期信息不匹配"
60   - slaveCardNos = str(self.startSlaveCardNo) + "," + str(self.endSlaveCardNo)
61   - amount = 2
62   - outCardRes = cardStorageOut.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=slaveCardNos,
63   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
64   - applyUserCode=self.applyUserCode, amount=amount)
65   - assert outCardRes.json()["code"] == "200", "出库失败"
66   - resOpenSlaveCard = openCard.openSlaveCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
67   - cardNo=self.startCardNo, slaveCardNo=self.startSlaveCardNo,
68   - loginPwd=self.loginPwd, applyUserName=self.applyUserName,
69   - parentLoginPwd=self.loginPwd)
70   - assert "200" == resOpenSlaveCard.json()["code"], "开卡测试失败"
71   - # 开卡结束-获取卡片客户信息
72   -
73   - def tearDown(self) -> None:
74   - # 副卡退卡,主卡退卡
75   - returnCard.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
76   - cardNo=self.startSlaveCardNo)
77   - returnCard.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=self.startCardNo)
78   -
79   - @classmethod
80   - def setUpClass(cls) -> None:
81   - # 配置信息获取
82   - readC = readConfig()
83   - cls.cardHost = readC.returnOptionsItems("host", "cardHost")
84   - cls.gatewayHost = readC.returnOptionsItems("host", "gatewayHost")
85   - cls.cCNum = readC.returnOptionsItems("testInfo","cCNum")
86   - cls.cCNumB = readC.returnOptionsItems("testInfo", "cCNumB")
87   - cls.cardNum = readC.returnOptionsItems("testInfo", "cardNum")
88   - cls.cardNumRe = readC.returnOptionsItems("testInfo", "cardNumRe")
89   - cls.loginPwd = readC.returnOptionsItems("testInfo", "loginPwd")
90   - # 登录信息获取
91   - cls.webHeaders, cls.clientHeaders, cls.userInfo = doLogin().loginUser()
92   - cls.applyUserName = cls.userInfo["data"]["user"]["realName"]
93   - cls.applyUserId = cls.userInfo["data"]["user"]["id"]
94   - cls.applyUserCode = cls.userInfo["data"]["user"]["userName"]
95   - cls.firmId = cls.userInfo["data"]["user"]["firmId"]
96   -
97   - @classmethod
98   - def tearDownClass(cls) -> None:
99   - pass
100   -
101   - def test_getAccountInfo(self):
102   - """
103   - 获取卡片信息测试
104   - :return:
105   - """
106   - # 使用未入库的卡片进行获取
107   - resGet = openCard.getAccountInfo(gatewayHost=self.gatewayHost,clientHeaders =self.clientHeaders,cardNo=999999999999)
108   - print(resGet.json())
109   - assert "10001" == resGet.json()["code"],"未入库卡片信息获取测试不通过"
110   - assert "卡账户不存在" == resGet.json()["message"],"未入库卡片信息获取测试不通过"
111   -
112   - # 使用入库未出库的卡片进行信息获取
113   - # 卡片入库
114   - faceNum = 1
115   - startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
116   - endCardNo = startCardNo + 2
117   -
118   - resCardFace = cardStorageIn.getCardFace(cardHost=self.cardHost, webHeaders=self.webHeaders)
119   - cardFace = cardStorageIn.returnFaceValue(resCardFace=resCardFace, faceNum=faceNum)
120   - resSavaCard = cardStorageIn.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startCardNo,
121   - endCardNo=endCardNo, cardFace=cardFace)
122   - resGet = openCard.getAccountInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo)
123   - print(resGet.json())
124   - assert "10001" == resGet.json()["code"], "未出库卡片信息获取测试不通过"
125   - assert "卡账户不存在" == resGet.json()["message"], "未出库卡片信息获取测试不通过"
126   -
127   - # 使用出库未开卡的卡片进行信息获取
128   - cardNos = str(startCardNo) + "," + str(endCardNo)
129   - amount = len([i for i in range(startCardNo, endCardNo + 1)])
130   - outCardRes = cardStorageOut.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=cardNos,
131   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
132   - applyUserCode=self.applyUserCode, amount=amount)
133   - assert outCardRes.json()["code"] == "200", "出库失败"
134   - resGet = openCard.getAccountInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo)
135   - print(resGet.json())
136   - assert "10001" == resGet.json()["code"], "未出库卡片信息获取测试不通过"
137   - assert "卡账户不存在" == resGet.json()["message"], "未出库卡片信息获取测试不通过"
138   -
139   - # 使用已开卡的卡片可以正确的获取到客户信息
140   - resFirstOpen = openCard.openMasterCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
141   - cCNum=self.cCNum, cardNo=startCardNo, applyUserName=self.applyUserName)
142   - assert "200" == resFirstOpen.json()["code"], "开卡失败"
143   - assert "data" in resFirstOpen.json(), "开卡失败"
144   - resGet = openCard.getAccountInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo)
145   - # print("resGet.json()",resGet.json())
146   - assert "200" == resGet.json()["code"], "已开卡卡片信息获取测试不通过"
147   - assert "data" in resGet.json(), "已开卡卡片信息获取测试不通过"
148   -
149   - # 使用已挂失的卡片信息进行卡片信息获取
150   - accountId,customerId = resGet.json()["data"]["accountId"],resGet.json()["data"]["customerId"]
151   - resLossCard = cardLostAndUnLost.lossCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=str(startCardNo),
152   - accountId=accountId, customerId=customerId, loginPwd=self.loginPwd)
153   - # print("resLossCard.json()",resLossCard.json())
154   - assert "200" == resLossCard.json()["code"],"已挂失的卡片获取卡片信息测试不通过"
155   - resGet = openCard.getAccountInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo)
156   - # print("resGet.json()", resGet.json())
157   - assert "2000" == resGet.json()["code"], "未出库卡片信息获取测试不通过"
158   - assert "该卡为挂失状态,不能进行此操作" == resGet.json()["message"], "未出库卡片信息获取测试不通过"
159   - # 解挂
160   - resUnLoss = cardLostAndUnLost.unLostCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=str(startCardNo),
161   - accountId=accountId, customerId=customerId, loginPwd=self.loginPwd)
162   - # print("resUnLoss.json()",resUnLoss.json())
163   -
164   - # 账号冻结状态
165   -
166   - # 卡片锁定状态
167   -
168   - # 使用已退还的卡片进行卡片信息获取
169   - returnCard.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo)
170   - resGet = openCard.getAccountInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo)
171   - # print("resGet.json()", resGet.json())
172   - assert "2000" == resGet.json()["code"], "已退还的卡片信息获取测试不通过"
173   - assert "该卡为退还状态,不能进行此操作" == resGet.json()["message"], "已退还的卡片信息获取测试不通过"
174   -
175   -
176   - def test_lossCardAndUnLost(self):
177   - """卡片挂失"""
178   - # 获取卡片客户信息
179   - accountInfo = openCard.getAccountInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=self.startCardNo)
180   - accountId,customerId = accountInfo.json()["data"]["accountId"],accountInfo.json()["data"]["customerId"]
181   - slaveCardAccountInfo = openCard.getAccountInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=self.startSlaveCardNo)
182   - print("slaveCardAccountInfo ",slaveCardAccountInfo.json())
183   - customerIdSlaveCard, accountIdSlaveCard = slaveCardAccountInfo.json()["data"]["customerId"], slaveCardAccountInfo.json()["data"]["accountId"]
184   - # 以上为测试数据准备
185   -
186   - """开始测试"""
187   - # 正常主卡卡片挂失解挂
188   - resLossCard = cardLostAndUnLost.lossCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
189   - cardNo=str(self.startCardNo),accountId=accountId, customerId=customerId,
190   - loginPwd=self.loginPwd)
191   - assert "200" == resLossCard.json()["code"],"卡片挂失失败"
192   - resUnLoss = cardLostAndUnLost.unLostCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
193   - cardNo=str(self.startCardNo), accountId=accountId, customerId=customerId,
194   - loginPwd=self.loginPwd)
195   - assert "200" == resUnLoss.json()["code"],"卡片解挂失败"
196   -
197   -
198   - # 正常副卡卡片挂失解挂
199   - resLossCard = cardLostAndUnLost.lossCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
200   - cardNo=str(self.startSlaveCardNo),accountId=accountIdSlaveCard,
201   - customerId=customerIdSlaveCard,
202   - loginPwd=self.loginPwd)
203   - assert "200" == resLossCard.json()["code"],"副卡挂失失败"
204   - resUnLoss = cardLostAndUnLost.unLostCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
205   - cardNo=str(self.startSlaveCardNo), accountId=accountIdSlaveCard,
206   - customerId=customerIdSlaveCard,
207   - loginPwd=self.loginPwd)
208   - assert "200" == resUnLoss.json()["code"], "副卡解挂失败"
209   -
210   - """测试完成"""
211   -
212   - def test_lossCardError(self):
213   - """挂失卡片异常情况"""
214   - # 卡账户信息准备
215   - accountInfo = openCard.getAccountInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
216   - cardNo=self.startCardNo)
217   - accountId, customerId = accountInfo.json()["data"]["accountId"], accountInfo.json()["data"]["customerId"]
218   - slaveCardAccountInfo = openCard.getAccountInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
219   - cardNo=self.startSlaveCardNo)
220   - print("slaveCardAccountInfo ", slaveCardAccountInfo.json())
221   - customerIdSlaveCard, accountIdSlaveCard = slaveCardAccountInfo.json()["data"]["customerId"], \
222   - slaveCardAccountInfo.json()["data"]["accountId"]
223   - # 以上为测试数据准备
224   -
225   - """开始测试"""
226   - # 密码长度不满足六位数字时挂失失败
227   - resLossCard = cardLostAndUnLost.lossCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
228   - cardNo=str(self.startCardNo), accountId=accountId, customerId=customerId,
229   - loginPwd="1111111")
230   - assert "1000" == resLossCard.json()["code"], "密码长度超过六位的错误验证测试不通过"
231   - assert "密码必须6位" == resLossCard.json()["message"], "密码长度超过六位的错误验证测试不通过"
232   - resLossCard = cardLostAndUnLost.lossCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
233   - cardNo=str(self.startCardNo), accountId=accountId, customerId=customerId,
234   - loginPwd="11111")
235   - assert "1000" == resLossCard.json()["code"], "密码长度不足六位的错误验证测试不通过"
236   - assert "密码必须6位" == resLossCard.json()["message"], "密码长度不足六位的错误验证测试不通过"
237   -
238   - # 密码错误挂失失败
239   - resLossCard = cardLostAndUnLost.lossCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
240   - cardNo=str(self.startCardNo), accountId=accountId, customerId=customerId,
241   - loginPwd="123890")
242   - assert "10001" == resLossCard.json()["code"], "密码错误挂失失败测试不通过"
243   - assert "密码输入有误" == resLossCard.json()["message"], "密码错误挂失失败测试不通过"
244   -
245   -
246   - # 主卡挂失后,副卡不可以再进行挂失
247   - resLossCard = cardLostAndUnLost.lossCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
248   - cardNo=str(self.startCardNo), accountId=accountId, customerId=customerId,
249   - loginPwd=self.loginPwd)
250   - assert "200" == resLossCard.json()["code"], "卡片挂失失败"
251   - resLossCard = cardLostAndUnLost.lossCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
252   - cardNo=str(self.startSlaveCardNo), accountId=accountIdSlaveCard,
253   - customerId=customerIdSlaveCard,
254   - loginPwd=self.loginPwd)
255   - assert "2000" == resLossCard.json()["code"], "主卡挂失后副卡不能挂失测试失败"
256   - assert f"该卡的主卡【{self.startCardNo}】为挂失状态,不能进行此操作" == resLossCard.json()["message"], "主卡挂失后副卡不能挂失测试失败"
257   - resUnLoss = cardLostAndUnLost.unLostCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
258   - cardNo=str(self.startCardNo), accountId=accountId, customerId=customerId,
259   - loginPwd=self.loginPwd)
260   - assert "200" == resUnLoss.json()["code"], "卡片解挂失败"
261   - """测试完成"""
262   -
263   - def test_getByCardForUnLost(self):
264   - """挂失卡片信息信息"""
265   - # 卡账户信息准备
266   - accountInfo = openCard.getAccountInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
267   - cardNo=self.startCardNo)
268   - accountId, customerId = accountInfo.json()["data"]["accountId"], accountInfo.json()["data"]["customerId"]
269   - slaveCardAccountInfo = openCard.getAccountInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
270   - cardNo=self.startSlaveCardNo)
271   - print("slaveCardAccountInfo ", slaveCardAccountInfo.json())
272   - customerIdSlaveCard, accountIdSlaveCard = slaveCardAccountInfo.json()["data"]["customerId"], \
273   - slaveCardAccountInfo.json()["data"]["accountId"]
274   - # 以上为测试数据准备
275   -
276   - """开始测试"""
277   -
278   - # 使用状态正常的卡片进行信息获取
279   - resGetByCard = cardLostAndUnLost.getByCardForUnLost(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
280   - cardNo=self.startCardNo)
281   - print(resGetByCard.json())
282   - assert "2000" == resGetByCard.json()["code"],"状态正常的卡片用户信息获取测试不通过"
283   - assert "该卡为正常状态,不能进行此操作" == resGetByCard.json()["message"],"状态正常的卡片用户信息获取测试不通过"
284   -
285   - # 已挂失的卡片可以成功获取到卡片信息
286   - resLossCard = cardLostAndUnLost.lossCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
287   - cardNo=str(self.startCardNo), accountId=accountId, customerId=customerId,
288   - loginPwd=self.loginPwd)
289   - assert "200" == resLossCard.json()["code"], "卡片挂失失败"
290   -
291   - resGetByCard = cardLostAndUnLost.getByCardForUnLost(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
292   - cardNo=self.startCardNo)
293   - print(resGetByCard.json())
294   - assert "200" == resGetByCard.json()["code"],"已挂失的卡片可以成功获取到卡片信息测试不通过"
295   - assert f"{accountId}" in resGetByCard.text,"已挂失的卡片可以成功获取到卡片信息测试不通过"
296   -
297   - resUnLoss = cardLostAndUnLost.unLostCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
298   - cardNo=str(self.startCardNo), accountId=accountId, customerId=customerId,
299   - loginPwd=self.loginPwd)
300   - assert "200" == resUnLoss.json()["code"], "卡片解挂失败"
301   -
302   - # 未开卡的卡片获取信息验证
303   - resGetByCard = cardLostAndUnLost.getByCardForUnLost(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
304   - cardNo="999999999999")
305   - print(resGetByCard.json())
306   - assert "10001" == resGetByCard.json()["code"],"未开卡的卡片获取信息验证测试不通过"
307   - assert "卡账户不存在" == resGetByCard.json()["message"],"未开卡的卡片获取信息验证测试不通过"
308   -
309   - # 副卡挂失操作异常操作
310   - print("开始副卡挂失异常操作")
311   -
312   - # 使用状态正常的副卡进行信息获取
313   - resGetByCard = cardLostAndUnLost.getByCardForUnLost(gatewayHost=self.gatewayHost,
314   - clientHeaders=self.clientHeaders,
315   - cardNo=self.startSlaveCardNo)
316   - print(resGetByCard.json())
317   - assert "2000" == resGetByCard.json()["code"], "状态正常的副卡用户信息获取测试不通过"
318   - assert "该卡为正常状态,不能进行此操作" == resGetByCard.json()["message"], "状态正常的副卡用户信息获取测试不通过"
319   -
320   - # 已挂失的副卡可以正常查询
321   - resLossCard = cardLostAndUnLost.lossCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
322   - cardNo=str(self.startSlaveCardNo), accountId=accountIdSlaveCard,
323   - customerId=customerIdSlaveCard,
324   - loginPwd=self.loginPwd)
325   - assert "200" == resLossCard.json()["code"], "副卡挂失失败"
326   - resGetByCard = cardLostAndUnLost.getByCardForUnLost(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
327   - cardNo=self.startSlaveCardNo)
328   - assert "200" == resGetByCard.json()["code"],"已挂失的副卡可以正常查询测试不通过"
329   - assert f"{accountId}" in resGetByCard.text,"已挂失的副卡可以正常查询测试不通过"
330   -
331   - # 副卡解挂
332   - resUnLoss = cardLostAndUnLost.unLostCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
333   - cardNo=str(self.startSlaveCardNo), accountId=accountIdSlaveCard,
334   - customerId=customerIdSlaveCard,
335   - loginPwd=self.loginPwd)
336   - assert "200" == resUnLoss.json()["code"], "副卡解挂失败"
337   - """测试完成"""
338   -
339   -
340   - def test_unLostError(self):
341   - """卡片异常解挂"""
342   - # 卡账户信息准备
343   - accountInfo = openCard.getAccountInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
344   - cardNo=self.startCardNo)
345   - accountId, customerId = accountInfo.json()["data"]["accountId"], accountInfo.json()["data"]["customerId"]
346   - slaveCardAccountInfo = openCard.getAccountInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
347   - cardNo=self.startSlaveCardNo)
348   - print("slaveCardAccountInfo ", slaveCardAccountInfo.json())
349   - customerIdSlaveCard, accountIdSlaveCard = slaveCardAccountInfo.json()["data"]["customerId"], \
350   - slaveCardAccountInfo.json()["data"]["accountId"]
351   - resLossCard = cardLostAndUnLost.lossCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
352   - cardNo=str(self.startCardNo), accountId=accountId,
353   - customerId=customerId,
354   - loginPwd=self.loginPwd)
355   - assert "200" == resLossCard.json()["code"], "卡片挂失失败"
356   - resGetByCard = cardLostAndUnLost.getByCardForUnLost(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
357   - cardNo=self.startCardNo)
358   - assert "200" == resGetByCard.json()["code"],"已挂失的卡片可以成功获取到卡片信息测试不通过"
359   -
360   - """开始测试"""
361   - # 使用错误的密码进行解挂
362   - resUnLoss = cardLostAndUnLost.unLostCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
363   - cardNo=str(self.startCardNo), accountId=accountId,
364   - customerId=customerId,
365   - loginPwd="123890")
366   - print("resUnLoss",resUnLoss.json())
367   - assert "10001" == resUnLoss.json()["code"], "使用错误的密码解挂失败测试不通过"
368   - assert "密码输入有误" == resUnLoss.json()["message"], "使用错误的密码解挂失败测试不通过"
369   -
370   - # 小于六位的密码进行解挂
371   - resUnLoss = cardLostAndUnLost.unLostCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
372   - cardNo=str(self.startCardNo), accountId=accountId,
373   - customerId=customerId,
374   - loginPwd="123")
375   - print("resUnLoss",resUnLoss.json())
376   - assert "10001" == resUnLoss.json()["code"], "小于六位的密码进行解挂失败测试不通过"
377   - assert "密码输入有误" == resUnLoss.json()["message"], "小于六位的密码进行解挂失败测试不通过"
378   -
379   - # 大于六位的密码进行解挂
380   - resUnLoss = cardLostAndUnLost.unLostCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
381   - cardNo=str(self.startCardNo), accountId=accountId,
382   - customerId=customerId,
383   - loginPwd="123111123")
384   - print("resUnLoss", resUnLoss.json())
385   - assert "10001" == resUnLoss.json()["code"], "大于六位的密码进行解挂失败测试不通过"
386   - assert "密码输入有误" == resUnLoss.json()["message"], "大于六位的密码进行解挂失败测试不通过"
387   - """解挂时未进行密码长度验证"""
388   -
389   - resUnLoss = cardLostAndUnLost.unLostCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
390   - cardNo=str(self.startCardNo), accountId=accountId,
391   - customerId=customerId,
392   - loginPwd=self.loginPwd)
393   - """测试完成"""
394   -
testCase/cardSystem/test_openMasterCard.py deleted 100644 → 0
1   -#coding=utf-8
2   -
3   -# @Time : 2021/5/26 10:16
4   -# @Author : Ljq
5   -# @File : test_openMasterCard.py
6   -# @Software: PyCharm
7   -
8   -
9   -"""
10   - 主卡开卡测试
11   -"""
12   -
13   -import unittest
14   -import time
15   -import commons.api.cardStorageIn as cSI
16   -import commons.api.returnCard as reC
17   -import commons.api.cardStorageOut as cSO
18   -import commons.api.openCard as oMC
19   -import commons.api.cardStock as cS
20   -from commons.scripts.createIdNum import cIN
21   -from commons.api.doLogin import doLogin
22   -from commons.scripts.readConf import readConfig
23   -
24   -class tset_openMasterCard(unittest.TestCase):
25   - def setUp(self) -> None:
26   - pass
27   -
28   - def tearDown(self) -> None:
29   - pass
30   -
31   - @classmethod
32   - def setUpClass(cls) -> None:
33   - # 配置信息获取
34   - readC = readConfig()
35   - cls.cardHost = readC.returnOptionsItems("host", "cardHost")
36   - cls.gatewayHost = readC.returnOptionsItems("host", "gatewayHost")
37   - cls.cCNum = readC.returnOptionsItems("testInfo","cCNum")
38   - cls.cCNumB = readC.returnOptionsItems("testInfo", "cCNumB")
39   - cls.cardNum = readC.returnOptionsItems("testInfo", "cardNum")
40   - cls.cardNumRe = readC.returnOptionsItems("testInfo", "cardNumRe")
41   - cls.loginPwd = readC.returnOptionsItems("testInfo", "loginPwd")
42   - # 登录信息获取
43   - cls.webHeaders, cls.clientHeaders, cls.userInfo = doLogin().loginUser()
44   - cls.applyUserName = cls.userInfo["data"]["user"]["realName"]
45   - cls.applyUserId = cls.userInfo["data"]["user"]["id"]
46   - cls.applyUserCode = cls.userInfo["data"]["user"]["userName"]
47   - cls.firmId = cls.userInfo["data"]["user"]["firmId"]
48   -
49   - @classmethod
50   - def tearDownClass(cls) -> None:
51   - pass
52   -
53   - def test_getCustomerInfo(self):
54   - """
55   - 客户查询测试
56   - :return:
57   - """
58   - # 正确的获取客户信息
59   - res = oMC.getCustomerInfo(gatewayHost=self.gatewayHost,clientHeaders=self.clientHeaders,cCNum=self.cCNum)
60   - print(res.json())
61   - assert "200" == res.json()["code"],"使用已存在的客户信息查询失败"
62   - # 获取客户身份类型
63   - res = oMC.getSubTypeName(gatewayHost=self.gatewayHost,clientHeaders=self.clientHeaders,customerId=res.json()["data"]["id"])
64   - assert "200" == res.json()["code"],"查询客户身份类型失败"
65   - assert "" != res.json()["data"], "身份类型不应该为空"
66   -
67   - # 使用不存在的证件号进行查询
68   - res = oMC.getCustomerInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cCNum=cIN())
69   - assert "20002" == res.json()["code"], "使用不存在的客户信息查询时查询结果不一致"
70   -
71   - def test_checkNewCardNo(self):
72   - """
73   - 卡状态校验
74   - :return:
75   - """
76   - # 正向测试卡面校验功能---> #获取客户信息
77   - print(self.clientHeaders)
78   - resCusInfo = oMC.getCustomerInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cCNum=self.cCNum)
79   - print(resCusInfo.json())
80   - assert "200" == resCusInfo.json()["code"], "使用已存在的客户信息查询失败"
81   - # 校验
82   - res = oMC.checkNewCardNo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=self.cardNum,customerId=resCusInfo.json()["data"]["id"],customerType=resCusInfo.json()["data"]["customerType"])
83   - print("res.json()", res.json())
84   - assert "200" == res.json()["code"], "使用已存在未开卡的卡片进行校验校验失败"
85   -
86   - # 使用未入库的卡片进行校验
87   - res = oMC.checkNewCardNo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=999999999999,
88   - customerId=resCusInfo.json()["data"]["id"],
89   - customerType=resCusInfo.json()["data"]["customerType"])
90   - assert "10000" == res.json()["code"], "使用已存在未开卡的卡片进行校验校验失败"
91   - assert "该卡未入库!" == res.json()["message"], "message信息与预期信息不匹配"
92   -
93   - # 未出库的卡片进行校验
94   - resCardFace = cSI.getCardFace(cardHost=self.cardHost, webHeaders=self.webHeaders)
95   - cardFace = cSI.returnFaceValue(resCardFace=resCardFace, faceNum=1)
96   - if self.firmId == 9:
97   - startCardNo, endCardNo = 999999999998, 999999999998
98   - elif self.firmId == 8:
99   - startCardNo, endCardNo = 999999999997, 999999999997
100   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startCardNo,
101   - endCardNo=endCardNo, cardFace=cardFace)
102   - res = oMC.checkNewCardNo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo,
103   - customerId=resCusInfo.json()["data"]["id"],
104   - customerType=resCusInfo.json()["data"]["customerType"])
105   - print(res.json())
106   - assert "20000" == res.json()["code"], "未出库的卡片进行校验校验失败"
107   - assert "该卡状态为[未激活],不能开卡!" == res.json()["message"], "未出库卡片校验,message信息与预期信息不匹配"
108   -
109   - # 对已开卡的卡片进行校验
110   - res = oMC.checkNewCardNo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=self.cardNumRe,
111   - customerId=resCusInfo.json()["data"]["id"],
112   - customerType=resCusInfo.json()["data"]["customerType"])
113   - print(res.json())
114   - assert "20000" == res.json()["code"], "未出库的卡片进行校验校验失败"
115   - assert "该卡状态为[在用],不能开卡!" == res.json()["message"], "未出库卡片校验,message信息与预期信息不匹配"
116   -
117   - def test_getOpenCardFee(self):
118   - """收费项获取"""
119   - # 获取开卡手续费
120   - res = oMC.getOpenCardFee(gatewayHost=self.gatewayHost,clientHeaders=self.clientHeaders)
121   - print(res.json())
122   - assert "200" == res.json()["code"],"开卡手续费获取失败"
123   - assert "" != res.json()["data"],"开卡手续费获取失败"
124   -
125   - def test_openMasterCard(self):
126   - """
127   - 正向开卡流程
128   - :return:
129   - """
130   - # 卡片出库
131   - faceNum = 1
132   - resCardFace = cSI.getCardFace(cardHost=self.cardHost, webHeaders=self.webHeaders)
133   - cardFace = cSI.returnFaceValue(resCardFace=resCardFace, faceNum=faceNum)
134   - startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
135   - endCardNo = startCardNo+1
136   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startCardNo,
137   - endCardNo=endCardNo, cardFace=cardFace)
138   - # 出库
139   - cardNos = str(startCardNo) + "," + str(endCardNo)
140   - amount = len([i for i in range(startCardNo, endCardNo + 1)])
141   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=cardNos,
142   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
143   - applyUserCode=self.applyUserCode, amount=amount)
144   - assert outCardRes.json()["code"] == "200", "出库失败"
145   -
146   -
147   - # 获取手续费
148   - costFee = oMC.getOpenCardFee(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders).json()["data"]
149   - print(costFee)
150   - # 获取客户信息
151   - resCusInfo = oMC.getCustomerInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
152   - cCNum=self.cCNum).json()["data"]
153   - print(resCusInfo)
154   - # 客户信息准备
155   - customerName = resCusInfo["name"]
156   - customerType = resCusInfo["customerType"]
157   - customerId = resCusInfo["id"]
158   - customerOrganizationType=resCusInfo["organizationType"]
159   - customerCredentialType = resCusInfo["certificateType"]
160   - customerContactsPhone = resCusInfo["customerContactsPhone"]
161   - customerCertificateNumber = resCusInfo["certificateNumber"]
162   - customerCode = resCusInfo["code"]
163   - name = self.applyUserName
164   - holdName = resCusInfo["name"]
165   - holdContactsPhone = resCusInfo["customerContactsPhone"]
166   -
167   - # 卡片状态校验
168   - resCheck = oMC.checkNewCardNo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo,
169   - customerId=customerId,
170   - customerType=customerType)
171   - print(resCheck.json())
172   - assert "200" == resCheck.json()["code"],"卡片校验失败"
173   -
174   - # 开卡
175   - print("开始开卡")
176   - resOpenCard = oMC.openMasterCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo,
177   - costFee=costFee, customerName=customerName, customerType=customerType,
178   - customerId=customerId, loginPwd=self.loginPwd,
179   - customerOrganizationType=customerOrganizationType,
180   - customerCredentialType=customerCredentialType,
181   - customerContactsPhone=customerContactsPhone,
182   - customerCertificateNumber=customerCertificateNumber, customerCode=customerCode,
183   - name=name, holdName=holdName, holdContactsPhone=holdContactsPhone,cardType=10)
184   -
185   - print("resOpenCard.json()",resOpenCard.json())
186   -
187   - assert "200" == resOpenCard.json()["code"],"开卡失败"
188   - assert None != resOpenCard.json()["data"], "开卡失败"
189   -
190   - # 获取卡信息
191   - reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo)
192   -
193   - def test_dupOpenCard(self):
194   - """
195   - 不能重复开卡
196   - :return:
197   - """
198   - # 卡片出库
199   - faceNum = 1
200   - resCardFace = cSI.getCardFace(cardHost=self.cardHost, webHeaders=self.webHeaders)
201   - cardFace = cSI.returnFaceValue(resCardFace=resCardFace, faceNum=faceNum)
202   - startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
203   - endCardNo = startCardNo+1
204   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startCardNo,
205   - endCardNo=endCardNo, cardFace=cardFace)
206   - # 出库
207   - cardNos = str(startCardNo) + "," + str(endCardNo)
208   - amount = len([i for i in range(startCardNo, endCardNo + 1)])
209   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=cardNos,
210   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
211   - applyUserCode=self.applyUserCode, amount=amount)
212   - assert outCardRes.json()["code"] == "200", "出库失败"
213   -
214   - # 获取手续费
215   - costFee = oMC.getOpenCardFee(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders).json()["data"]
216   - print(costFee)
217   - # 获取客户信息
218   - resCusInfo = oMC.getCustomerInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
219   - cCNum=self.cCNum).json()["data"]
220   - print(resCusInfo)
221   - # 客户信息准备
222   - customerName = resCusInfo["name"]
223   - customerType = resCusInfo["customerType"]
224   - customerId = resCusInfo["id"]
225   - customerOrganizationType = resCusInfo["organizationType"]
226   - customerCredentialType = resCusInfo["certificateType"]
227   - customerContactsPhone = resCusInfo["customerContactsPhone"]
228   - customerCertificateNumber = resCusInfo["certificateNumber"]
229   - customerCode = resCusInfo["code"]
230   - name = self.applyUserName
231   - holdName = resCusInfo["name"]
232   - holdContactsPhone = resCusInfo["customerContactsPhone"]
233   -
234   - # 卡片状态校验
235   - resCheck = oMC.checkNewCardNo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
236   - cardNo=startCardNo,
237   - customerId=customerId,
238   - customerType=customerType)
239   - print(resCheck.json())
240   - assert "200" == resCheck.json()["code"], "卡片校验失败"
241   -
242   - # 开卡
243   - print("开始开卡")
244   - resOpenCard = oMC.openMasterCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
245   - cardNo=startCardNo,
246   - costFee=costFee, customerName=customerName, customerType=customerType,
247   - customerId=customerId, loginPwd=self.loginPwd,
248   - customerOrganizationType=customerOrganizationType,
249   - customerCredentialType=customerCredentialType,
250   - customerContactsPhone=customerContactsPhone,
251   - customerCertificateNumber=customerCertificateNumber, customerCode=customerCode,
252   - name=name, holdName=holdName, holdContactsPhone=holdContactsPhone, cardType=10)
253   - print("resOpenCard.json()", resOpenCard.json())
254   - assert "200" == resOpenCard.json()["code"], "开卡失败"
255   - assert None != resOpenCard.json()["data"], "开卡失败"
256   -
257   - resOpenCard = oMC.openMasterCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
258   - cardNo=startCardNo,
259   - costFee=costFee, customerName=customerName, customerType=customerType,
260   - customerId=customerId, loginPwd=self.loginPwd,
261   - customerOrganizationType=customerOrganizationType,
262   - customerCredentialType=customerCredentialType,
263   - customerContactsPhone=customerContactsPhone,
264   - customerCertificateNumber=customerCertificateNumber, customerCode=customerCode,
265   - name=name, holdName=holdName, holdContactsPhone=holdContactsPhone, cardType=10)
266   - print("resOpenCard.json()", resOpenCard.json())
267   - assert "20000" == resOpenCard.json()["code"], "重复开卡失败测试不通过"
268   - assert "该卡状态为[在用],不能开卡!" == resOpenCard.json()["message"], "重复开卡失败测试不通过"
269   -
270   - # 获取卡信息
271   - reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo)
272   -
273   - def test_oneCardOneCus(self):
274   - """
275   - 一张卡只能同时开被开卡给一个用户
276   - :return:
277   - """
278   - # 卡片入库
279   - faceNum = 1
280   - startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
281   - endCardNo = startCardNo+1
282   -
283   - resCardFace = cSI.getCardFace(cardHost=self.cardHost, webHeaders=self.webHeaders)
284   - cardFace = cSI.returnFaceValue(resCardFace=resCardFace, faceNum=faceNum)
285   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startCardNo,
286   - endCardNo=endCardNo, cardFace=cardFace)
287   - # 出库
288   - cardNos = str(startCardNo) + "," + str(endCardNo)
289   - amount = len([i for i in range(startCardNo, endCardNo + 1)])
290   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=cardNos,
291   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
292   - applyUserCode=self.applyUserCode, amount=amount)
293   - assert outCardRes.json()["code"] == "200", "出库失败"
294   -
295   - # 开卡给第一个客户
296   - resFirstOpen = oMC.openMasterCardDef(gatewayHost=self.gatewayHost,clientHeaders=self.clientHeaders,cCNum=self.cCNum,cardNo=startCardNo,applyUserName=self.applyUserName)
297   - assert "200" == resFirstOpen.json()["code"],"第一次开卡,开卡失败"
298   - assert "data" in resFirstOpen.json(), "第一次开卡,开卡失败"
299   -
300   - # 开卡给第二个客户
301   - resSecondOpen = oMC.openMasterCardDef(gatewayHost=self.gatewayHost,clientHeaders=self.clientHeaders,cCNum=self.cCNumB,cardNo=startCardNo,applyUserName=self.applyUserName)
302   - print("resSecondOpen.json() - - ->",resSecondOpen.json())
303   - assert "20000" == resSecondOpen.json()["code"], "一张卡不能开卡给多用户测试不通过"
304   - assert "该卡状态为[在用],不能开卡!" in resSecondOpen.text, "一张卡不能开卡给多用户测试不通过"
305   -
306   - # 退卡
307   - reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo)
308   -
309   - def test_openCardState(self):
310   - """
311   - 不同异常状态的卡片在入库时的开卡情况
312   - :return:
313   - """
314   - # 卡片入库
315   - faceNum = 1
316   - startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
317   - endCardNo = startCardNo+1
318   -
319   - resCardFace = cSI.getCardFace(cardHost=self.cardHost, webHeaders=self.webHeaders)
320   - cardFace = cSI.returnFaceValue(resCardFace=resCardFace, faceNum=faceNum)
321   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startCardNo,
322   - endCardNo=endCardNo, cardFace=cardFace)
323   -
324   - # 已作废的卡片出库失败
325   - resVoid = cS.cardVoid(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNo=startCardNo)
326   - print(resVoid.json())
327   - assert resVoid.json()["code"] == "200", "新出库卡片作废测试失败"
328   - resFirstOpen = oMC.openMasterCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
329   - cCNum=self.cCNum, cardNo=startCardNo, applyUserName=self.applyUserName)
330   - print(resFirstOpen.json())
331   - assert "20000" == resFirstOpen.json()["code"], "已作废的卡片不能开卡,测试不通过"
332   - assert "该卡状态为[作废],不能开卡!" == resFirstOpen.json()["message"], "已作废的卡片不能开卡,提示信息错误"
333   -
334   - # 未出库的卡片出库失败
335   - resFirstOpen = oMC.openMasterCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
336   - cCNum=self.cCNum, cardNo=endCardNo, applyUserName=self.applyUserName)
337   - print(resFirstOpen.json())
338   - assert "20000" == resFirstOpen.json()["code"], "未激活的卡片不能开卡,测试不通过"
339   - assert "该卡状态为[未激活],不能开卡!" == resFirstOpen.json()["message"], "未激活的卡片不能开卡,提示信息错误"
340   -
testCase/cardSystem/test_openSlaveCard.py deleted 100644 → 0
1   -#coding=utf-8
2   -
3   -# @Time : 2021/5/26 10:19
4   -# @Author : Ljq
5   -# @File : test_openSlaveCard.py
6   -# @Software: PyCharm
7   -
8   -
9   -"""
10   - 副卡开卡测试
11   -"""
12   -
13   -import unittest
14   -import time
15   -import commons.api.cardStorageIn as cSI
16   -import commons.api.returnCard as reC
17   -import commons.api.cardStorageOut as cSO
18   -import commons.api.openCard as oMC
19   -import commons.api.cardLostAndUnLost as cLAUL
20   -import commons.api.cardStock as cS
21   -from commons.scripts.readConf import readConfig
22   -from commons.api.doLogin import doLogin
23   -
24   -class tset_openMasterCard(unittest.TestCase):
25   - def setUp(self) -> None:
26   - pass
27   -
28   - def tearDown(self) -> None:
29   - pass
30   -
31   - @classmethod
32   - def setUpClass(cls) -> None:
33   - # 配置信息获取
34   - readC = readConfig()
35   - cls.cardHost = readC.returnOptionsItems("host", "cardHost")
36   - cls.gatewayHost = readC.returnOptionsItems("host", "gatewayHost")
37   - cls.cCNum = readC.returnOptionsItems("testInfo","cCNum")
38   - cls.cCNumB = readC.returnOptionsItems("testInfo", "cCNumB")
39   - cls.cardNum = readC.returnOptionsItems("testInfo", "cardNum")
40   - cls.cardNumRe = readC.returnOptionsItems("testInfo", "cardNumRe")
41   - cls.loginPwd = readC.returnOptionsItems("testInfo", "loginPwd")
42   - # 登录信息获取
43   - cls.webHeaders, cls.clientHeaders, cls.userInfo = doLogin().loginUser()
44   - cls.applyUserName = cls.userInfo["data"]["user"]["realName"]
45   - cls.applyUserId = cls.userInfo["data"]["user"]["id"]
46   - cls.applyUserCode = cls.userInfo["data"]["user"]["userName"]
47   - cls.firmId = cls.userInfo["data"]["user"]["firmId"]
48   -
49   - @classmethod
50   - def tearDownClass(cls) -> None:
51   - pass
52   -
53   - def test_getAccountInfo(self):
54   - """
55   - 获取卡片信息测试
56   - :return:
57   - """
58   - # 使用未入库的卡片进行获取
59   - resGet = oMC.getAccountInfo(gatewayHost=self.gatewayHost,clientHeaders =self.clientHeaders,cardNo=999999999999)
60   - print(resGet.json())
61   - assert "10001" == resGet.json()["code"],"未入库卡片信息获取测试不通过"
62   - assert "卡账户不存在" == resGet.json()["message"],"未入库卡片信息获取测试不通过"
63   -
64   - # 使用入库未出库的卡片进行信息获取
65   - # 卡片入库
66   - faceNum = 1
67   - startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
68   - endCardNo = startCardNo + 2
69   -
70   - resCardFace = cSI.getCardFace(cardHost=self.cardHost, webHeaders=self.webHeaders)
71   - cardFace = cSI.returnFaceValue(resCardFace=resCardFace, faceNum=faceNum)
72   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startCardNo,
73   - endCardNo=endCardNo, cardFace=cardFace)
74   - resGet = oMC.getAccountInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo)
75   - print(resGet.json())
76   - assert "10001" == resGet.json()["code"], "未出库卡片信息获取测试不通过"
77   - assert "卡账户不存在" == resGet.json()["message"], "未出库卡片信息获取测试不通过"
78   -
79   - # 使用出库未开卡的卡片进行信息获取
80   - cardNos = str(startCardNo) + "," + str(endCardNo)
81   - amount = len([i for i in range(startCardNo, endCardNo + 1)])
82   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=cardNos,
83   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
84   - applyUserCode=self.applyUserCode, amount=amount)
85   - assert outCardRes.json()["code"] == "200", "出库失败"
86   - resGet = oMC.getAccountInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo)
87   - print(resGet.json())
88   - assert "10001" == resGet.json()["code"], "未出库卡片信息获取测试不通过"
89   - assert "卡账户不存在" == resGet.json()["message"], "未出库卡片信息获取测试不通过"
90   -
91   - # 使用已开卡的卡片可以正确的获取到客户信息
92   - resFirstOpen = oMC.openMasterCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
93   - cCNum=self.cCNum, cardNo=startCardNo, applyUserName=self.applyUserName)
94   - assert "200" == resFirstOpen.json()["code"], "开卡失败"
95   - assert "data" in resFirstOpen.json(), "开卡失败"
96   - resGet = oMC.getAccountInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo)
97   - # print("resGet.json()",resGet.json())
98   - assert "200" == resGet.json()["code"], "未出库卡片信息获取测试不通过"
99   - assert "data" in resGet.json(), "未出库卡片信息获取测试不通过"
100   -
101   - # 使用已挂失的卡片信息进行卡片信息获取
102   - accountId,customerId = resGet.json()["data"]["accountId"],resGet.json()["data"]["customerId"]
103   - resLossCard = cLAUL.lossCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=str(startCardNo),
104   - accountId=accountId, customerId=customerId, loginPwd=self.loginPwd)
105   - # print("resLossCard.json()",resLossCard.json())
106   - assert "200" == resLossCard.json()["code"],"已挂失的卡片获取卡片信息测试不通过"
107   - resGet = oMC.getAccountInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo)
108   - # print("resGet.json()", resGet.json())
109   - assert "2000" == resGet.json()["code"], "未出库卡片信息获取测试不通过"
110   - assert "该卡为挂失状态,不能进行此操作" == resGet.json()["message"], "未出库卡片信息获取测试不通过"
111   - # 解挂
112   - resUnLoss = cLAUL.unLostCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=str(startCardNo),
113   - accountId=accountId, customerId=customerId, loginPwd=self.loginPwd)
114   - # print("resUnLoss.json()",resUnLoss.json())
115   -
116   - # 账号冻结状态
117   -
118   - # 卡片锁定状态
119   -
120   - # 使用已退还的卡片进行卡片信息获取
121   - reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo)
122   - resGet = oMC.getAccountInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo)
123   - # print("resGet.json()", resGet.json())
124   - assert "2000" == resGet.json()["code"], "未出库卡片信息获取测试不通过"
125   - assert "该卡为退还状态,不能进行此操作" == resGet.json()["message"], "未出库卡片信息获取测试不通过"
126   -
127   - def test_checkSlaveCardNo(self):
128   - """测试副卡校验功能开卡"""
129   - # 使用未入库的副卡进行校验
130   - res = oMC.checkNewCardNo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=999999999999,cardType=20)
131   - print(res.json())
132   - assert "10000" == res.json()["code"], "使用已存在未开卡的卡片进行校验校验失败"
133   - assert "该卡未入库!" == res.json()["message"], "message信息与预期信息不匹配"
134   -
135   - # 使用未出库的卡片进行校验
136   - startSlaveCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
137   - endSlaveCardNo = startSlaveCardNo + 1
138   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startSlaveCardNo,
139   - endCardNo=endSlaveCardNo, cardType=20)
140   - res = oMC.checkNewCardNo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startSlaveCardNo,
141   - cardType=20)
142   - print(res.json())
143   - assert "20000" == res.json()["code"], "使用已存在未出库的卡片进行校验校验失败"
144   - assert "该卡状态为[未激活],不能开卡!" == res.json()["message"], "message信息与预期信息不匹配"
145   -
146   - # 使用已出库的卡片进行校验
147   - SlaveCardNos = str(startSlaveCardNo) + "," + str(endSlaveCardNo)
148   - amount = len([i for i in range(startSlaveCardNo, endSlaveCardNo + 1)])
149   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=SlaveCardNos,
150   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
151   - applyUserCode=self.applyUserCode, amount=amount)
152   - assert outCardRes.json()["code"] == "200", "出库失败"
153   - res = oMC.checkNewCardNo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startSlaveCardNo,
154   - cardType=20)
155   - print(res.json())
156   - assert "200" == res.json()["code"], "使用已出库的卡片进行校验校验失败"
157   - assert "OK" == res.json()["message"], "message信息与预期信息不匹配"
158   -
159   - # 使用已作废的卡片进行校验
160   - resCardVoid = cS.cardVoid(cardHost=self.cardHost,webHeaders=self.webHeaders,cardNo=endSlaveCardNo)
161   - assert "200"==resCardVoid.json()["code"],"卡片作废失败"
162   - res = oMC.checkNewCardNo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
163   - cardNo=endSlaveCardNo,
164   - cardType=20)
165   - assert "20000" == res.json()["code"], "使用已作废的卡片进行校验校验失败"
166   - assert "该卡状态为[作废],不能开卡!" == res.json()["message"], "message信息与预期信息不匹配"
167   -
168   -
169   - # 使用已开卡的卡片进行校验
170   - time.sleep(2)
171   - faceNum = 1
172   - startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
173   - endCardNo = startCardNo+1
174   - resCardFace = cSI.getCardFace(cardHost=self.cardHost, webHeaders=self.webHeaders)
175   - cardFace = cSI.returnFaceValue(resCardFace=resCardFace, faceNum=faceNum)
176   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startCardNo,
177   - endCardNo=endCardNo, cardFace=cardFace)
178   - print("resSavaCard.json() ->",resSavaCard.json())
179   - # 出库
180   - cardNos = str(startCardNo) + "," + str(endCardNo)
181   - print(cardNos)
182   - amount = len([i for i in range(startCardNo, endCardNo)])
183   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=cardNos,
184   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
185   - applyUserCode=self.applyUserCode, amount=amount)
186   - assert outCardRes.json()["code"] == "200", "出库失败"
187   - # 主卡开卡
188   - resFirstOpen = oMC.openMasterCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
189   - cCNum=self.cCNum, cardNo=startCardNo, applyUserName=self.applyUserName)
190   - print("resFirstOpen",resFirstOpen.json())
191   - assert "200" == resFirstOpen.json()["code"], "第一次开卡,开卡失败"
192   - assert "data" in resFirstOpen.json(), "第一次开卡,开卡失败"
193   - # 副卡开卡
194   - resOpenSlaveCard = oMC.openSlaveCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
195   - cardNo=startCardNo, slaveCardNo=startSlaveCardNo,
196   - loginPwd=self.loginPwd, applyUserName=self.applyUserName,
197   - parentLoginPwd=self.loginPwd)
198   - print("resOpenSlaveCard ---> ",resOpenSlaveCard.json())
199   - resCheckNewCardNo= oMC.checkNewCardNo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startSlaveCardNo,
200   - cardType=20)
201   - print(resCheckNewCardNo.json())
202   - assert "20000" == resCheckNewCardNo.json()["code"], "使用已开卡的卡片进行校验校验失败"
203   - assert "该卡状态为[在用],不能开卡!" == resCheckNewCardNo.json()["message"], "message信息与预期信息不匹配"
204   - # 副卡退卡
205   - reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startSlaveCardNo)
206   -
207   -
208   - # 使用已退卡的卡片进行校验
209   - resCheckNewCardNo = oMC.checkNewCardNo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
210   - cardNo=startSlaveCardNo,
211   - cardType=20)
212   - print("203 resCheckNewCardNo ",resCheckNewCardNo.json())
213   - assert "200" == resCheckNewCardNo.json()["code"], "使用已开卡的卡片进行校验校验失败"
214   - assert "OK" == resCheckNewCardNo.json()["message"], "message信息与预期信息不匹配"
215   - # 主卡退卡
216   - reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo)
217   -
218   -
219   - def test_openSlaveCard(self):
220   - """
221   - 副卡开卡测试
222   - :return:
223   - """
224   - # 主卡入库-出库-开卡
225   - faceNum = 1
226   - startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
227   - endCardNo = startCardNo + 1
228   - resCardFace = cSI.getCardFace(cardHost=self.cardHost, webHeaders=self.webHeaders)
229   - cardFace = cSI.returnFaceValue(resCardFace=resCardFace, faceNum=faceNum)
230   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startCardNo,
231   - endCardNo=endCardNo, cardFace=cardFace)
232   - print("resSavaCard.json() ->", resSavaCard.json())
233   - # 出库
234   - cardNos = str(startCardNo) + "," + str(endCardNo)
235   - print(cardNos)
236   - amount = len([i for i in range(startCardNo, endCardNo)])
237   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=cardNos,
238   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
239   - applyUserCode=self.applyUserCode, amount=amount)
240   - assert outCardRes.json()["code"] == "200", "出库失败"
241   - # 主卡开卡
242   - resFirstOpen = oMC.openMasterCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
243   - cCNum=self.cCNum, cardNo=startCardNo, applyUserName=self.applyUserName)
244   - print("resFirstOpen", resFirstOpen.json())
245   - assert "200" == resFirstOpen.json()["code"], "第一次开卡,开卡失败"
246   - assert "data" in resFirstOpen.json(), "第一次开卡,开卡失败"
247   -
248   - # 副卡入库-出库-开卡
249   - startSlaveCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
250   - endSlaveCardNo = startSlaveCardNo + 1
251   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startSlaveCardNo,
252   - endCardNo=endSlaveCardNo, cardType=20)
253   - res = oMC.checkNewCardNo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
254   - cardNo=startSlaveCardNo,
255   - cardType=20)
256   - print(res.json())
257   - assert "20000" == res.json()["code"], "使用已存在未出库的卡片进行校验校验失败"
258   - assert "该卡状态为[未激活],不能开卡!" == res.json()["message"], "message信息与预期信息不匹配"
259   - slaveCardNos = str(startSlaveCardNo) + "," + str(endSlaveCardNo)
260   - amount = len([i for i in range(startSlaveCardNo, endSlaveCardNo + 1)])
261   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=slaveCardNos,
262   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
263   - applyUserCode=self.applyUserCode, amount=amount)
264   - assert outCardRes.json()["code"] == "200", "出库失败"
265   - # 开卡
266   - costFee = oMC.getOpenCardFee(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders).json()["data"]
267   - print(costFee)
268   - resGet = oMC.getAccountInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo).json()["data"]
269   - print("resGet ---> ", resGet)
270   - customerName = resGet["customerName"]
271   - customerId = resGet["customerId"]
272   - customerCredentialType = resGet["customerCertificateType"]
273   - customerContactsPhone = resGet["customerContactsPhone"]
274   - loginPwd = self.loginPwd
275   - cardNo = startSlaveCardNo
276   - customerCertificateNumber = resGet["customerCertificateNumber"]
277   - cardType = 20
278   - customerCode = resGet["customerCode"]
279   - name = self.applyUserName
280   - parentAccountId = resGet["accountId"]
281   - parentLoginPwd = self.loginPwd
282   - holdName = customerName
283   - holdContactsPhone = customerContactsPhone
284   - resOpenSlaveCard = oMC.openSlaveCard(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
285   - customerName=customerName,
286   - customerId=customerId, customerContactsPhone=customerContactsPhone,
287   - loginPwd=loginPwd, cardNo=cardNo,
288   - customerCertificateNumber=customerCertificateNumber, cardType=cardType,
289   - costFee=costFee, customerCode=customerCode,
290   - name=name, parentAccountId=parentAccountId, parentLoginPwd=parentLoginPwd,
291   - holdName=holdName,
292   - holdContactsPhone=holdContactsPhone,
293   - customerCredentialType=customerCredentialType
294   - )
295   -
296   - # # 办理副卡方法封装
297   - # resOpenSlaveCard = oMC.openSlaveCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
298   - # cardNo=startCardNo, slaveCardNo=startSlaveCardNo,
299   - # loginPwd=self.loginPwd, applyUserName=self.applyUserName,
300   - # parentLoginPwd=self.loginPwd)
301   -
302   - print("resOpenSlaveCard.json()", resOpenSlaveCard.json())
303   - assert "200" == resOpenSlaveCard.json()["code"],"开卡测试失败"
304   - assert "success" == resOpenSlaveCard.json()["message"], "开卡测试失败"
305   - # 副卡退卡
306   - reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startSlaveCardNo)
307   - # 主卡退卡
308   - reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo)
309   -
310   - def test_openSlaveCardState(self):
311   - """
312   - 异常的副卡办理状态
313   - :return:
314   - """
315   - # 主卡入库-出库-开卡
316   - faceNum = 1
317   - startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
318   - endCardNo = startCardNo + 1
319   - resCardFace = cSI.getCardFace(cardHost=self.cardHost, webHeaders=self.webHeaders)
320   - cardFace = cSI.returnFaceValue(resCardFace=resCardFace, faceNum=faceNum)
321   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startCardNo,
322   - endCardNo=endCardNo, cardFace=cardFace)
323   - print("resSavaCard.json() ->", resSavaCard.json())
324   - # 出库
325   - cardNos = str(startCardNo) + "," + str(endCardNo)
326   - print(cardNos)
327   - amount = len([i for i in range(startCardNo, endCardNo)])
328   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=cardNos,
329   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
330   - applyUserCode=self.applyUserCode, amount=amount)
331   - assert outCardRes.json()["code"] == "200", "出库失败"
332   - # 主卡开卡
333   - resFirstOpen = oMC.openMasterCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
334   - cCNum=self.cCNum, cardNo=startCardNo, applyUserName=self.applyUserName)
335   - print("resFirstOpen", resFirstOpen.json())
336   - assert "200" == resFirstOpen.json()["code"], "第一次开卡,开卡失败"
337   - assert "data" in resFirstOpen.json(), "第一次开卡,开卡失败"
338   -
339   - # 副卡入库-出库-开卡
340   - startSlaveCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
341   - endSlaveCardNo = startSlaveCardNo + 1
342   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startSlaveCardNo,
343   - endCardNo=endSlaveCardNo, cardType=20)
344   - res = oMC.checkNewCardNo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
345   - cardNo=startSlaveCardNo,
346   - cardType=20)
347   - assert "20000" == res.json()["code"], "使用已存在未出库的卡片进行校验校验失败"
348   - assert "该卡状态为[未激活],不能开卡!" == res.json()["message"], "message信息与预期信息不匹配"
349   - slaveCardNos = str(startSlaveCardNo) + "," + str(endSlaveCardNo)
350   - amount = len([i for i in range(startSlaveCardNo, endSlaveCardNo + 1)])
351   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=slaveCardNos,
352   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
353   - applyUserCode=self.applyUserCode, amount=amount)
354   - assert outCardRes.json()["code"] == "200", "出库失败"
355   - resOpenSlaveCard = oMC.openSlaveCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
356   - cardNo=startCardNo, slaveCardNo=startSlaveCardNo,
357   - loginPwd=self.loginPwd, applyUserName=self.applyUserName,
358   - parentLoginPwd=self.loginPwd)
359   - assert "200" == resOpenSlaveCard.json()["code"], "开卡测试失败"
360   - # 以上为测试准备
361   -
362   - # 卡片不能重复开卡
363   - resOpenSlaveCard = oMC.openSlaveCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
364   - cardNo=startCardNo, slaveCardNo=startSlaveCardNo,
365   - loginPwd=self.loginPwd, applyUserName=self.applyUserName,
366   - parentLoginPwd=self.loginPwd)
367   - print("resOpenSlaveCard ",resOpenSlaveCard.json())
368   - assert "20000" == resOpenSlaveCard.json()["code"], "开卡测试失败"
369   - assert "该卡状态为[在用],不能开卡!" == resOpenSlaveCard.json()["message"], "开卡测试失败"
370   -
371   - # 副卡退还后可以重新开卡
372   - reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startSlaveCardNo)
373   - resOpenSlaveCard = oMC.openSlaveCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
374   - cardNo=startCardNo, slaveCardNo=startSlaveCardNo,
375   - loginPwd=self.loginPwd, applyUserName=self.applyUserName,
376   - parentLoginPwd=self.loginPwd)
377   - assert "200" == resOpenSlaveCard.json()["code"], "开卡测试失败"
378   - reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startSlaveCardNo)
379   -
380   - # 主卡密码错误时开卡失败
381   - resOpenSlaveCard = oMC.openSlaveCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
382   - cardNo=startCardNo, slaveCardNo=startSlaveCardNo,
383   - loginPwd=self.loginPwd, applyUserName=self.applyUserName,
384   - parentLoginPwd="909090")
385   - assert "10001" == resOpenSlaveCard.json()["code"], "开卡测试失败"
386   - assert "密码输入有误" == resOpenSlaveCard.json()["message"], "开卡测试失败"
387   -
388   - # 副卡新密码格式不正确-接口暂未校验
389   -
390   - # # 副卡退卡
391   - # reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startSlaveCardNo)
392   - # 主卡退卡
393   - reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo)
394   -
395   -
testCase/cardSystem/test_outCard.py deleted 100644 → 0
1   -#coding=utf-8
2   -
3   -# @Time : 2021/5/24 9:51
4   -# @Author : Ljq
5   -# @File : test_outCard.py
6   -# @Software: PyCharm
7   -
8   -
9   -"""
10   - 卡片出库测试用例
11   -"""
12   -
13   -import unittest
14   -import re
15   -import time
16   -import math
17   -import commons.api.cardStorageIn as cSI
18   -import commons.api.cardStorageOut as cSO
19   -from commons.scripts.readConf import readConfig
20   -from commons.api.doLogin import doLogin
21   -
22   -
23   -class test_outCard(unittest.TestCase):
24   - @classmethod
25   - def setUpClass(cls):
26   - # 获取登录信息和可用headers
27   - rC = readConfig()
28   - cls.cardHost = rC.returnOptionsItems("host", "cardHost")
29   - cls.webHeaders,cls.clientHeaders,cls.userInfo = doLogin().loginUser()
30   - cls.applyUserName = cls.userInfo["data"]["user"]["realName"]
31   - cls.applyUserId = cls.userInfo["data"]["user"]["id"]
32   - cls.applyUserCode = cls.userInfo["data"]["user"]["userName"]
33   -
34   - @classmethod
35   - def tearDownClass(cls):
36   - pass
37   -
38   - def setUp(self):
39   - time.sleep(2)
40   - # pass
41   -
42   - def tearDown(self):
43   - pass
44   -
45   - def test_openPage(self):
46   - # 直接打开出库列表
47   - listRes = cSO.getOutPage(cardHost=self.cardHost,webHeaders=self.webHeaders)
48   - print(listRes.json())
49   - assert "200" == listRes.json()["code"],"出库列表查询失败"
50   -
51   - def test_outCard_positive(self):
52   - # 先添加入库卡片
53   - faceNum = 3
54   - startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
55   - endCardNo = startCardNo + 1
56   - cardFace = cSI.returnFaceValue(resCardFace=cSI.getCardFace(cardHost=self.cardHost, webHeaders=self.webHeaders),faceNum=faceNum)
57   - resSavaCard = cSI.savaCard(cardHost=self.cardHost,webHeaders=self.webHeaders,startCardNo=startCardNo,endCardNo=endCardNo,cardFace=cardFace)
58   -
59   - # 出库 ---> 卡片类别获取
60   - cardTypeRes = cSO.getCardType(cardHost=self.cardHost,webHeaders=self.webHeaders)
61   - # 获取用户信息
62   - userInfo = cSO.getUserInfo(cardHost=self.cardHost, webHeaders=self.webHeaders, name=self.applyUserCode,keyword=self.applyUserCode)
63   - assert userInfo.json()["data"][0]["id"] == self.applyUserId, "获取到的用户信息与实际用户信息不匹配"
64   - # 出库 ---> 卡面信息获取
65   - cardFaceB = cSI.returnFaceValue(resCardFace=cSO.getCardFace(cardHost=self.cardHost,webHeaders=self.webHeaders),faceNum=faceNum)
66   - # 出库 ---> 卡片入库卡面与当前卡面对比
67   - for cardNo in range(startCardNo,endCardNo+1):
68   - cardState = cSO.checkCardForOut(cardHost=self.cardHost, webHeaders=self.webHeaders,cardFace=cardFaceB,cardNo=cardNo)
69   - assert cardState.json()["code"] == "200","卡片面校验不通过"
70   - assert cardFace == cardFaceB,"卡面信息断言失败"
71   - # 出库 ---> 卡片出库
72   - cardNos = str(startCardNo) + "," + str(endCardNo)
73   - amount = len([i for i in range(startCardNo,endCardNo+1)])
74   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost,webHeaders=self.webHeaders,cardNos=cardNos,applyUserName=self.applyUserName,applyUserId=self.applyUserId,applyUserCode=self.applyUserCode,amount=amount)
75   - assert outCardRes.json()["code"] == "200","出库失败"
76   -
77   - # 出库信息断言
78   - outCardDetail = cSO.getOutCardDetail(cardHost=self.cardHost, webHeaders=self.webHeaders)
79   - assert sorted(outCardDetail) == sorted([str(i) for i in range(startCardNo,endCardNo+1)]), "返回的出库信息与实际出库信息不一致"
80   -
81   - def test_searchUser(self):
82   - # 先添加入库卡片
83   - faceNum = 3
84   - startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
85   - endCardNo = startCardNo + 1
86   - cardFace = cSI.returnFaceValue(resCardFace=cSI.getCardFace(cardHost=self.cardHost, webHeaders=self.webHeaders),
87   - faceNum=faceNum)
88   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startCardNo,
89   - endCardNo=endCardNo, cardFace=cardFace)
90   -
91   - # 出库 ---> 卡片类别获取
92   - cardTypeRes = cSO.getCardType(cardHost=self.cardHost, webHeaders=self.webHeaders)
93   - # 获取用户信息
94   - userInfo = cSO.getUserInfo(cardHost=self.cardHost, webHeaders=self.webHeaders, name=self.applyUserCode,
95   - keyword=self.applyUserCode)
96   - assert userInfo.json()["data"][0]["id"] == self.applyUserId, "获取到的用户信息与实际用户信息不匹配"
97   - # 出库 ---> 卡面信息获取
98   - cardFaceB = cSI.returnFaceValue(resCardFace=cSO.getCardFace(cardHost=self.cardHost, webHeaders=self.webHeaders),
99   - faceNum=faceNum)
100   - # 出库 ---> 卡片入库卡面与当前卡面对比
101   - for cardNo in range(startCardNo, endCardNo + 1):
102   - cardState = cSO.checkCardForOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardFace=cardFaceB,
103   - cardNo=cardNo)
104   - assert cardState.json()["code"] == "200", "卡片面校验不通过"
105   - assert cardFace == cardFaceB, "卡面信息断言失败"
106   - # 出库 ---> 卡片出库
107   - cardNos = str(startCardNo) + "," + str(endCardNo)
108   - amount = len([i for i in range(startCardNo, endCardNo + 1)])
109   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=cardNos,
110   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
111   - applyUserCode=self.applyUserCode, amount=amount)
112   - assert outCardRes.json()["code"] == "200", "出库失败"
113   -
114   - # 根据领取人获取最新的出库记录
115   - listRes = cSO.getOutPage(cardHost=self.cardHost, webHeaders=self.webHeaders,applyUserName=self.applyUserName,
116   - applyUserId=self.applyUserId)
117   - assert self.applyUserName == list(set([i["applyUserName"] for i in listRes.json()["rows"]]))[0],"领取人查询成功"
118   -
119   - def test_searchCard(self):
120   - # 先添加入库卡片
121   - faceNum = 3
122   - startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
123   - endCardNo = startCardNo + 1
124   - cardFace = cSI.returnFaceValue(resCardFace=cSI.getCardFace(cardHost=self.cardHost, webHeaders=self.webHeaders),
125   - faceNum=faceNum)
126   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startCardNo,
127   - endCardNo=endCardNo, cardFace=cardFace)
128   -
129   - # 出库 ---> 卡片类别获取
130   - cardTypeRes = cSO.getCardType(cardHost=self.cardHost, webHeaders=self.webHeaders)
131   - # 获取用户信息
132   - userInfo = cSO.getUserInfo(cardHost=self.cardHost, webHeaders=self.webHeaders, name=self.applyUserCode,
133   - keyword=self.applyUserCode)
134   - assert userInfo.json()["data"][0]["id"] == self.applyUserId, "获取到的用户信息与实际用户信息不匹配"
135   - # 出库 ---> 卡面信息获取
136   - cardFaceB = cSI.returnFaceValue(resCardFace=cSO.getCardFace(cardHost=self.cardHost, webHeaders=self.webHeaders),
137   - faceNum=faceNum)
138   - # 出库 ---> 卡片入库卡面与当前卡面对比
139   - for cardNo in range(startCardNo, endCardNo + 1):
140   - cardState = cSO.checkCardForOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardFace=cardFaceB,
141   - cardNo=cardNo)
142   - assert cardState.json()["code"] == "200", "卡片面校验不通过"
143   - assert cardFace == cardFaceB, "卡面信息断言失败"
144   - # 出库 ---> 卡片出库
145   - cardNos = str(startCardNo) + "," + str(endCardNo)
146   - amount = len([i for i in range(startCardNo, endCardNo + 1)])
147   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=cardNos,
148   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
149   - applyUserCode=self.applyUserCode, amount=amount)
150   - assert outCardRes.json()["code"] == "200", "出库失败"
151   -
152   - # 根据领取人获取最新的出库记录
153   - listRes = cSO.getOutPage(cardHost=self.cardHost, webHeaders=self.webHeaders,cardNo=startCardNo)
154   - assert 1 == len([i for i in listRes.json()["rows"]]),"查询结果不唯一,查询失败"
155   - firstId = listRes.json()["rows"][0]["id"]
156   - resDetail = cSO.getOutListDetail(cardHost=self.cardHost, webHeaders=self.webHeaders, id=firstId)
157   - outCardDetail = re.findall("<ul><li>(.*?)</li></ul>", resDetail.text)
158   - assert str(startCardNo) in outCardDetail,"查询失败"
159   -
160   - def test_searchDate(self):
161   - # 先添加入库卡片
162   - faceNum = 3
163   - startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
164   - endCardNo = startCardNo + 1
165   - cardFace = cSI.returnFaceValue(resCardFace=cSI.getCardFace(cardHost=self.cardHost, webHeaders=self.webHeaders),
166   - faceNum=faceNum)
167   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startCardNo,
168   - endCardNo=endCardNo, cardFace=cardFace)
169   -
170   - # 出库 ---> 卡片类别获取
171   - cardTypeRes = cSO.getCardType(cardHost=self.cardHost, webHeaders=self.webHeaders)
172   - # 获取用户信息
173   - userInfo = cSO.getUserInfo(cardHost=self.cardHost, webHeaders=self.webHeaders, name=self.applyUserCode,
174   - keyword=self.applyUserCode)
175   - assert userInfo.json()["data"][0]["id"] == self.applyUserId, "获取到的用户信息与实际用户信息不匹配"
176   - # 出库 ---> 卡面信息获取
177   - cardFaceB = cSI.returnFaceValue(resCardFace=cSO.getCardFace(cardHost=self.cardHost, webHeaders=self.webHeaders),
178   - faceNum=faceNum)
179   - # 出库 ---> 卡片入库卡面与当前卡面对比
180   - for cardNo in range(startCardNo, endCardNo + 1):
181   - cardState = cSO.checkCardForOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardFace=cardFaceB,
182   - cardNo=cardNo)
183   - assert cardState.json()["code"] == "200", "卡片面校验不通过"
184   - assert cardFace == cardFaceB, "卡面信息断言失败"
185   - # 出库 ---> 卡片出库
186   - cardNos = str(startCardNo) + "," + str(endCardNo)
187   - amount = len([i for i in range(startCardNo, endCardNo + 1)])
188   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=cardNos,
189   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
190   - applyUserCode=self.applyUserCode, amount=amount)
191   - assert outCardRes.json()["code"] == "200", "出库失败"
192   -
193   - # 根据领取人获取最新的出库记录
194   - startDate = str(time.strftime("%Y-%m-%d 00:00:00", time.localtime()))
195   - endDate = str(time.strftime("%Y-%m-%d 23:59:59", time.localtime()))
196   - listRes = cSO.getOutPage(cardHost=self.cardHost, webHeaders=self.webHeaders,startDate=startDate,endDate=endDate)
197   - pageNum = math.ceil(listRes.json()["total"]/10)
198   - listRes = cSO.getOutPage(cardHost=self.cardHost, webHeaders=self.webHeaders, startDate=startDate,
199   - endDate=endDate,page=pageNum)
200   - dateList = [i["applyTime"] for i in listRes.json()["rows"]]
201   - assert [] == [i for i in dateList if i < startDate or i > endDate], "查询结果错误,查询出非当天的入库信息"
202   -
203   - def test_searchAllOption(self):
204   - # 先添加入库卡片
205   - faceNum = 3
206   - startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
207   - endCardNo = startCardNo + 1
208   - cardFace = cSI.returnFaceValue(resCardFace=cSI.getCardFace(cardHost=self.cardHost, webHeaders=self.webHeaders),
209   - faceNum=faceNum)
210   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startCardNo,
211   - endCardNo=endCardNo, cardFace=cardFace)
212   -
213   - # 出库 ---> 卡片类别获取
214   - cardTypeRes = cSO.getCardType(cardHost=self.cardHost, webHeaders=self.webHeaders)
215   - # 获取用户信息
216   - userInfo = cSO.getUserInfo(cardHost=self.cardHost, webHeaders=self.webHeaders, name=self.applyUserCode,
217   - keyword=self.applyUserCode)
218   - assert userInfo.json()["data"][0]["id"] == self.applyUserId, "获取到的用户信息与实际用户信息不匹配"
219   - # 出库 ---> 卡面信息获取
220   - cardFaceB = cSI.returnFaceValue(resCardFace=cSO.getCardFace(cardHost=self.cardHost, webHeaders=self.webHeaders),
221   - faceNum=faceNum)
222   - # 出库 ---> 卡片入库卡面与当前卡面对比
223   - for cardNo in range(startCardNo, endCardNo + 1):
224   - cardState = cSO.checkCardForOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardFace=cardFaceB,
225   - cardNo=cardNo)
226   - assert cardState.json()["code"] == "200", "卡片面校验不通过"
227   - assert cardFace == cardFaceB, "卡面信息断言失败"
228   - # 出库 ---> 卡片出库
229   - cardNos = str(startCardNo) + "," + str(endCardNo)
230   - amount = len([i for i in range(startCardNo, endCardNo + 1)])
231   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=cardNos,
232   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
233   - applyUserCode=self.applyUserCode, amount=amount)
234   - assert outCardRes.json()["code"] == "200", "出库失败"
235   -
236   - # 根据领取人获取最新的出库记录
237   - startDate = str(time.strftime("%Y-%m-%d 00:00:00", time.localtime()))
238   - endDate = str(time.strftime("%Y-%m-%d 23:59:59", time.localtime()))
239   - # 根据领取人获取最新的出库记录
240   - listRes = cSO.getOutPage(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNo=startCardNo,startDate=startDate,endDate=endDate,applyUserName=self.applyUserName,
241   - applyUserId=self.applyUserId)
242   - assert 1 == len([i for i in listRes.json()["rows"]]), "查询结果不唯一,查询失败"
243   - firstId = listRes.json()["rows"][0]["id"]
244   - resDetail = cSO.getOutListDetail(cardHost=self.cardHost, webHeaders=self.webHeaders, id=firstId)
245   - outCardDetail = re.findall("<ul><li>(.*?)</li></ul>", resDetail.text)
246   - assert str(startCardNo) in outCardDetail, "查询失败"
247   -
248   - def test_checkCardState(self):
249   - # 先添加入库卡片
250   - faceNum = 3
251   - startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
252   - endCardNo = startCardNo + 1
253   - cardFace = cSI.returnFaceValue(resCardFace=cSI.getCardFace(cardHost=self.cardHost, webHeaders=self.webHeaders),
254   - faceNum=faceNum)
255   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startCardNo,
256   - endCardNo=endCardNo, cardFace=cardFace)
257   -
258   - # 出库 ---> 卡片类别获取
259   - cardTypeRes = cSO.getCardType(cardHost=self.cardHost, webHeaders=self.webHeaders)
260   - # 获取用户信息
261   - userInfo = cSO.getUserInfo(cardHost=self.cardHost, webHeaders=self.webHeaders, name=self.applyUserCode,
262   - keyword=self.applyUserCode)
263   - assert userInfo.json()["data"][0]["id"] == self.applyUserId, "获取到的用户信息与实际用户信息不匹配"
264   - # 出库 ---> 卡面信息获取
265   - cardFaceB = cSI.returnFaceValue(resCardFace=cSO.getCardFace(cardHost=self.cardHost, webHeaders=self.webHeaders),
266   - faceNum=faceNum)
267   - # 出库 ---> 卡片入库卡面与当前卡面对比
268   - for cardNo in range(startCardNo, endCardNo + 1):
269   - cardState = cSO.checkCardForOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardFace=cardFaceB,
270   - cardNo=cardNo)
271   - assert cardState.json()["code"] == "200", "卡片面校验不通过"
272   - assert cardFace == cardFaceB, "卡面信息断言失败"
273   - # 出库 ---> 卡片出库
274   - cardNos = str(startCardNo) + "," + str(endCardNo)
275   - amount = len([i for i in range(startCardNo, endCardNo + 1)])
276   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=cardNos,
277   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
278   - applyUserCode=self.applyUserCode, amount=amount)
279   - assert outCardRes.json()["code"] == "200", "出库失败"
280   -
281   - # 已出库的卡在出库页面进行状态校验
282   - for cardNo in range(startCardNo, endCardNo + 1):
283   - cardState = cSO.checkCardForOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardFace=cardFaceB,
284   - cardNo=cardNo)
285   - assert cardState.json()["message"] == "该卡状态为[激活],不能进行此操作!", "提示信息错误"
286   - assert cardState.json()["code"] == "5000", "出库失败"
287   -
288   - # 未出库的卡校验
289   - cardState = cSO.checkCardForOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardFace=cardFaceB,
290   - cardNo=startCardNo+2)
291   - assert cardState.json()["message"] == "该卡未入库!", "提示信息错误"
292   - assert cardState.json()["code"] == "10000", "未出库的卡片状态校验失败"
293   -
294   - # 已开卡的状态校验,暂缺
295   -
296   -
testCase/cardSystem/test_pwdModify.py deleted 100644 → 0
1   -#coding=utf-8
2   -
3   -# @Time : 2021/6/11 14:35
4   -# @Author : Ljq
5   -# @File : test_pwdModify.py
6   -# @Software: PyCharm
7   -
8   -
9   -"""
10   -
11   -"""
12   -
13   -import unittest
14   -import random
15   -import time
16   -import commons.api.cardStorageIn as cSI
17   -import commons.api.returnCard as reC
18   -import commons.api.cardStorageOut as cSO
19   -import commons.api.openCard as oMC
20   -import commons.api.operatePwd as operatePwd
21   -from commons.scripts.readConf import readConfig
22   -from commons.api.doLogin import doLogin
23   -
24   -class test_pwdModify(unittest.TestCase):
25   - def setUp(self) -> None:
26   - pass
27   -
28   - def tearDown(self) -> None:
29   - pass
30   -
31   - @classmethod
32   - def setUpClass(cls) -> None:
33   - # 配置信息获取
34   - readC = readConfig()
35   - cls.cardHost = readC.returnOptionsItems("host", "cardHost")
36   - cls.gatewayHost = readC.returnOptionsItems("host", "gatewayHost")
37   - cls.cCNum = readC.returnOptionsItems("testInfo","cCNum")
38   - cls.cCNumB = readC.returnOptionsItems("testInfo", "cCNumB")
39   - cls.cardNum = readC.returnOptionsItems("testInfo", "cardNum")
40   - cls.cardNumRe = readC.returnOptionsItems("testInfo", "cardNumRe")
41   - cls.loginPwd = readC.returnOptionsItems("testInfo", "loginPwd")
42   - # 登录信息获取
43   - cls.webHeaders, cls.clientHeaders, cls.userInfo = doLogin().loginUser()
44   - cls.applyUserName = cls.userInfo["data"]["user"]["realName"]
45   - cls.applyUserId = cls.userInfo["data"]["user"]["id"]
46   - cls.applyUserCode = cls.userInfo["data"]["user"]["userName"]
47   - cls.firmId = cls.userInfo["data"]["user"]["firmId"]
48   -
49   - @classmethod
50   - def tearDownClass(cls) -> None:
51   - pass
52   -
53   - def producePwd(self):
54   - pwd = "".join(random.sample("0123456789", 6))
55   - return pwd
56   -
57   - def test_pwdModify(self):
58   - """修改密码正向流程测试"""
59   - # 主卡入库-出库-开卡
60   - faceNum = 1
61   - startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
62   - endCardNo = startCardNo + 2
63   - resCardFace = cSI.getCardFace(cardHost=self.cardHost, webHeaders=self.webHeaders)
64   - cardFace = cSI.returnFaceValue(resCardFace=resCardFace, faceNum=faceNum)
65   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startCardNo,
66   - endCardNo=endCardNo, cardFace=cardFace)
67   - print("resSavaCard.json() ->", resSavaCard.json())
68   - cardNos = str(startCardNo) + "," + str(endCardNo)
69   - print(cardNos)
70   - amount = 2
71   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=cardNos,
72   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
73   - applyUserCode=self.applyUserCode, amount=amount)
74   - assert outCardRes.json()["code"] == "200", "出库失败"
75   - resFirstOpen = oMC.openMasterCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
76   - cCNum=self.cCNum, cardNo=startCardNo, applyUserName=self.applyUserName)
77   - print("resFirstOpen", resFirstOpen.json())
78   - assert "200" == resFirstOpen.json()["code"], "第一次开卡,开卡失败"
79   - assert "data" in resFirstOpen.json(), "第一次开卡,开卡失败"
80   - # 副卡入库-出库-开卡
81   - startSlaveCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
82   - endSlaveCardNo = startSlaveCardNo + 2
83   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startSlaveCardNo,
84   - endCardNo=endSlaveCardNo, cardType=20)
85   - res = oMC.checkNewCardNo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
86   - cardNo=startSlaveCardNo,
87   - cardType=20)
88   - assert "20000" == res.json()["code"], "使用已存在未出库的卡片进行校验校验失败"
89   - assert "该卡状态为[未激活],不能开卡!" == res.json()["message"], "message信息与预期信息不匹配"
90   - slaveCardNos = str(startSlaveCardNo) + "," + str(endSlaveCardNo)
91   - amount = 2
92   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=slaveCardNos,
93   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
94   - applyUserCode=self.applyUserCode, amount=amount)
95   - assert outCardRes.json()["code"] == "200", "出库失败"
96   - resOpenSlaveCard = oMC.openSlaveCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
97   - cardNo=startCardNo, slaveCardNo=startSlaveCardNo,
98   - loginPwd=self.loginPwd, applyUserName=self.applyUserName,
99   - parentLoginPwd=self.loginPwd)
100   - assert "200" == resOpenSlaveCard.json()["code"], "开卡测试失败"
101   - # 开卡结束-获取卡片客户信息
102   - resSimpleInfo = operatePwd.getSimpleInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
103   - cardNo=startCardNo)
104   - customerId,accountId = resSimpleInfo.json()["data"]["accountInfo"]["customerId"],resSimpleInfo.json()["data"]["accountInfo"]["accountId"]
105   - resSimpleInfo = operatePwd.getSimpleInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
106   - cardNo=startSlaveCardNo)
107   - customerIdSlaveCard, accountIdSlaveCard = resSimpleInfo.json()["data"]["accountInfo"]["customerId"], \
108   - resSimpleInfo.json()["data"]["accountInfo"]["accountId"]
109   - # 以上为测试数据准备
110   -
111   - """开始测试"""
112   -
113   - # 主卡正常修改密码
114   - newPwd = self.producePwd()
115   - print("newPwd",newPwd)
116   - resRLP = operatePwd.modifyLoginPwd(gatewayHost=self.gatewayHost,clientHeaders=self.clientHeaders,oldLoginPwd=self.loginPwd,
117   - loginPwd=newPwd,secondLoginPwd=newPwd,cardNo=startCardNo,accountId=accountId,customerId=customerId)
118   - # print(resRLP.json())
119   - assert "200" == resRLP.json()["code"],"主卡正常修改密码测试不通过"
120   - assert "OK" == resRLP.json()["message"], "主卡正常修改密码测试不通过"
121   -
122   - # 副卡正常修改密码
123   - newPwdSlave = self.producePwd()
124   - # print("newPwdSlave",newPwdSlave)
125   - resRLP = operatePwd.modifyLoginPwd(gatewayHost=self.gatewayHost,clientHeaders=self.clientHeaders,oldLoginPwd=self.loginPwd,loginPwd=newPwdSlave,
126   - secondLoginPwd=newPwdSlave,cardNo=startSlaveCardNo,accountId=accountIdSlaveCard,customerId=customerIdSlaveCard)
127   - print(resRLP.json())
128   - assert "200" == resRLP.json()["code"],"副卡正常修改密码测试不通过"
129   - assert "OK" == resRLP.json()["message"], "副卡正常修改密码测试不通过"
130   -
131   - """测试完成"""
132   -
133   - # 副卡退卡
134   - resSlave = reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startSlaveCardNo,loginPwd=newPwdSlave)
135   - assert "200" == resSlave.json()["code"],"副卡使用新密码退卡成功,密码修改成功"
136   - assert "OK" == resSlave.json()["message"], "副卡使用新密码退卡成功,密码修改成功"
137   - # 主卡退卡
138   - res = reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo,loginPwd=newPwd)
139   - assert "200" == res.json()["code"],"主卡使用新密码退卡成功,密码修改成功"
140   - assert "OK" == res.json()["message"], "主卡使用新密码退卡成功,密码修改成功"
141   -
142   - def test_pwdModifyError(self):
143   - """修改密码异常流程"""
144   - # 主卡入库-出库-开卡
145   - faceNum = 1
146   - startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
147   - endCardNo = startCardNo + 2
148   - resCardFace = cSI.getCardFace(cardHost=self.cardHost, webHeaders=self.webHeaders)
149   - cardFace = cSI.returnFaceValue(resCardFace=resCardFace, faceNum=faceNum)
150   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startCardNo,
151   - endCardNo=endCardNo, cardFace=cardFace)
152   - print("resSavaCard.json() ->", resSavaCard.json())
153   - cardNos = str(startCardNo) + "," + str(endCardNo)
154   - print(cardNos)
155   - amount = 2
156   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=cardNos,
157   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
158   - applyUserCode=self.applyUserCode, amount=amount)
159   - assert outCardRes.json()["code"] == "200", "出库失败"
160   - resFirstOpen = oMC.openMasterCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
161   - cCNum=self.cCNum, cardNo=startCardNo, applyUserName=self.applyUserName)
162   - print("resFirstOpen", resFirstOpen.json())
163   - assert "200" == resFirstOpen.json()["code"], "第一次开卡,开卡失败"
164   - assert "data" in resFirstOpen.json(), "第一次开卡,开卡失败"
165   - # 副卡入库-出库-开卡
166   - startSlaveCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
167   - endSlaveCardNo = startSlaveCardNo + 2
168   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startSlaveCardNo,
169   - endCardNo=endSlaveCardNo, cardType=20)
170   - res = oMC.checkNewCardNo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
171   - cardNo=startSlaveCardNo,
172   - cardType=20)
173   - assert "20000" == res.json()["code"], "使用已存在未出库的卡片进行校验校验失败"
174   - assert "该卡状态为[未激活],不能开卡!" == res.json()["message"], "message信息与预期信息不匹配"
175   - slaveCardNos = str(startSlaveCardNo) + "," + str(endSlaveCardNo)
176   - amount = 2
177   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=slaveCardNos,
178   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
179   - applyUserCode=self.applyUserCode, amount=amount)
180   - assert outCardRes.json()["code"] == "200", "出库失败"
181   - resOpenSlaveCard = oMC.openSlaveCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
182   - cardNo=startCardNo, slaveCardNo=startSlaveCardNo,
183   - loginPwd=self.loginPwd, applyUserName=self.applyUserName,
184   - parentLoginPwd=self.loginPwd)
185   - assert "200" == resOpenSlaveCard.json()["code"], "开卡测试失败"
186   - # 开卡结束-获取卡片客户信息
187   - resSimpleInfo = operatePwd.getSimpleInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
188   - cardNo=startCardNo)
189   - customerId,accountId = resSimpleInfo.json()["data"]["accountInfo"]["customerId"],resSimpleInfo.json()["data"]["accountInfo"]["accountId"]
190   - resSimpleInfo = operatePwd.getSimpleInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
191   - cardNo=startSlaveCardNo)
192   - customerIdSlaveCard, accountIdSlaveCard = resSimpleInfo.json()["data"]["accountInfo"]["customerId"], \
193   - resSimpleInfo.json()["data"]["accountInfo"]["accountId"]
194   - # 以上为测试数据准备
195   -
196   - """开始测试"""
197   -
198   - # 副卡原密码错误修改失败
199   - newPwdSlave = self.producePwd()
200   - resRLP = operatePwd.modifyLoginPwd(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, oldLoginPwd="909090",
201   - loginPwd=newPwdSlave,
202   - secondLoginPwd=newPwdSlave, cardNo=startSlaveCardNo, accountId=accountIdSlaveCard,
203   - customerId=customerIdSlaveCard)
204   - assert "10001" == resRLP.json()["code"], "副卡原密码错误修改失败测试不通过"
205   - assert "密码输入有误" == resRLP.json()["message"], "副卡原密码错误修改失败测试不通过"
206   - resSlave = reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
207   - cardNo=startSlaveCardNo, loginPwd=newPwdSlave)
208   - assert "10001" == resSlave.json()["code"], "修改密码失败后不能使用新密码退卡,测试不通过"
209   - # 主卡原密码错误修改失败
210   - newPwd = self.producePwd()
211   - resRLP = operatePwd.modifyLoginPwd(gatewayHost=self.gatewayHost,clientHeaders=self.clientHeaders,oldLoginPwd="909090",
212   - loginPwd=newPwd,secondLoginPwd=newPwd,cardNo=startCardNo,accountId=accountId,customerId=customerId)
213   - assert "10001" == resRLP.json()["code"],"主卡原密码错误修改失败测试不通过"
214   - assert "密码输入有误" == resRLP.json()["message"], "主卡原密码错误修改失败测试不通过"
215   - res = reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo,
216   - loginPwd=newPwd)
217   - assert "10001" == res.json()["code"], "修改密码失败后不能使用新密码退卡,测试不通过"
218   -
219   - # 两次输入的新密码不一致时修改密码失败
220   - newPwdSlave = self.producePwd()
221   - resRLP = operatePwd.modifyLoginPwd(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, oldLoginPwd=self.loginPwd,
222   - loginPwd="909090",secondLoginPwd=newPwdSlave, cardNo=startSlaveCardNo,
223   - accountId=accountIdSlaveCard, customerId=customerIdSlaveCard)
224   - print(resRLP.json())
225   - assert "2000" == resRLP.json()["code"], "副卡两次输入的新密码不一致时修改密码失败测试不通过"
226   - assert "两次输入密码不匹配" == resRLP.json()["message"], "副卡两次输入的新密码不一致时修改密码失败测试不通过"
227   - resSlave = reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
228   - cardNo=startSlaveCardNo, loginPwd=newPwdSlave)
229   - assert "10001" == resSlave.json()["code"], "修改密码失败后不能使用新密码退卡,测试不通过"
230   - # 主卡原密码错误修改失败
231   - newPwd = self.producePwd()
232   - resRLP = operatePwd.modifyLoginPwd(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, oldLoginPwd=self.loginPwd,
233   - loginPwd="909090", secondLoginPwd=newPwd, cardNo=startCardNo, accountId=accountId,
234   - customerId=customerId)
235   - print(resRLP.json())
236   - assert "2000" == resRLP.json()["code"], "主卡两次输入的新密码不一致时修改密码失败测试不通过"
237   - assert "两次输入密码不匹配" == resRLP.json()["message"], "主卡两次输入的新密码不一致时修改密码失败测试不通过"
238   - res = reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo,
239   - loginPwd=newPwd)
240   - assert "10001" == res.json()["code"], "修改密码失败后不能使用新密码退卡,测试不通过"
241   -
242   - # 第一个密码输入长度不满足六位时修改失败
243   - newPwdSlave = self.producePwd()
244   - resRLP = operatePwd.modifyLoginPwd(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, oldLoginPwd=self.loginPwd,
245   - loginPwd="90909",secondLoginPwd=newPwdSlave, cardNo=startSlaveCardNo,
246   - accountId=accountIdSlaveCard, customerId=customerIdSlaveCard)
247   - print(resRLP.json())
248   - assert "1000" == resRLP.json()["code"], "副卡第一个密码输入长度不满足六位时修改失败测试不通过"
249   - assert "密码必须6位" == resRLP.json()["message"], "副卡第一个密码输入长度不满足六位时修改失败测试不通过"
250   - resSlave = reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
251   - cardNo=startSlaveCardNo, loginPwd=newPwdSlave)
252   - assert "10001" == resSlave.json()["code"], "修改密码失败后不能使用新密码退卡,测试不通过"
253   - # 主卡原密码错误修改失败
254   - newPwd = self.producePwd()
255   - resRLP = operatePwd.modifyLoginPwd(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, oldLoginPwd=self.loginPwd,
256   - loginPwd="90909", secondLoginPwd=newPwd, cardNo=startCardNo, accountId=accountId,
257   - customerId=customerId)
258   - print(resRLP.json())
259   - assert "1000" == resRLP.json()["code"], "主卡第一个密码输入长度不满足六位时修改失败测试不通过"
260   - assert "密码必须6位" == resRLP.json()["message"], "主卡第一个密码输入长度不满足六位时修改失败测试不通过"
261   - res = reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo,
262   - loginPwd=newPwd)
263   - assert "10001" == res.json()["code"], "修改密码失败后不能使用新密码退卡,测试不通过"
264   -
265   - # 第二个密码输入长度不满足六位时修改失败
266   - newPwdSlave = self.producePwd()
267   - resRLP = operatePwd.modifyLoginPwd(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
268   - oldLoginPwd=self.loginPwd,
269   - loginPwd=newPwdSlave, secondLoginPwd="90909", cardNo=startSlaveCardNo,
270   - accountId=accountIdSlaveCard, customerId=customerIdSlaveCard)
271   - print(resRLP.json())
272   - assert "1000" == resRLP.json()["code"], "副卡第二个密码输入长度不满足六位时修改失败测试不通过"
273   - assert "确认密码密码必须6位" == resRLP.json()["message"], "副卡第二个密码输入长度不满足六位时修改失败测试不通过"
274   - resSlave = reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
275   - cardNo=startSlaveCardNo, loginPwd=newPwdSlave)
276   - assert "10001" == resSlave.json()["code"], "修改密码失败后不能使用新密码退卡,测试不通过"
277   - # 主卡原密码错误修改失败
278   - newPwd = self.producePwd()
279   - resRLP = operatePwd.modifyLoginPwd(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
280   - oldLoginPwd=self.loginPwd,
281   - loginPwd=newPwd, secondLoginPwd="90909", cardNo=startCardNo, accountId=accountId,
282   - customerId=customerId)
283   - print(resRLP.json())
284   - assert "1000" == resRLP.json()["code"], "主卡第二个密码输入长度不满足六位时修改失败测试不通过"
285   - assert "确认密码密码必须6位" == resRLP.json()["message"], "主卡第二个密码输入长度不满足六位时修改失败测试不通过"
286   - res = reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo,
287   - loginPwd=newPwd)
288   - assert "10001" == res.json()["code"], "修改密码失败后不能使用新密码退卡,测试不通过"
289   -
290   - """测试完成"""
291   -
292   - # # 副卡退卡
293   - reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startSlaveCardNo)
294   - reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo)
295 0 \ No newline at end of file
testCase/cardSystem/test_pwdReset.py deleted 100644 → 0
1   -#coding=utf-8
2   -
3   -# @Time : 2021/6/11 14:36
4   -# @Author : Ljq
5   -# @File : test_pwdReset.py
6   -# @Software: PyCharm
7   -
8   -
9   -"""
10   - 重置密码功能接口测试
11   -"""
12   -
13   -
14   -import unittest
15   -import random
16   -import time
17   -import commons.api.cardStorageIn as cSI
18   -import commons.api.returnCard as reC
19   -import commons.api.cardStorageOut as cSO
20   -import commons.api.openCard as oMC
21   -import commons.api.operatePwd as oP
22   -from commons.scripts.readConf import readConfig
23   -from commons.api.doLogin import doLogin
24   -
25   -class test_pwdModify(unittest.TestCase):
26   - def setUp(self) -> None:
27   - pass
28   -
29   - def tearDown(self) -> None:
30   - pass
31   -
32   - @classmethod
33   - def setUpClass(cls) -> None:
34   - # 配置信息获取
35   - readC = readConfig()
36   - cls.cardHost = readC.returnOptionsItems("host", "cardHost")
37   - cls.gatewayHost = readC.returnOptionsItems("host", "gatewayHost")
38   - cls.cCNum = readC.returnOptionsItems("testInfo","cCNum")
39   - cls.cCNumB = readC.returnOptionsItems("testInfo", "cCNumB")
40   - cls.cardNum = readC.returnOptionsItems("testInfo", "cardNum")
41   - cls.cardNumRe = readC.returnOptionsItems("testInfo", "cardNumRe")
42   - cls.loginPwd = readC.returnOptionsItems("testInfo", "loginPwd")
43   - # 登录信息获取
44   - cls.webHeaders, cls.clientHeaders, cls.userInfo = doLogin().loginUser()
45   - cls.applyUserName = cls.userInfo["data"]["user"]["realName"]
46   - cls.applyUserId = cls.userInfo["data"]["user"]["id"]
47   - cls.applyUserCode = cls.userInfo["data"]["user"]["userName"]
48   - cls.firmId = cls.userInfo["data"]["user"]["firmId"]
49   -
50   - @classmethod
51   - def tearDownClass(cls) -> None:
52   - pass
53   -
54   - def producePwd(self):
55   - pwd = "".join(random.sample("0123456789", 6))
56   - return pwd
57   -
58   - def test_pwdModify(self):
59   - """修改密码正向流程测试"""
60   - # 主卡入库-出库-开卡
61   - faceNum = 1
62   - startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
63   - endCardNo = startCardNo + 2
64   - resCardFace = cSI.getCardFace(cardHost=self.cardHost, webHeaders=self.webHeaders)
65   - cardFace = cSI.returnFaceValue(resCardFace=resCardFace, faceNum=faceNum)
66   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startCardNo,
67   - endCardNo=endCardNo, cardFace=cardFace)
68   - print("resSavaCard.json() ->", resSavaCard.json())
69   - cardNos = str(startCardNo) + "," + str(endCardNo)
70   - print(cardNos)
71   - amount = 2
72   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=cardNos,
73   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
74   - applyUserCode=self.applyUserCode, amount=amount)
75   - assert outCardRes.json()["code"] == "200", "出库失败"
76   - resFirstOpen = oMC.openMasterCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
77   - cCNum=self.cCNum, cardNo=startCardNo, applyUserName=self.applyUserName)
78   - print("resFirstOpen", resFirstOpen.json())
79   - assert "200" == resFirstOpen.json()["code"], "第一次开卡,开卡失败"
80   - assert "data" in resFirstOpen.json(), "第一次开卡,开卡失败"
81   - # 副卡入库-出库-开卡
82   - startSlaveCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
83   - endSlaveCardNo = startSlaveCardNo + 2
84   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startSlaveCardNo,
85   - endCardNo=endSlaveCardNo, cardType=20)
86   - res = oMC.checkNewCardNo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
87   - cardNo=startSlaveCardNo,
88   - cardType=20)
89   - assert "20000" == res.json()["code"], "使用已存在未出库的卡片进行校验校验失败"
90   - assert "该卡状态为[未激活],不能开卡!" == res.json()["message"], "message信息与预期信息不匹配"
91   - slaveCardNos = str(startSlaveCardNo) + "," + str(endSlaveCardNo)
92   - amount = 2
93   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=slaveCardNos,
94   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
95   - applyUserCode=self.applyUserCode, amount=amount)
96   - assert outCardRes.json()["code"] == "200", "出库失败"
97   - resOpenSlaveCard = oMC.openSlaveCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
98   - cardNo=startCardNo, slaveCardNo=startSlaveCardNo,
99   - loginPwd=self.loginPwd, applyUserName=self.applyUserName,
100   - parentLoginPwd=self.loginPwd)
101   - assert "200" == resOpenSlaveCard.json()["code"], "开卡测试失败"
102   - # 开卡结束-获取卡片客户信息
103   - resSimpleInfo = oP.getSimpleInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
104   - cardNo=startCardNo)
105   - customerId,accountId = resSimpleInfo.json()["data"]["accountInfo"]["customerId"],resSimpleInfo.json()["data"]["accountInfo"]["accountId"]
106   - resSimpleInfo = oP.getSimpleInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
107   - cardNo=startSlaveCardNo)
108   - customerIdSlaveCard, accountIdSlaveCard = resSimpleInfo.json()["data"]["accountInfo"]["customerId"], \
109   - resSimpleInfo.json()["data"]["accountInfo"]["accountId"]
110   - # 以上为测试数据准备
111   -
112   - """开始测试"""
113   -
114   - # 主卡正常重置密码
115   - newPwd = self.producePwd()
116   - print("newPwd",newPwd)
117   - resRLP = oP.resetLoginPwd(gatewayHost=self.gatewayHost,clientHeaders=self.clientHeaders,loginPwd=newPwd,
118   - secondLoginPwd=newPwd,cardNo=startCardNo,accountId=accountId,customerId=customerId)
119   - assert "200" == resRLP.json()["code"],"主卡正常重置密码测试不通过"
120   - assert "OK" == resRLP.json()["message"], "主卡正常重置密码测试不通过"
121   -
122   - # 副卡正常重置密码
123   - newPwdSlave = self.producePwd()
124   - print("newPwdSlave",newPwdSlave)
125   - resRLP = oP.resetLoginPwd(gatewayHost=self.gatewayHost,clientHeaders=self.clientHeaders,loginPwd=newPwdSlave,
126   - secondLoginPwd=newPwdSlave,cardNo=startSlaveCardNo,accountId=accountIdSlaveCard,customerId=customerIdSlaveCard)
127   - assert "200" == resRLP.json()["code"],"副卡正常重置密码测试不通过"
128   - assert "OK" == resRLP.json()["message"], "副卡正常重置密码测试不通过"
129   -
130   - """测试完成"""
131   -
132   - # 副卡退卡
133   - resSlave = reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startSlaveCardNo,loginPwd=newPwdSlave)
134   - assert "200" == resSlave.json()["code"],"副卡使用新密码退卡成功,密码重置成功"
135   - assert "OK" == resSlave.json()["message"], "副卡使用新密码退卡成功,密码重置成功"
136   - # 主卡退卡
137   - res = reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo,loginPwd=newPwd)
138   - assert "200" == res.json()["code"],"主卡使用新密码退卡成功,密码重置成功"
139   - assert "OK" == res.json()["message"], "主卡使用新密码退卡成功,密码重置成功"
140   -
141   - def test_pwdModifyError(self):
142   - """修改密码异常流程测试 部分用例后续添加"""
143   - # 主卡入库-出库-开卡
144   - faceNum = 1
145   - startCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
146   - endCardNo = startCardNo + 2
147   - resCardFace = cSI.getCardFace(cardHost=self.cardHost, webHeaders=self.webHeaders)
148   - cardFace = cSI.returnFaceValue(resCardFace=resCardFace, faceNum=faceNum)
149   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startCardNo,
150   - endCardNo=endCardNo, cardFace=cardFace)
151   - print("resSavaCard.json() ->", resSavaCard.json())
152   - cardNos = str(startCardNo) + "," + str(endCardNo)
153   - print(cardNos)
154   - amount = 2
155   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=cardNos,
156   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
157   - applyUserCode=self.applyUserCode, amount=amount)
158   - assert outCardRes.json()["code"] == "200", "出库失败"
159   - resFirstOpen = oMC.openMasterCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
160   - cCNum=self.cCNum, cardNo=startCardNo, applyUserName=self.applyUserName)
161   - print("resFirstOpen", resFirstOpen.json())
162   - assert "200" == resFirstOpen.json()["code"], "第一次开卡,开卡失败"
163   - assert "data" in resFirstOpen.json(), "第一次开卡,开卡失败"
164   - # 副卡入库-出库-开卡
165   - startSlaveCardNo = int(time.strftime("%y%m%d%H%M%S", time.localtime()))
166   - endSlaveCardNo = startSlaveCardNo + 2
167   - resSavaCard = cSI.savaCard(cardHost=self.cardHost, webHeaders=self.webHeaders, startCardNo=startSlaveCardNo,
168   - endCardNo=endSlaveCardNo, cardType=20)
169   - res = oMC.checkNewCardNo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
170   - cardNo=startSlaveCardNo,
171   - cardType=20)
172   - assert "20000" == res.json()["code"], "使用已存在未出库的卡片进行校验校验失败"
173   - assert "该卡状态为[未激活],不能开卡!" == res.json()["message"], "message信息与预期信息不匹配"
174   - slaveCardNos = str(startSlaveCardNo) + "," + str(endSlaveCardNo)
175   - amount = 2
176   - outCardRes = cSO.cardAddOut(cardHost=self.cardHost, webHeaders=self.webHeaders, cardNos=slaveCardNos,
177   - applyUserName=self.applyUserName, applyUserId=self.applyUserId,
178   - applyUserCode=self.applyUserCode, amount=amount)
179   - assert outCardRes.json()["code"] == "200", "出库失败"
180   - resOpenSlaveCard = oMC.openSlaveCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
181   - cardNo=startCardNo, slaveCardNo=startSlaveCardNo,
182   - loginPwd=self.loginPwd, applyUserName=self.applyUserName,
183   - parentLoginPwd=self.loginPwd)
184   - assert "200" == resOpenSlaveCard.json()["code"], "开卡测试失败"
185   - # 开卡结束-获取卡片客户信息
186   - resSimpleInfo = oP.getSimpleInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
187   - cardNo=startCardNo)
188   - customerId,accountId = resSimpleInfo.json()["data"]["accountInfo"]["customerId"],resSimpleInfo.json()["data"]["accountInfo"]["accountId"]
189   - resSimpleInfo = oP.getSimpleInfo(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
190   - cardNo=startSlaveCardNo)
191   - customerIdSlaveCard, accountIdSlaveCard = resSimpleInfo.json()["data"]["accountInfo"]["customerId"], \
192   - resSimpleInfo.json()["data"]["accountInfo"]["accountId"]
193   - # 以上为测试数据准备
194   -
195   - """开始测试"""
196   -
197   - # 副卡使用两个不一致的密码进行重置时重置失败
198   - newPwdSlave = self.producePwd()
199   - print("newPwdSlave", newPwdSlave)
200   - resRLP = oP.resetLoginPwd(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, loginPwd="123456",
201   - secondLoginPwd=newPwdSlave, cardNo=startSlaveCardNo, accountId=accountIdSlaveCard,
202   - customerId=customerIdSlaveCard)
203   - print(resRLP.json())
204   - assert "2000" == resRLP.json()["code"], "副卡正常重置密码测试不通过"
205   - assert "两次密码输入不一致,请重新输入" == resRLP.json()["message"], "副卡正常重置密码测试不通过"
206   - resSlave = reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders,
207   - cardNo=startSlaveCardNo, loginPwd=newPwdSlave)
208   - assert "10001" == resSlave.json()["code"], "重置密码失败后不能使用新密码退卡,测试不通过"
209   -
210   -
211   - # 主卡使用两个不一致的密码进行重置时重置失败
212   - newPwd = self.producePwd()
213   - print("newPwd",newPwd)
214   - resRLP = oP.resetLoginPwd(gatewayHost=self.gatewayHost,clientHeaders=self.clientHeaders,loginPwd="123456",
215   - secondLoginPwd=newPwd,cardNo=startCardNo,accountId=accountId,customerId=customerId)
216   - print(resRLP.json())
217   - assert "2000" == resRLP.json()["code"],"主卡正常重置密码测试不通过"
218   - assert "两次密码输入不一致,请重新输入" == resRLP.json()["message"], "主卡正常重置密码测试不通过"
219   - res = reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo,loginPwd=newPwd)
220   - assert "10001" == res.json()["code"],"重置密码失败后不能使用新密码退卡,测试不通过"
221   -
222   - # 挂失的卡片不可以重置密码
223   -
224   - # 卡务锁定的卡片不可以重置密码
225   -
226   - # 账号冻结的卡片不可以重置密码
227   -
228   - # 资金账号锁定的卡片可以重置密码
229   -
230   - """测试完成"""
231   -
232   - # 副卡退卡
233   - resSlave = reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startSlaveCardNo)
234   - # assert "200" == resSlave.json()["code"],"副卡使用新密码退卡成功,密码重置成功"
235   - # assert "OK" == resSlave.json()["message"], "副卡使用新密码退卡成功,密码重置成功"
236   - # 主卡退卡
237   - res = reC.returnCardDef(gatewayHost=self.gatewayHost, clientHeaders=self.clientHeaders, cardNo=startCardNo)
238   - # assert "200" == res.json()["code"],"主卡使用新密码退卡成功,密码重置成功"
239   - # assert "OK" == res.json()["message"], "主卡使用新密码退卡成功,密码重置成功"
240   -
241   -