Cleaning
This commit is contained in:
parent
198bff6e4a
commit
6f014ef238
19 changed files with 118 additions and 81 deletions
|
|
@ -119,18 +119,19 @@ async fn sign_up() -> Result<(), Box<dyn Error>> {
|
|||
let mut mock_email_service = utils::mock_email::MockEmailService::new();
|
||||
mock_email_service
|
||||
.expect_send_email()
|
||||
.withf_st(move |email, _title, message| {
|
||||
.withf(|_email_sender, email_receiver, _title, _message| {
|
||||
email_receiver == "president@spaceball.planet"
|
||||
})
|
||||
.times(1)
|
||||
.returning_st(move |_email_sender, _email_receiver, _title, message| {
|
||||
sscanf!(
|
||||
message,
|
||||
"Follow this link to confirm your inscription, http://127.0.0.1:8000{}",
|
||||
*validation_url_clone.borrow_mut()
|
||||
)
|
||||
.unwrap();
|
||||
println!("{}", message);
|
||||
email == "president@spaceball.planet"
|
||||
})
|
||||
.times(1)
|
||||
.returning(|_email, _title, _message| Ok(()));
|
||||
Ok(())
|
||||
});
|
||||
|
||||
let state = utils::common_state_with_email_service(Arc::new(mock_email_service)).await?;
|
||||
let server = TestServer::new(app::make_service(state))?;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ mock! {
|
|||
pub EmailService {}
|
||||
#[async_trait]
|
||||
impl email::EmailServiceTrait for EmailService {
|
||||
async fn send_email(&self, email: &str, title: &str, message: &str)
|
||||
async fn send_email(&self, email_sender: &str, email_receiver: &str, title: &str, message: &str)
|
||||
-> Result<(), email::Error>;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue