quicknote/aws_ip/from aws_ip.py

72 lines
2.3 KiB
Python

from aws_ip.extract_ip_prefixes import extract_ip_prefixes
# python
def test_extract_ip_prefixes():
input_string = """
curl --request POST \
--url http://localhost:5000/api/v1/zhipu/stream \
--header 'Content-Type: application/json' \
--data '{
"message":"你好"
}'
curl --request POST \
--url http://127.0.0.1:5000/api/v1/zhipu/stream \
--header 'Content-Type: application/json' \
--data '{
"message":"你好"
}'
curl -N -X POST http://127.0.0.1:5000/api/v1/zhipu/stream \
-H "Content-Type: application/json" \
-d '{"message": "Tell me a short joke about AI"}'
http://192.168.2.212:3000/digisky/llm_hub.git
http://192.168.2.212:3000/digisky/avatar_gen.git
curl -N -X POST http://127.0.0.1:5000/api/v1/zhipu/retrive/stream \
-H "Content-Type: application/json" \
-d '{
"message":"商机广汽汇理汽车金融有限公司的负责人是谁",
"knowledge_id":"1843318172036575232"
}'
curl -N -X POST http://127.0.0.1:5000/api/v1/zhipu/retrive/stream \
-H "Content-Type: application/json" \
-d '{
"message":"商机广汽汇理汽车金融有限公司的负责人是谁",
"knowledge_id":"1843318172036575232"
}'
curl -N -X POST http://127.0.0.1:5001/api/v1/zhipu/analysis/stream \
-H "Content-Type: application/json" \
-d '{
"message":"分析商机广汽汇理汽车金融有限公司的商机建议",
"knowledge_id":"1843318172036575232"
}'
curl -N -X POST http://59.110.92.194:5000/api/v1/zhipu/retrive/stream \
-H "Content-Type: application/json" \
-d '{
"message":"商机广汽汇理汽车金融有限公司的负责人是谁",
"knowledge_id":"1843318172036575232"
}'
curl -N -X POST http://59.110.92.194:5000/api/v1/zhipu/analysis/stream \
-H "Content-Type: application/json" \
-d '{
"message":"分析商机广汽汇理汽车金融有限公司的商机建议",
"knowledge_id":"1843318172036575232"
}'
"""
expected = [
"localhost:5000",
"127.0.0.1:5000",
"192.168.2.212:3000",
"127.0.0.1:5001",
"59.110.92.194:5000"
]
result = extract_ip_prefixes(input_string)
assert sorted(result) == sorted(expected)