- Implemented tests for creating, retrieving, updating, and deleting mentors in `mentor_repository_test.rs`. - Added tests for user authentication, including successful login, invalid email formats, and inactive users in `auth_login_tests.rs`. - Created a mock test environment setup in `mock_test.rs` to facilitate database operations during tests. - Updated module structure to include new test files for mentors and authentication. - Ensured cleanup of the database after tests to maintain isolation and prevent side effects.
22 lines
442 B
Rust
22 lines
442 B
Rust
use std::fmt;
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
pub enum RolesEnum {
|
|
Admin,
|
|
User,
|
|
Staff,
|
|
Mentor, // Added Mentor role
|
|
}
|
|
|
|
impl fmt::Display for RolesEnum {
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
let roles_str = match self {
|
|
RolesEnum::Admin => "Admin",
|
|
RolesEnum::User => "User",
|
|
RolesEnum::Staff => "Staff",
|
|
RolesEnum::Mentor => "Mentor", // Added Mentor role
|
|
};
|
|
write!(f, "{roles_str}")
|
|
}
|
|
}
|