ci: fmt
This commit is contained in:
parent
d834637d2f
commit
d9bf34ec59
|
|
@ -6,7 +6,6 @@ use actix_web::{FromRequest, HttpRequest};
|
||||||
use secrecy::{ExposeSecret, Secret};
|
use secrecy::{ExposeSecret, Secret};
|
||||||
use std::future::{ready, Ready};
|
use std::future::{ready, Ready};
|
||||||
|
|
||||||
|
|
||||||
pub struct SessionToken(Session);
|
pub struct SessionToken(Session);
|
||||||
|
|
||||||
impl SessionToken {
|
impl SessionToken {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
use config::{Config as InnerConfig, FileFormat};
|
use config::{Config as InnerConfig, FileFormat};
|
||||||
|
use secrecy::Secret;
|
||||||
use serde_aux::field_attributes::deserialize_number_from_string;
|
use serde_aux::field_attributes::deserialize_number_from_string;
|
||||||
use sqlx::postgres::{PgConnectOptions, PgSslMode};
|
use sqlx::postgres::{PgConnectOptions, PgSslMode};
|
||||||
use std::convert::{TryFrom, TryInto};
|
use std::convert::{TryFrom, TryInto};
|
||||||
use secrecy::Secret;
|
|
||||||
|
|
||||||
#[derive(serde::Deserialize, Clone, Debug)]
|
#[derive(serde::Deserialize, Clone, Debug)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,10 @@ async fn register_with_invalid_password() {
|
||||||
let server = spawn_server().await;
|
let server = spawn_server().await;
|
||||||
let http_resp = server.register("user 1", "fake@appflowy.io", "123").await;
|
let http_resp = server.register("user 1", "fake@appflowy.io", "123").await;
|
||||||
assert_eq!(http_resp.status(), StatusCode::BAD_REQUEST);
|
assert_eq!(http_resp.status(), StatusCode::BAD_REQUEST);
|
||||||
assert_eq!(error_msg_from_resp(http_resp).await, InputParamsError::InvalidPassword.to_string());
|
assert_eq!(
|
||||||
|
error_msg_from_resp(http_resp).await,
|
||||||
|
InputParamsError::InvalidPassword.to_string()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
|
@ -31,16 +34,20 @@ async fn register_with_invalid_name() {
|
||||||
.register(&name, "fake@appflowy.io", "FakePassword!123")
|
.register(&name, "fake@appflowy.io", "FakePassword!123")
|
||||||
.await;
|
.await;
|
||||||
assert_eq!(http_resp.status(), StatusCode::BAD_REQUEST);
|
assert_eq!(http_resp.status(), StatusCode::BAD_REQUEST);
|
||||||
assert_eq!(error_msg_from_resp(http_resp).await, InputParamsError::InvalidName(name).to_string());
|
assert_eq!(
|
||||||
|
error_msg_from_resp(http_resp).await,
|
||||||
|
InputParamsError::InvalidName(name).to_string()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn register_with_invalid_email() {
|
async fn register_with_invalid_email() {
|
||||||
let server = spawn_server().await;
|
let server = spawn_server().await;
|
||||||
let email = "appflowy.io".to_string();
|
let email = "appflowy.io".to_string();
|
||||||
let http_resp = server
|
let http_resp = server.register("me", &email, "FakePassword!123").await;
|
||||||
.register("me", &email, "FakePassword!123")
|
|
||||||
.await;
|
|
||||||
assert_eq!(http_resp.status(), StatusCode::BAD_REQUEST);
|
assert_eq!(http_resp.status(), StatusCode::BAD_REQUEST);
|
||||||
assert_eq!(error_msg_from_resp(http_resp).await, InputParamsError::InvalidEmail(email).to_string());
|
assert_eq!(
|
||||||
|
error_msg_from_resp(http_resp).await,
|
||||||
|
InputParamsError::InvalidEmail(email).to_string()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue