summaryrefslogtreecommitdiff
path: root/src/test/fixtures/login.rs
blob: 839a4123dc5fdbc57fce0e64101b9a8a8d65deed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use crate::{
    app::App,
    clock::DateTime,
    login::{self, Login},
    test::fixtures::user::{propose, propose_name},
};

pub async fn create<P>(app: &App<P>, created_at: &DateTime) -> Login {
    let (name, password) = propose();
    app.users()
        .create(&name, &password, created_at)
        .await
        .expect("should always succeed if the user is actually new")
}

pub fn fictitious() -> Login {
    Login {
        id: login::Id::generate(),
        name: propose_name(),
    }
}