Wrap a request with a user `Principal` so handler scope guards treat the test caller as a CLI user. Most handler tests exercise user-facing behavior and should not trip sandbox equality checks.
(mut request: Request<T>)
| 3918 | /// the test caller as a CLI user. Most handler tests exercise |
| 3919 | /// user-facing behavior and should not trip sandbox equality checks. |
| 3920 | fn with_user<T>(mut request: Request<T>) -> Request<T> { |
| 3921 | request |
| 3922 | .extensions_mut() |
| 3923 | .insert(Principal::User(UserPrincipal { |
| 3924 | identity: Identity { |
| 3925 | subject: "test-user".to_string(), |
| 3926 | display_name: None, |
| 3927 | roles: vec![], |
| 3928 | scopes: vec![], |
| 3929 | provider: IdentityProvider::Oidc, |
| 3930 | }, |
| 3931 | })); |
| 3932 | request |
| 3933 | } |
| 3934 | |
| 3935 | /// Wrap a request with a sandbox `Principal` bound to `sandbox_id`. |
| 3936 | /// Use for tests that exercise sandbox-caller code paths. |
no outgoing calls
no test coverage detected