Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
test-bitAgent-API
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
测试组专用
test-bitAgent-API
Commits
c0c45e44
提交
c0c45e44
authored
4月 23, 2025
作者:
张孟夏
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加获取expId的功能
上级
437d11c4
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
75 行增加
和
0 行删除
+75
-0
01006-读取消息-chat read.robot
01006-读取消息-chat read.robot
+50
-0
get_expId.py
get_expId.py
+25
-0
没有找到文件。
01006-读取消息-chat read.robot
0 → 100644
浏览文件 @
c0c45e44
*** Settings ***
Resource flow_zmx.resource
Resource res_zmx.resource
Library get_expId.py
*** Variables ***
${path} /api/chat/read
*** Test Cases ***
正例-正常读取消息
[Tags] F
${resp} Get ExpId http://bitagent.sit.ninetechone.com/${path} ${sessionId} ${ex_streamId} ${token}
log ${resp}
Should Contain ${resp} EXP_
反例-传入错误的token
[Tags] E
create session URI ${URL}
&{header} Create Dictionary Authorization=test666
${params} Create Dictionary sessionId=${sessionId} streamId=${text_streamId}
${resp} Get On Session URI ${PATH} params=${params} headers=${header} expected_status=401
Should Be Equal As Integers ${resp.json()["code"]} 401
Should Be Equal As Strings ${resp.json()["message"]} 无效的access token
反例-传入空白token
[Tags] E
create session URI ${URL}
&{header} Create Dictionary Authorization=${EMPTY}
${params} Create Dictionary sessionId=${sessionId} streamId=${text_streamId}
${resp} Get On Session URI ${PATH} params=${params} headers=${header} expected_status=401
Should Be Equal As Integers ${resp.json()["code"]} 401
Should Be Equal As Strings ${resp.json()["message"]} 没有找到认证信息
反例-不传入sessionId参数
[Tags] E
create session URI ${URL}
&{header} Create Dictionary Authorization=${token}
${params} Create Dictionary streamId=${text_streamId}
${resp} Get On Session URI ${PATH} params=${params} headers=${header} expected_status=200
Should Be Equal As Integers ${resp.json()["code"]} 500
Should Be Equal As Strings ${resp.json()["message"]} Server busy, please try later
反例-不传入streamId参数
[Tags] E
create session URI ${URL}
&{header} Create Dictionary Authorization=${token}
${params} Create Dictionary sessionId=${sessionId}
${resp} Get On Session URI ${PATH} params=${params} headers=${header} expected_status=200
Should Be Equal As Integers ${resp.json()["code"]} 500
Should Be Equal As Strings ${resp.json()["message"]} Server busy, please try later
get_expId.py
0 → 100644
浏览文件 @
c0c45e44
from
sseclient
import
SSEClient
def
get_expId
(
url
,
sessionId
,
streamId
,
token
):
'''
url:sse连接地址;
sessionId:会话Id
streamId:本次对话Id
token:凭据
'''
params
=
{
'sessionId'
:
sessionId
,
'streamId'
:
streamId
,
'access_token'
:
token
}
messages
=
SSEClient
(
url
=
url
,
params
=
params
)
for
msg
in
messages
:
# 处理每个接收到的消息
if
'EXP'
in
msg
.
data
:
# print("Received Message:", msg.data)
return
msg
.
data
break
# print(get_expId('http://bitagent.sit.ninetechone.com/api/chat/read','CB_05ae462bcf704b5aa990c0db9b3496cb','CB_ec83a379621a4eddb7360fcd7272b1e0','Bearer c1391926-e8ba-46c0-a0d1-c5e3c38503da'))
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论