pub struct FakePrincipal { /* private fields */ }Expand description
Builder for a fake Principal.
Principal carries no scopes field; the .scopes() method is provided
for ergonomic parity with higher-level test fixtures but has no effect on
the built Principal value.
§Quick start
use api_bones::audit::PrincipalKind;
use api_bones_test::builders::FakePrincipal;
let p = FakePrincipal::user(uuid::Uuid::new_v4()).build();
assert!(matches!(p.kind, PrincipalKind::User));Implementations§
Source§impl FakePrincipal
impl FakePrincipal
pub fn user(id: Uuid) -> Self
pub fn agent(id: Uuid) -> Self
pub fn org_path(self, path: Vec<OrgId>) -> Self
Sourcepub fn scopes(self, _scopes: &[&str]) -> Self
pub fn scopes(self, _scopes: &[&str]) -> Self
Stored for ergonomic parity; Principal has no scopes field so these
are not propagated to the built value.
pub fn build(self) -> Principal
Auto Trait Implementations§
impl Freeze for FakePrincipal
impl RefUnwindSafe for FakePrincipal
impl Send for FakePrincipal
impl Sync for FakePrincipal
impl Unpin for FakePrincipal
impl UnsafeUnpin for FakePrincipal
impl UnwindSafe for FakePrincipal
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more