pub struct FakeOrgContext;Expand description
Convenience shortcut for building a fake OrganizationContext.
Derives org_id from the last entry in principal.org_path (the
acting / leaf org, per the Brefwiz [root, …, leaf] convention) or
generates a fresh one when org_path is empty.
§Quick start
use uuid::Uuid;
use api_bones_test::builders::{FakePrincipal, FakeOrgContext};
use api_bones::org_id::OrgId;
let leaf = OrgId::generate();
let p = FakePrincipal::user(Uuid::new_v4())
.org_path(vec![OrgId::generate(), leaf])
.build();
let ctx = FakeOrgContext::for_principal(&p);
assert_eq!(ctx.org_id, leaf);Implementations§
Source§impl FakeOrgContext
impl FakeOrgContext
pub fn for_principal(principal: &Principal) -> OrganizationContext
Auto Trait Implementations§
impl Freeze for FakeOrgContext
impl RefUnwindSafe for FakeOrgContext
impl Send for FakeOrgContext
impl Sync for FakeOrgContext
impl Unpin for FakeOrgContext
impl UnsafeUnpin for FakeOrgContext
impl UnwindSafe for FakeOrgContext
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