mirror of
https://github.com/chatmail/core.git
synced 2026-05-21 07:46:31 +03:00
Move OAuth 2 stress tests to oauth2 module
This commit is contained in:
@@ -355,6 +355,8 @@ fn normalize_addr(addr: &str) -> &str {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
use crate::test_utils::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_normalize_addr() {
|
fn test_normalize_addr() {
|
||||||
assert_eq!(normalize_addr(" hello@mail.de "), "hello@mail.de");
|
assert_eq!(normalize_addr(" hello@mail.de "), "hello@mail.de");
|
||||||
@@ -384,4 +386,24 @@ mod tests {
|
|||||||
|
|
||||||
assert_eq!(Oauth2::from_address("hello@web.de"), None);
|
assert_eq!(Oauth2::from_address("hello@web.de"), None);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_dc_get_oauth2_addr() {
|
||||||
|
let ctx = dummy_context();
|
||||||
|
let addr = "dignifiedquire@gmail.com";
|
||||||
|
let code = "fail";
|
||||||
|
let res = dc_get_oauth2_addr(&ctx.ctx, addr, code);
|
||||||
|
// this should fail as it is an invalid password
|
||||||
|
assert_eq!(res, None);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_dc_get_oauth2_token() {
|
||||||
|
let ctx = dummy_context();
|
||||||
|
let addr = "dignifiedquire@gmail.com";
|
||||||
|
let code = "fail";
|
||||||
|
let res = dc_get_oauth2_access_token(&ctx.ctx, addr, code, false);
|
||||||
|
// this should fail as it is an invalid password
|
||||||
|
assert_eq!(res, None);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -233,26 +233,6 @@ fn test_dc_get_oauth2_url() {
|
|||||||
assert_eq!(res, Some("https://accounts.google.com/o/oauth2/auth?client_id=959970109878%2D4mvtgf6feshskf7695nfln6002mom908%2Eapps%2Egoogleusercontent%2Ecom&redirect_uri=chat%2Edelta%3A%2Fcom%2Eb44t%2Emessenger&response_type=code&scope=https%3A%2F%2Fmail.google.com%2F%20email&access_type=offline".into()));
|
assert_eq!(res, Some("https://accounts.google.com/o/oauth2/auth?client_id=959970109878%2D4mvtgf6feshskf7695nfln6002mom908%2Eapps%2Egoogleusercontent%2Ecom&redirect_uri=chat%2Edelta%3A%2Fcom%2Eb44t%2Emessenger&response_type=code&scope=https%3A%2F%2Fmail.google.com%2F%20email&access_type=offline".into()));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_dc_get_oauth2_addr() {
|
|
||||||
let ctx = create_test_context();
|
|
||||||
let addr = "dignifiedquire@gmail.com";
|
|
||||||
let code = "fail";
|
|
||||||
let res = dc_get_oauth2_addr(&ctx.ctx, addr, code);
|
|
||||||
// this should fail as it is an invalid password
|
|
||||||
assert_eq!(res, None);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_dc_get_oauth2_token() {
|
|
||||||
let ctx = create_test_context();
|
|
||||||
let addr = "dignifiedquire@gmail.com";
|
|
||||||
let code = "fail";
|
|
||||||
let res = dc_get_oauth2_access_token(&ctx.ctx, addr, code, false);
|
|
||||||
// this should fail as it is an invalid password
|
|
||||||
assert_eq!(res, None);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_stress_tests() {
|
fn test_stress_tests() {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|||||||
Reference in New Issue
Block a user