Skip to content

test(dash): improve update_service tests#84

Merged
Wolido merged 1 commit into
mainfrom
test/improve-update_service-tests
May 29, 2026
Merged

test(dash): improve update_service tests#84
Wolido merged 1 commit into
mainfrom
test/improve-update_service-tests

Conversation

@Wolido
Copy link
Copy Markdown
Owner

@Wolido Wolido commented May 29, 2026

改进内容

基于 reviewer 反馈改进 dash 的 update_service 测试:

  • import json 从函数内部移到模块顶部
  • 增强 mock 空 payload 测试:先捕获原始值再断言未修改
  • 增强 partial update 测试:断言原始值与更新值确实不同
  • 增强 fallback 测试:断言仅发生一次请求
  • 新增 3 个边界测试:
    • PUT 返回 500
    • 空 payload fallback GET 返回 404
    • 空 payload fallback GET 网络错误

所有 103 个测试通过。

- Move import json to module top level
- Strengthen mock empty-payload test with original_name capture
- Add assert original_name != changed value in partial update test
- Add assert len(responses.calls) == 1 in fallback test
- Add 3 new tests: 500 error, GET 404 on empty payload, GET network error on empty payload

Total: 103 tests, all passing.
@Wolido Wolido merged commit 714420b into main May 29, 2026
6 checks passed
@Wolido Wolido deleted the test/improve-update_service-tests branch May 29, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant