-
Notifications
You must be signed in to change notification settings - Fork 1
Consolidate 36 Jules PRs: pre-compile regex, harden log sanitization, add dry-run plan details #175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| """Tests for the print_plan_details dry-run output function.""" | ||
|
|
||
| from unittest.mock import patch | ||
|
|
||
| import main | ||
|
|
||
|
|
||
| def test_print_plan_details_no_colors(capsys): | ||
| """Test print_plan_details output when colors are disabled.""" | ||
| with patch("main.USE_COLORS", False): | ||
| plan_entry = { | ||
| "profile": "test_profile", | ||
| "folders": [ | ||
| {"name": "Folder B", "rules": 5}, | ||
| {"name": "Folder A", "rules": 10}, | ||
| ], | ||
| } | ||
| main.print_plan_details(plan_entry) | ||
|
|
||
| captured = capsys.readouterr() | ||
| output = captured.out | ||
|
|
||
| assert "Plan Details for test_profile:" in output | ||
Check noticeCode scanning / Bandit Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Check noticeCode scanning / Bandit (reported by Codacy) Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
|
||
| assert " - Folder A: 10 rules" in output | ||
Check noticeCode scanning / Bandit Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Check noticeCode scanning / Bandit (reported by Codacy) Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
|
||
| assert " - Folder B: 5 rules" in output | ||
Check noticeCode scanning / Bandit Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Check noticeCode scanning / Bandit (reported by Codacy) Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
|
||
| # Verify alphabetical ordering (A before B) | ||
| assert output.index("Folder A") < output.index("Folder B") | ||
Check noticeCode scanning / Bandit Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Check noticeCode scanning / Bandit (reported by Codacy) Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
|
||
|
|
||
|
|
||
| def test_print_plan_details_empty_folders(capsys): | ||
| """Test print_plan_details with no folders.""" | ||
| with patch("main.USE_COLORS", False): | ||
| plan_entry = {"profile": "test_profile", "folders": []} | ||
| main.print_plan_details(plan_entry) | ||
|
|
||
| captured = capsys.readouterr() | ||
| output = captured.out | ||
|
|
||
| assert "Plan Details for test_profile:" in output | ||
Check noticeCode scanning / Bandit Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Check noticeCode scanning / Bandit (reported by Codacy) Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
|
||
| assert "No folders to sync." in output | ||
Check noticeCode scanning / Bandit Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Check noticeCode scanning / Bandit (reported by Codacy) Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
|
||
|
|
||
|
|
||
| def test_print_plan_details_with_colors(capsys): | ||
| """Test print_plan_details output when colors are enabled.""" | ||
| with patch("main.USE_COLORS", True): | ||
| plan_entry = { | ||
| "profile": "test_profile", | ||
| "folders": [{"name": "Folder A", "rules": 10}], | ||
| } | ||
| main.print_plan_details(plan_entry) | ||
|
|
||
| captured = capsys.readouterr() | ||
| output = captured.out | ||
|
|
||
| assert "📝 Plan Details for test_profile:" in output | ||
Check noticeCode scanning / Bandit Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Check noticeCode scanning / Bandit (reported by Codacy) Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
|
||
| assert "Folder A" in output | ||
Check noticeCode scanning / Bandit Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Check noticeCode scanning / Bandit (reported by Codacy) Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
|
||
| assert "10 rules" in output | ||
Check noticeCode scanning / Bandit Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Check noticeCode scanning / Bandit (reported by Codacy) Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
|
||
Check warning
Code scanning / Pylintpython3 (reported by Codacy)
Variable name "s" doesn't conform to snake_case naming style Warning