diff --git a/tests/test_executable_validation.py b/tests/test_executable_validation.py index 878eaf9..d66fda4 100644 --- a/tests/test_executable_validation.py +++ b/tests/test_executable_validation.py @@ -118,8 +118,9 @@ def test_find_nonexistent_in_path(self): result = find_executable_in_path("definitely_not_a_real_executable_12345") self.assertIsNone(result) + @patch("devhost_cli.executable_validation.is_user_writable") @patch("subprocess.run") - def test_validate_caddy_success(self, mock_run): + def test_validate_caddy_success(self, mock_run, mock_is_writable): """Test Caddy validation with successful version check.""" # Create a fake executable test_file = self.temp_path / "caddy" @@ -127,13 +128,15 @@ def test_validate_caddy_success(self, mock_run): if sys.platform != "win32": test_file.chmod(0o755) + # Mock writability check to return safe (not user-writable) + mock_is_writable.return_value = (False, None) + # Mock subprocess.run to return Caddy version mock_result = MagicMock() mock_result.returncode = 0 mock_result.stdout = "Caddy v2.7.4 h1:abc123" mock_run.return_value = mock_result - # Skip writability check is_valid, error = validate_caddy_executable(str(test_file)) # On Windows, we might not have execute permission