`TestRoomCreate` fails if the underlying server fails to deserialise an integer room version instead of validating it

未关闭 适合新手
#952 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
1/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
go
领域
testing-qa

调研方向

失败的断言位于 apidoc_room_create_test.go 中 TestRoomCreate 的子测试 POST /createRoom rejects attempts to create rooms with numeric versions 里。请阅读该测试如何匹配 errcode 键,以及同一文件中其他拒绝用例如何接受替代错误码。完成标准是:当服务器对数字类型的房间版本返回 M_NOT_JSON 或 M_BAD_JSON 时,该子测试通过,然后重新运行测试以确认。

由索引模型根据 Issue 内容生成。

描述

If a /createRoom request fails to be deserialised into a strongly typed struct because the room version parameter expects a string, but is given an integer, the server will return M_NOT_JSON. However, TestRoomCreate/Parallel/POST_/createRoom_rejects_attempts_to_create_rooms_with_numeric_versions expects M_BAD_JSON instead, which requires that the deserialiser is allowed to ignore incorrect types.

  ❌ TestRoomCreate/Parallel/POST_/createRoom_rejects_attempts_to_create_rooms_with_numeric_versions (FAIL; 230ms)
    apidoc_room_create_test.go:195: MatchResponse key 'errcode' got 'M_NOT_JSON' (type string) want 'M_BAD_JSON' (type string) - http://127.0.0.1:33163/_matrix/client/v3/createRoom => {"errcode":"M_NOT_JSON","error":"failed to parse body as JSON: json: unable to unmarshal JSON number into Go id.RoomVersion within \"/room_version\""}

Accepting M_NOT_JSON and M_BAD_JSON would fix this.

主要语言
Go
星标
101
派生
73
平均合并
1 天 2 小时
30 天内合并 PR
3

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

matrix-org/complement 的其他 Issue

查看 matrix-org/complement 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。