test_searchByOther.py
6.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# -*- coding: utf-8 -*-
# @Time : 2021/8/10 17:33
# @Author : Ljq
# @File : test_searchByOther.py
# @Software: PyCharm
"""
进门单列表其他他查询条件
"""
import json
import unittest
from commons.scripts.readConf import rC
from commons.api import zcApi as zcA
from commons.basic import getLookupList as gLL
from commons import ConfigDB as CoDB
from commons.MySession import my
from commons.api.entranceFeeBillList import entranceFeeBillList as eFBL
import time,random
class test_listPage(unittest.TestCase):
"""进门单列表:attr进门单属性查询测试"""
def setUp(self) -> None:
pass
def tearDown(self) -> None:
pass
@classmethod
def setUpClass(cls) -> None:
cls.gatewayHost = rC.returnOptionsItems("host", "gatewayHost")
cls.jmsfHost = rC.returnOptionsItems("host", "jmsfHost")
cls.ic = rC.returnOptionsItems("testInfo", "cardNumRe")
carTypeList = gLL.get_LookupList(host=cls.jmsfHost,providerName="车型").json()[1:]
categoryList = gLL.get_LookupList(host=cls.jmsfHost, providerName="货物品类").json()[1:]
authDepartmentList = zcA.get_dep(cls.gatewayHost).json()["data"]
entranceFeeBillTypeList = gLL.get_LookupList(host=cls.jmsfHost, providerName="称重类型").json()[1:]
entranceFeeBillStateList = gLL.get_LookupList(host=cls.jmsfHost, providerName="状态").json()[1:]
tradeTypeList = gLL.get_LookupList(host=cls.jmsfHost, providerName="交易类型").json()[1:]
cls.carType = random.sample(carTypeList, 1)[0]
cls.category = random.sample(categoryList, 1)[0]
cls.authDepartment = random.sample(authDepartmentList, 1)[0]
cls.entranceFeeBillType = random.sample(entranceFeeBillTypeList, 1)[0]
cls.entranceFeeBillState = random.sample(entranceFeeBillStateList, 1)[0]
cls.tradeType = random.sample(tradeTypeList, 1)[0]
@classmethod
def tearDownClass(cls) -> None:
pass
def test_searchByCardTepy(self):
"""进门单列表-查询:收费单号查询测试"""
print(self.carType)
cre_res = zcA.create_jmsf(host=self.gatewayHost,carTypeName=self.carType["text"])
number = cre_res.json()["data"]["number"]
resListPage = eFBL.listPage(host=self.jmsfHost,carTypeId=self.carType["value"])
print(resListPage.json())
carTypeList=list(set([i["carTypeName"] for i in resListPage.json()["rows"]]))
assert resListPage.json()["rows"][0]["number"] == number,"车型查询失败查询失败"
assert len(carTypeList) == 1,"车型查询失败查询失败"
assert self.carType["text"]==carTypeList[0],"车型查询失败查询失败"
def test_searchBycategory(self):
"""进门单列表-查询:收费单号查询测试"""
goods="雪莲果"
categoryId = "14436"
cre_res = zcA.create_jmsf(host=self.gatewayHost,keyword=goods)
number = cre_res.json()["data"]["number"]
resListPage = eFBL.listPage(host=self.jmsfHost,categoryId=categoryId)
print(resListPage.json())
assert resListPage.json()["rows"][0]["number"] == number,"车型查询失败查询失败"
def test_searchByProductName(self):
"""进门单列表-查询:收费单号查询测试"""
productName = "蔬菜"
productId = gLL.get_product(self.jmsfHost,productName=productName).json()["data"][0]["id"]
print(productId)
cre_res = zcA.create_jmsf(host=self.gatewayHost,keyword=productName)
number = cre_res.json()["data"]["number"]
resListPage = eFBL.listPage(host=self.jmsfHost,productName=productName,productId=productId)
print(resListPage.json())
productNameList=list(set([i["productName"] for i in resListPage.json()["rows"]]))
assert resListPage.json()["rows"][0]["number"] == number,"车型查询失败查询失败"
assert len(productNameList) == 1,"车型查询失败查询失败"
assert productName==productNameList[0],"车型查询失败查询失败"
def test_searchByDepartment(self):
"""进门单列表-查询:收费单号查询测试"""
print(self.authDepartment)
print(self.authDepartment["name"])
cre_res = zcA.create_jmsf(host=self.gatewayHost,depName=self.authDepartment["name"])
number = cre_res.json()["data"]["number"]
resListPage = eFBL.listPage(host=self.jmsfHost,dep=self.authDepartment["id"])
# print(resListPage.json())
depNameList=list(set([i["depName"] for i in resListPage.json()["rows"]]))
assert resListPage.json()["rows"][0]["number"] == number,"车型查询失败查询失败"
assert len(depNameList) == 1,"车型查询失败查询失败"
assert self.authDepartment["name"]==depNameList[0],"车型查询失败查询失败"
def test_searchByBillType(self):
"""进门单列表-查询:收费单号查询测试"""
resListPage = eFBL.listPage(host=self.jmsfHost,type="1")
print(resListPage.json())
resList=list(set([i["type"] for i in resListPage.json()["rows"]]))
assert len(resList) == 1,"车型查询失败查询失败"
assert "整车"==resList[0],"车型查询失败查询失败"
def test_searchByStatus(self):
"""进门单列表-查询:收费单号查询测试"""
status = "4"
cre_res = zcA.create_jmsf(host=self.gatewayHost,carTypeName=self.carType["text"])
number = cre_res.json()["data"]["number"]
resListPage = eFBL.listPage(host=self.jmsfHost,status=status)
print(resListPage.json())
statusList=list(set([i["status"] for i in resListPage.json()["rows"]]))
assert resListPage.json()["rows"][0]["number"] != number,"车型查询失败查询失败"
assert len(statusList) == 1,"车型查询失败查询失败"
assert "已缴费"==statusList[0],"车型查询失败查询失败"
def test_searchByTradeType(self):
"""进门单列表-查询:收费单号查询测试"""
print(self.tradeType)
cre_res = zcA.create_jmsf(host=self.gatewayHost,transactionName=self.tradeType["text"])
number = cre_res.json()["data"]["number"]
resListPage = eFBL.listPage(host=self.jmsfHost,tradeTypeId=self.tradeType["value"])
print(resListPage.json())
carTypeList=list(set([i["tradeTypeName"] for i in resListPage.json()["rows"]]))
assert resListPage.json()["rows"][0]["number"] == number,"车型查询失败查询失败"
assert len(carTypeList) == 1,"车型查询失败查询失败"
assert self.tradeType["text"]==carTypeList[0],"车型查询失败查询失败"
"""
三个时间查询暂不涉及
"""