Commit 1db2d8ff332636b0c51dd10d8b65a46ed4bb0fb0
1 parent
a4a74681
创建返还人
Showing
2 changed files
with
49 additions
and
11 deletions
commons/api/fc_add.py
@@ -5,20 +5,31 @@ | @@ -5,20 +5,31 @@ | ||
5 | @File :fc_add.py | 5 | @File :fc_add.py |
6 | @IDE :PyCharm | 6 | @IDE :PyCharm |
7 | """ | 7 | """ |
8 | +# -*- coding: utf-8 -*- | ||
8 | from commons import common as com | 9 | from commons import common as com |
10 | +from commons.MySession import my | ||
9 | 11 | ||
10 | class fc_add(): | 12 | class fc_add(): |
11 | url = "http://test.jmsf.diligrp.com:8385/FeedbackCustomerController/add.action" | 13 | url = "http://test.jmsf.diligrp.com:8385/FeedbackCustomerController/add.action" |
12 | - | ||
13 | header = { | 14 | header = { |
14 | - "Host": "test.jmsf.diligrp.com:8385", "Connection": "keep-alive", "Content-Length": "95", | ||
15 | - "Accept": "application/json,text/javascript,*/*;q=0.01", "Origin": "http://test.jmsf.diligrp.com:8385", | ||
16 | - "X-Requested-With": "XMLHttpRequest", | ||
17 | - "User-Agent": "Mozilla/5.0(WindowsNT6.2;WOW64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/84.0.4147.105Safari/537.36", | ||
18 | - "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8", "Accept-Language": "zh-CN,zh;q=0.9", | ||
19 | - "Referer": "http://test.jmsf.diligrp.com:8385/FeedbackCustomerController/list", | ||
20 | - "Accept-Encoding": "gzip,deflate", | ||
21 | - "Cookie": "UAP_accessToken=eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiJXRUIiLCJuYmYiOjE2Mjc1MjY2ODMsImRhdGEiOiJ7XCJjZWxscGhvbmVcIjpcIjE1NTI2MzY0NDU2XCIsXCJjcmVhdGVkXCI6MTYwODc5NTk0OTAwMCxcImRlcGFydG1lbnRJZFwiOjU2LFwiZW1haWxcIjpcInNoZW55YW5nQGRpbGlncnAuY29tXCIsXCJmaXJtQ29kZVwiOlwic3lcIixcImZpcm1JZFwiOjksXCJmaXJtTmFtZVwiOlwi5rKI6Ziz5Zyw5Yip5Yac5om55biC5Zy65a6i5oi355S15a2Q57uT566X5Lit5b-DXCIsXCJpZFwiOjI1MSxcImxhc3RMb2dpblRpbWVcIjoxNjI3NTI2NjgzMjM3LFwibWV0YWRhdGFcIjp7fSxcIm1vZGlmaWVkXCI6MTYyNjE2MzAwNDAwMCxcInBhc3N3b3JkXCI6XCIxODk2NUVCNzJDOTJBNTQ5RERcIixcInJlYWxOYW1lXCI6XCLmsojpmLNcIixcInNlcmlhbE51bWJlclwiOlwiMDAwXCIsXCJzdGF0ZVwiOjEsXCJzeXN0ZW1UeXBlXCI6MSxcInVzZXJOYW1lXCI6XCI0NDQ0NDRcIixcInVzZXJUeXBlXCI6MX0iLCJpc3MiOiJVQVBfQVVUSDAiLCJleHAiOjE2Mjc1Mjg0ODMsImlhdCI6MTYyNzUyNjY4MywianRpIjoiYzI4ZDQxMjMtZmZjNi00MDMxLWEwMTQtY2VjMTA4ZGNiOGY3In0.E69TocGIKrnA8-lO4IRblg9fTh4yxB1A83BrW-fazgX1j507yontybV-vfTxsYg3BT-aqBezaqZU0Cw2KconHcZgNHAFpvym0tpwbIXCTbJPgFa7d5VB7nFlbzztlXfgit-Lj2p3wMQlc3FbKRUTUulfXur7CdvZDzCurIxQRsg;UAP_refreshToken=340315b8-f633-4f21-ac66-1a3dfd30ec2d;UAP_firmId=9" | ||
22 | - | 15 | + "Host": "test.jmsf.diligrp.com:8385", "Connection": "keep-alive", "Content-Length": "77", |
16 | + "Accept": "application/json,text/javascript,*/*;q=0.01", "Origin": "http://test.jmsf.diligrp.com:8385", | ||
17 | + "X-Requested-With": "XMLHttpRequest", | ||
18 | + "User-Agent": "Mozilla/5.0(WindowsNT6.2;WOW64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/84.0.4147.105Safari/537.36", | ||
19 | + "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8", "Accept-Language": "zh-CN,zh;q=0.9", | ||
20 | + "Referer": "http://test.jmsf.diligrp.com:8385/FeedbackCustomerController/list", | ||
21 | + "Accept-Encoding": "gzip,deflate", | ||
22 | + "Cookie": "UAP_accessToken=eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiJXRUIiLCJuYmYiOjE2Mjc4NjU1NzgsImRhdGEiOiJ7XCJjZWxscGhvbmVcIjpcIjE1NTI2MzY0NDU2XCIsXCJjcmVhdGVkXCI6MTYwODc5NTk0OTAwMCxcImRlcGFydG1lbnRJZFwiOjU2LFwiZW1haWxcIjpcInNoZW55YW5nQGRpbGlncnAuY29tXCIsXCJmaXJtQ29kZVwiOlwic3lcIixcImZpcm1JZFwiOjksXCJmaXJtTmFtZVwiOlwi5rKI6Ziz5Zyw5Yip5Yac5om55biC5Zy65a6i5oi355S15a2Q57uT566X5Lit5b-DXCIsXCJpZFwiOjI1MSxcImxhc3RMb2dpblRpbWVcIjoxNjI3ODY1NTc3OTg5LFwibWV0YWRhdGFcIjp7fSxcIm1vZGlmaWVkXCI6MTYyNjE2MzAwNDAwMCxcInBhc3N3b3JkXCI6XCIxODk2NUVCNzJDOTJBNTQ5RERcIixcInJlYWxOYW1lXCI6XCLmsojpmLNcIixcInNlcmlhbE51bWJlclwiOlwiMDAwXCIsXCJzdGF0ZVwiOjEsXCJzeXN0ZW1UeXBlXCI6MSxcInVzZXJOYW1lXCI6XCI0NDQ0NDRcIixcInVzZXJUeXBlXCI6MX0iLCJpc3MiOiJVQVBfQVVUSDAiLCJleHAiOjE2Mjc4NjczNzgsImlhdCI6MTYyNzg2NTU3OCwianRpIjoiMTBhOTY2ZmEtYTAzYS00YTFiLTliYmMtNDIzMTRhN2Y2ZGVmIn0.LnIkAnxYqN75lotTXyIyNn6Mu7qvu4eOqeEhuXcoeWGpJ5_vTYDbOt7VY9EbvN_dNVdaW1LD0Fp0hDWNLu9mUi-RytYo-WgvSM-BBuzCnp9r9CschtW0lmzQhYtvp1GF5FC0FMw1LQB0WVeQjKW8hShwQgD8DqYh_1EWXDgJ3VE; UAP_refreshToken=0e205e78-a656-4a85-a2ba-7226ce898ae5; UAP_firmId=9" | ||
23 | } | 23 | } |
24 | - | ||
25 | \ No newline at end of file | 24 | \ No newline at end of file |
25 | + body = 'parentId=0&name=框架&mobile=18828273365&cardNumber=888800022857' | ||
26 | + def __init__(self): | ||
27 | + self.url = fc_add.url.replace("http://test.",com.get_global_config("global_data", "environment", "en") ) | ||
28 | + self.header = fc_add.header | ||
29 | + self.body = fc_add.body | ||
30 | + | ||
31 | + | ||
32 | +fc=fc_add() | ||
33 | +print(fc.body) | ||
34 | +re=my.post(url=fc.url,data=fc.body.encode('utf-8'),headers=fc.header) | ||
35 | +print(re.json()) | ||
36 | +print(re.headers) | ||
26 | \ No newline at end of file | 37 | \ No newline at end of file |
testcase/fc_add.py
0 → 100644
1 | +import unittest | ||
2 | +import urllib3 | ||
3 | +from commons import common as com | ||
4 | +from commons.MySession import my | ||
5 | +from commons.api.fc_add import fc_add | ||
6 | +urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) | ||
7 | + | ||
8 | +fc=fc_add() | ||
9 | +class test_fc_add(unittest.TestCase): | ||
10 | + "新增返还人" | ||
11 | + @classmethod | ||
12 | + def setUpClass(cls): | ||
13 | + my.post(url=fc.url, headers=fc.header, data=fc.body.encode('utf-8')) | ||
14 | + | ||
15 | + def test_fc_add_01(self): | ||
16 | + | ||
17 | + body = fc.body.replace("888800022857","888810054630").replace("框架","那就").replace("18828273365","18828376651") | ||
18 | + print(body) | ||
19 | + re = my.post(url=fc.url, headers=fc.header, data=body.encode('utf-8')) | ||
20 | + print(re.headers) | ||
21 | + print(re.json()) | ||
22 | + self.assertTrue("操作成功" in str(re.json())) | ||
23 | + | ||
24 | + | ||
25 | + | ||
26 | +if __name__ == '__main__': | ||
27 | + unittest.main() |