mybot/mock/client.py

90 lines
2.8 KiB
Python

# -*- coding: utf-8 -*-
# @Time : 2023/4/4 19:57
# @Author : Flora.Chen
# @File : client.py.py
# @Software: PyCharm
# @Desc: 模拟客户端像服务器发送请求
import requests
req_data = {
"ref": "refs/heads/master",
"before": "6c22220fabcf749fdcf4b31b79d5195ff0acb751ef82",
"after": "29f3333339413d42affe9f31e910782b24bb73aaec1540",
"compare_url": "https://testgitea2.trustie.net/floraachy/openCC/compare/9d40bf0c2e4feec3c",
"commits": [
{
"id": "a96b8a2222247f9c1cb8882a966cbae239e09c8abc4b0",
"message": "xixixha222hahah",
"author": {
"name": "floraachy",
"email": "flower@qq.com",
"username": ""
},
"timestamp": "2023-04-07T17:28:28+08:00"
},
{
"id": "b1122222f9c1cb8882a966cbae239e09c8abc4b0",
"message": "bbaba22222babab1",
"author": {
"name": "flora",
"email": "flower@gitlink.com",
"username": ""
},
"timestamp": "2023-04-07T17:28:28+08:00"
},
],
"repository": {
"full_name": "floraachy/mybot",
}
}
req_data2 = {
"ref": "refs/heads/gitlink",
"before": "22222222222bcf749fdcf4b31b79d5195ff0acb751ef82",
"after": "333333333333333333affe9f31e910782b24bb73aaec1540",
"compare_url": "https://testgitea2.trustie.net/floraachy/openCC/compare/9d40bf0c2e4feec3c",
"commits": [
{
"id": "ae239e09c8abc4b0",
"message": "测试11111",
"author": {
"name": "floraachy",
"email": "flower@qq.com",
"username": ""
},
"timestamp": "2023-04-07T17:28:28+08:00"
},
{
"id": "9e09c8abc4b0",
"message": "test-222",
"author": {
"name": "flora",
"email": "flower@gitlink.com",
"username": ""
},
"timestamp": "2023-04-07T17:28:28+08:00"
},
],
"repository": {
"full_name": "floraachy/mybot",
}
}
req_data3 = {
"issue": "refs/heads/gitlink",
"repository": {
"full_name": "floraachy/mybot",
}
}
# res = requests.post("http://127.0.0.1:8070/mybot?installer_id=85589", json=req_data)
res2 = requests.post("http://127.0.0.1:8070/mybot?installer_id=85589", json=req_data2)
# res3 = requests.post("http://127.0.0.1:8070/mybot?installer_id=83300", json=req_data3)
# res31 = requests.post("http://127.0.0.1:8070/mybot?installer_id=84400", json=req_data3)
# res4 = requests.post("http://127.0.0.1:8070/issues?installer_id=85501", json=req_data3)
# res5 = requests.post("http://127.0.0.1:8070/issues?installer_id=85502", json=req_data3)
# print(res)
# print(res.status_code)
# print(res.text)
# print(res.json())