-
-
Notifications
You must be signed in to change notification settings - Fork 288
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add easy selectors to html testing * add easy selectors to html testing * fmt * fix worker testing import * update docs
- Loading branch information
1 parent
a103c1c
commit 7292558
Showing
38 changed files
with
941 additions
and
398 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
use demo_app::{ | ||
app::App, | ||
models::{roles, sea_orm_active_enums, users, users::RegisterParams, users_roles}, | ||
models::{roles, sea_orm_active_enums, users, users::RegisterParams}, | ||
}; | ||
use loco_rs::{prelude::*, testing}; | ||
use sea_orm::DatabaseConnection; | ||
use loco_rs::testing::prelude::*; | ||
use serial_test::serial; | ||
|
||
macro_rules! configure_insta { | ||
|
@@ -20,17 +19,17 @@ macro_rules! configure_insta { | |
async fn can_add_user_to_admin() { | ||
configure_insta!(); | ||
|
||
let boot = testing::boot_test::<App>().await.unwrap(); | ||
let new_user: Result<users::Model, ModelError> = users::Model::create_with_password( | ||
let boot = boot_test::<App>().await.unwrap(); | ||
let new_user = users::Model::create_with_password( | ||
&boot.app_context.db, | ||
&RegisterParams { | ||
email: "[email protected]".to_string(), | ||
password: "1234".to_string(), | ||
name: "framework".to_string(), | ||
}, | ||
) | ||
.await; | ||
let new_user = new_user.unwrap(); | ||
.await | ||
.unwrap(); | ||
let role = roles::Model::add_user_to_admin_role(&boot.app_context.db, &new_user) | ||
.await | ||
.unwrap(); | ||
|
@@ -42,17 +41,17 @@ async fn can_add_user_to_admin() { | |
async fn can_add_user_to_user() { | ||
configure_insta!(); | ||
|
||
let boot = testing::boot_test::<App>().await.unwrap(); | ||
let new_user: Result<users::Model, ModelError> = users::Model::create_with_password( | ||
let boot = boot_test::<App>().await.unwrap(); | ||
let new_user = users::Model::create_with_password( | ||
&boot.app_context.db, | ||
&RegisterParams { | ||
email: "[email protected]".to_string(), | ||
password: "1234".to_string(), | ||
name: "framework".to_string(), | ||
}, | ||
) | ||
.await; | ||
let new_user = new_user.unwrap(); | ||
.await | ||
.unwrap(); | ||
let role = roles::Model::add_user_to_user_role(&boot.app_context.db, &new_user) | ||
.await | ||
.unwrap(); | ||
|
@@ -64,17 +63,17 @@ async fn can_add_user_to_user() { | |
async fn can_convert_between_user_and_admin() { | ||
configure_insta!(); | ||
|
||
let boot = testing::boot_test::<App>().await.unwrap(); | ||
let new_user: Result<users::Model, ModelError> = users::Model::create_with_password( | ||
let boot = boot_test::<App>().await.unwrap(); | ||
let new_user = users::Model::create_with_password( | ||
&boot.app_context.db, | ||
&RegisterParams { | ||
email: "[email protected]".to_string(), | ||
password: "1234".to_string(), | ||
name: "framework".to_string(), | ||
}, | ||
) | ||
.await; | ||
let new_user = new_user.unwrap(); | ||
.await | ||
.unwrap(); | ||
let role = roles::Model::add_user_to_user_role(&boot.app_context.db, &new_user) | ||
.await | ||
.unwrap(); | ||
|
@@ -94,17 +93,17 @@ async fn can_convert_between_user_and_admin() { | |
async fn can_find_user_roles() { | ||
configure_insta!(); | ||
|
||
let boot = testing::boot_test::<App>().await.unwrap(); | ||
let new_user: Result<users::Model, ModelError> = users::Model::create_with_password( | ||
let boot = boot_test::<App>().await.unwrap(); | ||
let new_user = users::Model::create_with_password( | ||
&boot.app_context.db, | ||
&RegisterParams { | ||
email: "[email protected]".to_string(), | ||
password: "1234".to_string(), | ||
name: "framework".to_string(), | ||
}, | ||
) | ||
.await; | ||
let new_user = new_user.unwrap(); | ||
.await | ||
.unwrap(); | ||
let role = roles::Model::add_user_to_user_role(&boot.app_context.db, &new_user) | ||
.await | ||
.unwrap(); | ||
|
@@ -131,17 +130,17 @@ async fn can_find_user_roles() { | |
async fn cannot_find_user_before_conversation() { | ||
configure_insta!(); | ||
|
||
let boot = testing::boot_test::<App>().await.unwrap(); | ||
let new_user: Result<users::Model, ModelError> = users::Model::create_with_password( | ||
let boot = boot_test::<App>().await.unwrap(); | ||
let new_user = users::Model::create_with_password( | ||
&boot.app_context.db, | ||
&RegisterParams { | ||
email: "[email protected]".to_string(), | ||
password: "1234".to_string(), | ||
name: "framework".to_string(), | ||
}, | ||
) | ||
.await; | ||
let new_user = new_user.unwrap(); | ||
.await | ||
.unwrap(); | ||
let role = roles::Model::find_by_user(&boot.app_context.db, &new_user).await; | ||
assert!(role.is_err()); | ||
} |
Oops, something went wrong.