Commit 55429fd2b6b84363d6baf756bf1af299e3ead558
1 parent
acd58426
层级
Showing
5 changed files
with
83 additions
and
2 deletions
commons/api/fc_add.py
... | ... | @@ -2,7 +2,7 @@ |
2 | 2 | """ |
3 | 3 | @Time : 2021/7/29 11:18 |
4 | 4 | @Auth : wlm |
5 | -@File :fc_add.py | |
5 | +@File :fc_edit.py | |
6 | 6 | @IDE :PyCharm |
7 | 7 | """ |
8 | 8 | # -*- coding: utf-8 -*- |
... | ... | @@ -29,7 +29,7 @@ class fc_add(): |
29 | 29 | self.body = fc_add.body |
30 | 30 | |
31 | 31 | |
32 | -# fc=fc_add() | |
32 | +# fc=FeedbackCustomerController() | |
33 | 33 | # print(fc.body) |
34 | 34 | # re=my.post(url=fc.url,data=fc.body.encode('utf-8'),headers=fc.header) |
35 | 35 | # print(re.json()) | ... | ... |
commons/api/fc_view.py
... | ... | @@ -5,3 +5,29 @@ |
5 | 5 | @File :fc_view.py |
6 | 6 | @IDE :PyCharm |
7 | 7 | """ |
8 | +# -*- coding: utf-8 -*- | |
9 | +from commons import common as com | |
10 | +from commons.MySession import my | |
11 | + | |
12 | +class fc_view(): | |
13 | + url = "http://test.jmsf.diligrp.com:8385/FeedbackCustomerController/view.html?pagetype=2&id=40" | |
14 | + | |
15 | + header = { | |
16 | + "Host":"test.jmsf.diligrp.com:8385", | |
17 | + "Connection":"keep-alive", | |
18 | + "Upgrade-Insecure-Requests":"1", | |
19 | + "User-Agent":"Mozilla/5.0(WindowsNT6.2;WOW64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/84.0.4147.105Safari/537.36", | |
20 | + "Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", | |
21 | + "Accept-Language":"zh-CN,zh;q=0.9", | |
22 | + "Referer":"http://test.jmsf.diligrp.com:8385/FeedbackCustomerController/list", | |
23 | + "Accept-Encoding":"gzip,deflate","Cookie": | |
24 | + "UAP_refreshToken=0e205e78-a656-4a85-a2ba-7226ce898ae5;UAP_firmId=9;UAP_accessToken=eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiJXRUIiLCJuYmYiOjE2Mjc4NzI1NzEsImRhdGEiOiJ7XCJjZWxscGhvbmVcIjpcIjE1NTI2MzY0NDU2XCIsXCJjcmVhdGVkXCI6MTYwODc5NTk0OTAwMCxcImRlcGFydG1lbnRJZFwiOjU2LFwiZW1haWxcIjpcInNoZW55YW5nQGRpbGlncnAuY29tXCIsXCJmaXJtQ29kZVwiOlwic3lcIixcImZpcm1JZFwiOjksXCJmaXJtTmFtZVwiOlwi5rKI6Ziz5Zyw5Yip5Yac5om55biC5Zy65a6i5oi355S15a2Q57uT566X5Lit5b-DXCIsXCJpZFwiOjI1MSxcImxhc3RMb2dpblRpbWVcIjoxNjI3ODY1NTc3OTg5LFwibWV0YWRhdGFcIjp7fSxcIm1vZGlmaWVkXCI6MTYyNjE2MzAwNDAwMCxcInBhc3N3b3JkXCI6XCIxODk2NUVCNzJDOTJBNTQ5RERcIixcInJlYWxOYW1lXCI6XCLmsojpmLNcIixcInNlcmlhbE51bWJlclwiOlwiMDAwXCIsXCJzdGF0ZVwiOjEsXCJzeXN0ZW1UeXBlXCI6MSxcInVzZXJOYW1lXCI6XCI0NDQ0NDRcIn0iLCJpc3MiOiJVQVBfQVVUSDAiLCJleHAiOjE2Mjc4NzQzNzEsImlhdCI6MTYyNzg3MjU3MSwianRpIjoiNjM4MGNkOGEtNzU4MS00YjM2LTg4N2ItYzNhMGI0NzcwODA0In0.O6iQ0ccKQmgVybnf_nYhbcIGBO2eZmuOwOnBscl2scDIAN-XyRy4J57DmzQ45PQxhzg6bkIpgoYazN3ZVQ8xyTaanuAQCYi_rDJWqyKNJn_AHZWws9Gv-HuAPr1icsAZ6heME3nay-10u0zorbupmE9n_yIqH4LUEJZixqlHqCY" | |
25 | + } | |
26 | + | |
27 | + def __init__(self): | |
28 | + self.url=fc_view.url.replace("http://test.",com.get_global_config("global_data", "environment", "en") ) | |
29 | + self.header=fc_view.header | |
30 | + | |
31 | +fc = fc_view() | |
32 | +re=my.get(url=fc.url,headers=fc.header) | |
33 | +print(re.text) | |
8 | 34 | \ No newline at end of file | ... | ... |
testcase/FeedbackCustomerController/__init__.py
0 → 100644
testcase/fc_edit/fc_add.py renamed to testcase/FeedbackCustomerController/fc_edit.py
testcase/FeedbackCustomerController/fc_view.py
0 → 100644
1 | +import unittest | |
2 | +import urllib3 | |
3 | +import commons.ConfigDB as db | |
4 | +from commons import common as com | |
5 | +from commons.MySession import my | |
6 | +from commons.api.fc_view import fc_view | |
7 | +from commons.api.fc_add import fc_add | |
8 | +urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) | |
9 | +ad = fc_add() | |
10 | +vi = fc_view() | |
11 | + | |
12 | +class test_fc_view(unittest.TestCase): | |
13 | + "查看返还人" | |
14 | + | |
15 | + @classmethod | |
16 | + def setUpClass(cls): | |
17 | + # 通过字段配置接口提前配置新增页的字段配置 | |
18 | + my.post(url = ad.url, headers = ad.header, data = ad.body.encode('utf-8')) | |
19 | + | |
20 | + def setUp(self): | |
21 | + # 准备数据 | |
22 | + my.post(url=ad.url, headers=ad.header, data=ad.body.encode('utf-8')) | |
23 | + # 获取数据:从MYSQL获取新增返还人的id号 | |
24 | + self.code = db.mysql_selectOne("SELECT * FROM `dili_jmsf`.`feedback_customer` ORDER BY `id` DESC LIMIT 1")[0] | |
25 | + print("查询出返还人id", self.code) | |
26 | + | |
27 | + # @unittest.case_mark(my.mark()) | |
28 | + def test_doAudit_01(self): | |
29 | + "查看返还人" | |
30 | + # 请求url中的需要替换为新增返还人的id | |
31 | + url = vi.url.replace("40", str(self.code)) | |
32 | + print("数据处理后的url", url) | |
33 | + # 进行GET请求 | |
34 | + re = my.get(url=url, headers=vi.header) | |
35 | + # 打印请求结果(可删除该代码,一般只在调试时使用) | |
36 | + print(re.text) | |
37 | + # 断言响应数据中是否存在期望字符串 | |
38 | + self.assertTrue('关联交费卡号' in str(re.text)) | |
39 | + | |
40 | + return re | |
41 | + | |
42 | + @classmethod | |
43 | + def tearDownClass(cls): | |
44 | + pass | |
45 | + | |
46 | + if __name__ == '__main__': | |
47 | + unittest.main() | |
0 | 48 | \ No newline at end of file | ... | ... |