aboutsummaryrefslogtreecommitdiff
path: root/crates/secd/tests/authn_integration.rs
blob: d823d5a5033197fd28bdf57d8547546df38bfe39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#[cfg(test)]
mod test {
    use std::error::Error;

    use secd::{AuthEmail, AuthStore, Secd};

    #[tokio::test]
    async fn email_authentication_int() -> Result<(), Box<dyn Error>> {
        let secd = Secd::init(AuthStore::Sqlite, None, AuthEmail::LocalStub, None, None).await?;
        let v_id = secd.create_validation_request_email("b@g.com").await?;

        // TODO: in memory mailbox backed by sqlite which just throws them in temporarily...
        // and then I can grab it?

        // Things to test
        // 1. after exchanging the session, I cannot get it again
        // 1. a validation can only be used once
        // 1. a session can be used to retrieve identity information
        assert_eq!(1, 2);
        Ok(())
    }

    #[tokio::test]
    async fn oauth_authentication_int() -> Result<(), Box<dyn Error>> {
        let secd = Secd::init(AuthStore::Sqlite, None, AuthEmail::LocalStub, None, None).await?;

        // Things to test
        // 1. after exchanging the session, I cannot get it again
        // 1. a validation can only be used once
        // 1. a session can be used to retrieve identity information
        // 1. an oauth session links with an existing emails session
        assert_eq!(1, 2);
        Ok(())
    }
}