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

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

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

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

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

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

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