Commit 6eb6284
HandlerのAnnouncementのテスト実装 (#5)
* 追加
* リポジトリのモック作成
* HandlerのAnnouncementテスト追加
* Announcementテストにカスタムクレームを使用した403エラー検証を追加
* Update authentication error assertions in announcement tests to check for exact error message
* Add developer claim support in announcement list tests
Enhanced the TestAnnouncementsV1List function to include a new test case for handling requests with a developer claim. Updated the test structure to accommodate the additional claim and ensured proper validation of the response for this scenario.
* Add custom claims test case for 403 error in announcement update handler
Enhanced the TestAnnouncementsV1Update function by adding a new test case that verifies the response when a token with non-admin/developer claims is used. This ensures proper handling of insufficient permissions and improves overall test coverage for authentication scenarios.
* Add developer claim support in announcement creation tests
Enhanced the TestAnnouncementsV1Create function by adding a new test case that verifies the ability to create announcements with a developer claim. Updated the test structure to include the new claim and ensured proper validation of the response for this scenario.
* Enhance announcement deletion tests to support developer claims
Updated the TestAnnouncementsV1Delete function to include a new test case for handling deletion requests with a developer claim. Adjusted the expected status code to reflect the correct response for successful deletions and modified the test setup to accommodate different claim types. Additionally, changed the handler to use AbortWithStatus for consistency in response handling.
* Refactor announcement tests to improve error handling and structure
Updated the TestAnnouncementsV1List and TestAnnouncementsV1Update functions to enhance test clarity and error handling. Introduced the require package for better error assertions and adjusted variable formatting for consistency. This improves overall test reliability and readability.
* Create時のステータスコードを201に修正
* Abortを修正
* エラーを明示
* Add WriteHeaderNow call in AnnouncementsV1Delete handler for immediate response
* Update internal/handler/announcement_test.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* 型修正
* Add custom claims support in announcement tests for enhanced permission validation
Updated TestAnnouncementsV1List, TestAnnouncementsV1Detail, and TestAnnouncementsV1Delete to include custom claims for testing 403 error scenarios. This allows for more granular permission checks and improves test coverage for authorization logic.
* ゼロでは無いことを検証
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>1 parent 72b8af7 commit 6eb6284
File tree
4 files changed
+632
-0
lines changed- internal
- handler
- repository
4 files changed
+632
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| 38 | + | |
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
| |||
72 | 74 | | |
73 | 75 | | |
74 | 76 | | |
| 77 | + | |
75 | 78 | | |
76 | 79 | | |
77 | 80 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
| |||
0 commit comments