pub struct AuthTestHelpers;Expand description
Authorization test helpers
Implementations§
Source§impl AuthTestHelpers
impl AuthTestHelpers
Sourcepub fn user_with_jwt() -> TestResult<(User, String)>
pub fn user_with_jwt() -> TestResult<(User, String)>
Create a test user with JWT token
Sourcepub fn admin_with_jwt() -> TestResult<(User, String)>
pub fn admin_with_jwt() -> TestResult<(User, String)>
Create an admin user with JWT token
Sourcepub fn user_with_roles_and_jwt(roles: Vec<String>) -> TestResult<(User, String)>
pub fn user_with_roles_and_jwt(roles: Vec<String>) -> TestResult<(User, String)>
Create a user with specific roles and JWT token
Sourcepub fn user_with_permissions_and_jwt(
permissions: Vec<String>,
) -> TestResult<(User, String)>
pub fn user_with_permissions_and_jwt( permissions: Vec<String>, ) -> TestResult<(User, String)>
Create a user with specific permissions and JWT token
Sourcepub fn assert_token_has_roles(
token: &str,
expected_roles: &[String],
) -> TestResult<()>
pub fn assert_token_has_roles( token: &str, expected_roles: &[String], ) -> TestResult<()>
Validate that a token has specific roles
Sourcepub fn assert_token_has_permissions(
token: &str,
expected_permissions: &[String],
) -> TestResult<()>
pub fn assert_token_has_permissions( token: &str, expected_permissions: &[String], ) -> TestResult<()>
Validate that a token has specific permissions
Auto Trait Implementations§
impl Freeze for AuthTestHelpers
impl RefUnwindSafe for AuthTestHelpers
impl Send for AuthTestHelpers
impl Sync for AuthTestHelpers
impl Unpin for AuthTestHelpers
impl UnwindSafe for AuthTestHelpers
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more