Update dependencies and implement email service integration
- Refactor app and email modules to include email service - Add tests for user sign-up and mock email service
This commit is contained in:
parent
f31167dd95
commit
3626f8a11b
10 changed files with 291 additions and 151 deletions
|
|
@ -5,6 +5,7 @@ use cookie::Cookie;
|
|||
use scraper::{ElementRef, Html, Selector};
|
||||
|
||||
use recipes::app;
|
||||
use serde::Serialize;
|
||||
|
||||
mod utils;
|
||||
|
||||
|
|
@ -92,3 +93,36 @@ async fn user_edit() -> Result<(), Box<dyn Error>> {
|
|||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(Serialize, Debug)]
|
||||
pub struct SignUpFormData {
|
||||
email: String,
|
||||
password_1: String,
|
||||
password_2: String,
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn sign_up() -> Result<(), Box<dyn Error>> {
|
||||
// Arrange.
|
||||
let state = utils::common_state().await?;
|
||||
let server = TestServer::new(app::make_service(state))?;
|
||||
|
||||
// Act.
|
||||
let response = server
|
||||
.post("/signup")
|
||||
.form(&SignUpFormData {
|
||||
email: "president@spaceball.planet".into(),
|
||||
password_1: "12345678".into(),
|
||||
password_2: "12345678".into(),
|
||||
})
|
||||
.await;
|
||||
|
||||
// Assert.
|
||||
response.assert_status_ok();
|
||||
|
||||
let document = Html::parse_document(&response.text());
|
||||
assert_eq!(document.errors.len(), 0);
|
||||
dbg!(response);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue