1
use chrono::Utc;
2
use uuid::Uuid;
3
use web::model::{LoginUserSchema, RegisterUserSchema, User};
4

            
5
#[test]
6
2
fn test_user_creation() {
7
2
    let user = User {
8
2
        id: Uuid::new_v4(),
9
2
        name: "Test User".to_string(),
10
2
        email: "test@example.com".to_string(),
11
2
        password: "hashedpassword".to_string(),
12
2
        role: "user".to_string(),
13
2
        photo: "".to_string(),
14
2
        verified: false,
15
2
        database: "testdb".to_string(),
16
2
        created_at: Some(Utc::now()),
17
2
        updated_at: Some(Utc::now()),
18
2
    };
19

            
20
2
    assert_eq!(user.name, "Test User");
21
2
    assert_eq!(user.email, "test@example.com");
22
2
    assert_eq!(user.role, "user");
23
2
    assert!(!user.verified);
24
2
}
25

            
26
#[test]
27
2
fn test_login_schema() {
28
2
    let login_data = LoginUserSchema {
29
2
        email: "test@example.com".to_string(),
30
2
        password: "password123".to_string(),
31
2
    };
32

            
33
2
    assert_eq!(login_data.email, "test@example.com");
34
2
    assert_eq!(login_data.password, "password123");
35
2
}
36

            
37
#[test]
38
2
fn test_register_schema() {
39
2
    let register_data = RegisterUserSchema {
40
2
        name: "John Doe".to_string(),
41
2
        email: "john@example.com".to_string(),
42
2
        password: "securepassword".to_string(),
43
2
    };
44

            
45
2
    assert_eq!(register_data.name, "John Doe");
46
2
    assert_eq!(register_data.email, "john@example.com");
47
2
    assert_eq!(register_data.password, "securepassword");
48
2
}