Skip to content

Commit 0a820e0

Browse files
stranmaclaude
andcommitted
fix: update tests for git commands moved to allow
Tests now expect allow instead of ask for git restore, reset, rm, mv, and worktree. git init and git clone remain tested as ask. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ddc5d3e commit 0a820e0

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

tests/test_permissions.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -328,17 +328,21 @@ def test_pr_merge_requires_confirmation(self, settings: dict[str, Any]) -> None:
328328
def test_workflow_run_requires_confirmation(self, settings: dict[str, Any]) -> None:
329329
assert evaluate("Bash(gh workflow run deploy.yml)", settings) == "ask"
330330

331-
def test_git_reset_requires_confirmation(self, settings: dict[str, Any]) -> None:
332-
assert evaluate("Bash(git reset --hard HEAD~1)", settings) == "ask"
333-
assert evaluate("Bash(git reset HEAD file.py)", settings) == "ask"
331+
def test_git_reset_is_allowed(self, settings: dict[str, Any]) -> None:
332+
assert evaluate("Bash(git reset --hard HEAD~1)", settings) == "allow"
333+
assert evaluate("Bash(git reset HEAD file.py)", settings) == "allow"
334334

335-
def test_git_destructive_operations_require_confirmation(self, settings: dict[str, Any]) -> None:
336-
for cmd in ["git init", "git clone https://github.com/repo", "git rm file.py", "git mv a.py b.py"]:
335+
def test_git_init_clone_require_confirmation(self, settings: dict[str, Any]) -> None:
336+
for cmd in ["git init", "git clone https://github.com/repo"]:
337337
assert evaluate(f"Bash({cmd})", settings) == "ask", f"{cmd} should require confirmation"
338338

339-
def test_git_restore_requires_confirmation(self, settings: dict[str, Any]) -> None:
340-
assert evaluate("Bash(git restore file.py)", settings) == "ask"
341-
assert evaluate("Bash(git restore --staged file.py)", settings) == "ask"
339+
def test_git_rm_mv_are_allowed(self, settings: dict[str, Any]) -> None:
340+
for cmd in ["git rm file.py", "git mv a.py b.py"]:
341+
assert evaluate(f"Bash({cmd})", settings) == "allow", f"{cmd} should be allowed"
342+
343+
def test_git_restore_is_allowed(self, settings: dict[str, Any]) -> None:
344+
assert evaluate("Bash(git restore file.py)", settings) == "allow"
345+
assert evaluate("Bash(git restore --staged file.py)", settings) == "allow"
342346

343347
def test_gh_issue_mutations_require_confirmation(self, settings: dict[str, Any]) -> None:
344348
for cmd in [
@@ -359,8 +363,8 @@ def test_gh_workflow_enable_disable_requires_confirmation(self, settings: dict[s
359363
assert evaluate("Bash(gh workflow enable deploy.yml)", settings) == "ask"
360364
assert evaluate("Bash(gh workflow disable deploy.yml)", settings) == "ask"
361365

362-
def test_git_worktree_requires_confirmation(self, settings: dict[str, Any]) -> None:
363-
assert evaluate("Bash(git worktree add ../feature)", settings) == "ask"
366+
def test_git_worktree_is_allowed(self, settings: dict[str, Any]) -> None:
367+
assert evaluate("Bash(git worktree add ../feature)", settings) == "allow"
364368

365369
def test_uv_init_requires_confirmation(self, settings: dict[str, Any]) -> None:
366370
assert evaluate("Bash(uv init my-project)", settings) == "ask"

0 commit comments

Comments
 (0)