test: add unit tests for _safe_path and get_subsidy_overview#5
Open
sugukurukabe wants to merge 1 commit intodigital-go-jp:mainfrom
Open
test: add unit tests for _safe_path and get_subsidy_overview#5sugukurukabe wants to merge 1 commit intodigital-go-jp:mainfrom
sugukurukabe wants to merge 1 commit intodigital-go-jp:mainfrom
Conversation
14 tests covering: - _safe_path: path traversal prevention (4 cases) - get_subsidy_overview: accepting count, deadline buckets, urgency flag, expired exclusion, amount ranges, error propagation, CSV mode test_accepting_count_currently_open intentionally FAILS on the current main branch, documenting the bug fixed in PR digital-go-jp#2. All other 13 tests pass. The test suite will be fully green once PR digital-go-jp#2 is merged. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要 / Summary
ライブAPIに依存しないユニットテスト(14件)を追加します。
Adds 14 unit tests that do not depend on the live J-Grants API.
テスト内容 / What is tested
_safe_path(4件)test_valid_path_within_basetest_path_traversal_raises../によるパストラバーサルを検出test_nested_traversal_raises../../も検出test_same_base_returns_base.は基底ディレクトリ自身を返すget_subsidy_overview(10件)test_accepting_count_currently_openacceptingにカウントされる ※1test_accepting_count_not_yet_startedacceptingにカウントしないtest_this_month_bucketthis_monthtest_next_month_bucketnext_monthtest_urgent_deadline_flaggedurgent_deadlinesに含まれるtest_expired_subsidy_excludedtest_amount_range_under_1munder_1mtest_amount_range_unspecifiedunspecifiedtest_error_propagatedtest_csv_output_contains_headeroutput_format='csv'で正常終了実行方法 / How to run
Expected output on current
main: 13 passed, 1 failed (test_accepting_count_currently_open)Expected output after PR #2 merges: 14 passed
Made with Cursor