Fixup
This commit is contained in:
parent
668fb64224
commit
620972b724
@ -17,7 +17,7 @@ use sea_orm::DatabaseConnection;
|
|||||||
))]
|
))]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
let ctx = TestContext::new("bakery_chain_schema_crud_tests").await;
|
let ctx = TestContext::new("bakery_chain_schema_crud_tests").await;
|
||||||
create_tables(&ctx.db).await;
|
create_tables(&ctx.db).await.unwrap();
|
||||||
create_entities(&ctx.db).await;
|
create_entities(&ctx.db).await;
|
||||||
ctx.delete().await;
|
ctx.delete().await;
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ use sea_orm::{entity::prelude::*, DatabaseConnection, IntoActiveModel, Set};
|
|||||||
))]
|
))]
|
||||||
async fn main() -> Result<(), DbErr> {
|
async fn main() -> Result<(), DbErr> {
|
||||||
let ctx = TestContext::new("features_parallel_tests").await;
|
let ctx = TestContext::new("features_parallel_tests").await;
|
||||||
create_tables(&ctx.db).await;
|
create_tables(&ctx.db).await?;
|
||||||
crud_in_parallel(&ctx.db).await?;
|
crud_in_parallel(&ctx.db).await?;
|
||||||
ctx.delete().await;
|
ctx.delete().await;
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ pub use sea_orm::{ConnectionTrait, QueryFilter};
|
|||||||
))]
|
))]
|
||||||
pub async fn find_one_with_no_result() {
|
pub async fn find_one_with_no_result() {
|
||||||
let ctx = TestContext::new("find_one_with_no_result").await;
|
let ctx = TestContext::new("find_one_with_no_result").await;
|
||||||
create_tables(&ctx.db).await;
|
create_tables(&ctx.db).await.unwrap();
|
||||||
|
|
||||||
let bakery = Bakery::find().one(&ctx.db).await.unwrap();
|
let bakery = Bakery::find().one(&ctx.db).await.unwrap();
|
||||||
assert_eq!(bakery, None);
|
assert_eq!(bakery, None);
|
||||||
@ -30,7 +30,7 @@ pub async fn find_one_with_no_result() {
|
|||||||
))]
|
))]
|
||||||
pub async fn find_one_with_result() {
|
pub async fn find_one_with_result() {
|
||||||
let ctx = TestContext::new("find_one_with_result").await;
|
let ctx = TestContext::new("find_one_with_result").await;
|
||||||
create_tables(&ctx.db).await;
|
create_tables(&ctx.db).await.unwrap();
|
||||||
|
|
||||||
let bakery = bakery::ActiveModel {
|
let bakery = bakery::ActiveModel {
|
||||||
name: Set("SeaSide Bakery".to_owned()),
|
name: Set("SeaSide Bakery".to_owned()),
|
||||||
@ -56,7 +56,7 @@ pub async fn find_one_with_result() {
|
|||||||
))]
|
))]
|
||||||
pub async fn find_by_id_with_no_result() {
|
pub async fn find_by_id_with_no_result() {
|
||||||
let ctx = TestContext::new("find_by_id_with_no_result").await;
|
let ctx = TestContext::new("find_by_id_with_no_result").await;
|
||||||
create_tables(&ctx.db).await;
|
create_tables(&ctx.db).await.unwrap();
|
||||||
|
|
||||||
let bakery = Bakery::find_by_id(999).one(&ctx.db).await.unwrap();
|
let bakery = Bakery::find_by_id(999).one(&ctx.db).await.unwrap();
|
||||||
assert_eq!(bakery, None);
|
assert_eq!(bakery, None);
|
||||||
@ -72,7 +72,7 @@ pub async fn find_by_id_with_no_result() {
|
|||||||
))]
|
))]
|
||||||
pub async fn find_by_id_with_result() {
|
pub async fn find_by_id_with_result() {
|
||||||
let ctx = TestContext::new("find_by_id_with_result").await;
|
let ctx = TestContext::new("find_by_id_with_result").await;
|
||||||
create_tables(&ctx.db).await;
|
create_tables(&ctx.db).await.unwrap();
|
||||||
|
|
||||||
let bakery = bakery::ActiveModel {
|
let bakery = bakery::ActiveModel {
|
||||||
name: Set("SeaSide Bakery".to_owned()),
|
name: Set("SeaSide Bakery".to_owned()),
|
||||||
@ -102,7 +102,7 @@ pub async fn find_by_id_with_result() {
|
|||||||
))]
|
))]
|
||||||
pub async fn find_all_with_no_result() {
|
pub async fn find_all_with_no_result() {
|
||||||
let ctx = TestContext::new("find_all_with_no_result").await;
|
let ctx = TestContext::new("find_all_with_no_result").await;
|
||||||
create_tables(&ctx.db).await;
|
create_tables(&ctx.db).await.unwrap();
|
||||||
|
|
||||||
let bakeries = Bakery::find().all(&ctx.db).await.unwrap();
|
let bakeries = Bakery::find().all(&ctx.db).await.unwrap();
|
||||||
assert_eq!(bakeries.len(), 0);
|
assert_eq!(bakeries.len(), 0);
|
||||||
@ -118,7 +118,7 @@ pub async fn find_all_with_no_result() {
|
|||||||
))]
|
))]
|
||||||
pub async fn find_all_with_result() {
|
pub async fn find_all_with_result() {
|
||||||
let ctx = TestContext::new("find_all_with_result").await;
|
let ctx = TestContext::new("find_all_with_result").await;
|
||||||
create_tables(&ctx.db).await;
|
create_tables(&ctx.db).await.unwrap();
|
||||||
|
|
||||||
let _ = bakery::ActiveModel {
|
let _ = bakery::ActiveModel {
|
||||||
name: Set("SeaSide Bakery".to_owned()),
|
name: Set("SeaSide Bakery".to_owned()),
|
||||||
@ -153,7 +153,7 @@ pub async fn find_all_with_result() {
|
|||||||
))]
|
))]
|
||||||
pub async fn find_all_filter_no_result() {
|
pub async fn find_all_filter_no_result() {
|
||||||
let ctx = TestContext::new("find_all_filter_no_result").await;
|
let ctx = TestContext::new("find_all_filter_no_result").await;
|
||||||
create_tables(&ctx.db).await;
|
create_tables(&ctx.db).await.unwrap();
|
||||||
|
|
||||||
let _ = bakery::ActiveModel {
|
let _ = bakery::ActiveModel {
|
||||||
name: Set("SeaSide Bakery".to_owned()),
|
name: Set("SeaSide Bakery".to_owned()),
|
||||||
@ -192,7 +192,7 @@ pub async fn find_all_filter_no_result() {
|
|||||||
))]
|
))]
|
||||||
pub async fn find_all_filter_with_results() {
|
pub async fn find_all_filter_with_results() {
|
||||||
let ctx = TestContext::new("find_all_filter_with_results").await;
|
let ctx = TestContext::new("find_all_filter_with_results").await;
|
||||||
create_tables(&ctx.db).await;
|
create_tables(&ctx.db).await.unwrap();
|
||||||
|
|
||||||
let _ = bakery::ActiveModel {
|
let _ = bakery::ActiveModel {
|
||||||
name: Set("SeaSide Bakery".to_owned()),
|
name: Set("SeaSide Bakery".to_owned()),
|
||||||
|
@ -17,7 +17,7 @@ pub use uuid::Uuid;
|
|||||||
))]
|
))]
|
||||||
pub async fn left_join() {
|
pub async fn left_join() {
|
||||||
let ctx = TestContext::new("test_left_join").await;
|
let ctx = TestContext::new("test_left_join").await;
|
||||||
create_tables(&ctx.db).await;
|
create_tables(&ctx.db).await.unwrap();
|
||||||
|
|
||||||
let bakery = bakery::ActiveModel {
|
let bakery = bakery::ActiveModel {
|
||||||
name: Set("SeaSide Bakery".to_owned()),
|
name: Set("SeaSide Bakery".to_owned()),
|
||||||
@ -95,7 +95,7 @@ pub async fn left_join() {
|
|||||||
#[cfg(any(feature = "sqlx-mysql", feature = "sqlx-postgres"))]
|
#[cfg(any(feature = "sqlx-mysql", feature = "sqlx-postgres"))]
|
||||||
pub async fn right_join() {
|
pub async fn right_join() {
|
||||||
let ctx = TestContext::new("test_right_join").await;
|
let ctx = TestContext::new("test_right_join").await;
|
||||||
create_tables(&ctx.db).await;
|
create_tables(&ctx.db).await.unwrap();
|
||||||
|
|
||||||
let bakery = bakery::ActiveModel {
|
let bakery = bakery::ActiveModel {
|
||||||
name: Set("SeaSide Bakery".to_owned()),
|
name: Set("SeaSide Bakery".to_owned()),
|
||||||
@ -181,7 +181,7 @@ pub async fn right_join() {
|
|||||||
))]
|
))]
|
||||||
pub async fn inner_join() {
|
pub async fn inner_join() {
|
||||||
let ctx = TestContext::new("test_inner_join").await;
|
let ctx = TestContext::new("test_inner_join").await;
|
||||||
create_tables(&ctx.db).await;
|
create_tables(&ctx.db).await.unwrap();
|
||||||
|
|
||||||
let bakery = bakery::ActiveModel {
|
let bakery = bakery::ActiveModel {
|
||||||
name: Set("SeaSide Bakery".to_owned()),
|
name: Set("SeaSide Bakery".to_owned()),
|
||||||
@ -271,7 +271,7 @@ pub async fn inner_join() {
|
|||||||
))]
|
))]
|
||||||
pub async fn group_by() {
|
pub async fn group_by() {
|
||||||
let ctx = TestContext::new("test_group_by").await;
|
let ctx = TestContext::new("test_group_by").await;
|
||||||
create_tables(&ctx.db).await;
|
create_tables(&ctx.db).await.unwrap();
|
||||||
|
|
||||||
let bakery = bakery::ActiveModel {
|
let bakery = bakery::ActiveModel {
|
||||||
name: Set("SeaSide Bakery".to_owned()),
|
name: Set("SeaSide Bakery".to_owned()),
|
||||||
@ -377,7 +377,7 @@ pub async fn group_by() {
|
|||||||
pub async fn having() {
|
pub async fn having() {
|
||||||
// customers with orders with total equal to $90
|
// customers with orders with total equal to $90
|
||||||
let ctx = TestContext::new("test_having").await;
|
let ctx = TestContext::new("test_having").await;
|
||||||
create_tables(&ctx.db).await;
|
create_tables(&ctx.db).await.unwrap();
|
||||||
|
|
||||||
let bakery = bakery::ActiveModel {
|
let bakery = bakery::ActiveModel {
|
||||||
name: Set("SeaSide Bakery".to_owned()),
|
name: Set("SeaSide Bakery".to_owned()),
|
||||||
@ -492,7 +492,7 @@ pub async fn linked() -> Result<(), DbErr> {
|
|||||||
use sea_orm::{SelectA, SelectB};
|
use sea_orm::{SelectA, SelectB};
|
||||||
|
|
||||||
let ctx = TestContext::new("test_linked").await;
|
let ctx = TestContext::new("test_linked").await;
|
||||||
create_tables(&ctx.db).await;
|
create_tables(&ctx.db).await?;
|
||||||
|
|
||||||
// SeaSide Bakery
|
// SeaSide Bakery
|
||||||
let seaside_bakery = bakery::ActiveModel {
|
let seaside_bakery = bakery::ActiveModel {
|
||||||
|
@ -14,8 +14,8 @@ pub use uuid::Uuid;
|
|||||||
pub async fn test_multiple_operations() {
|
pub async fn test_multiple_operations() {
|
||||||
let ctx = TestContext::new("multiple_sequential_operations").await;
|
let ctx = TestContext::new("multiple_sequential_operations").await;
|
||||||
|
|
||||||
create_tables(&ctx.db).await;
|
create_tables(&ctx.db).await.unwrap();
|
||||||
init_setup(&ctx.db).await;
|
seed_data(&ctx.db).await;
|
||||||
let baker_least_sales = find_baker_least_sales(&ctx.db).await.unwrap();
|
let baker_least_sales = find_baker_least_sales(&ctx.db).await.unwrap();
|
||||||
assert_eq!(baker_least_sales.name, "Baker 2");
|
assert_eq!(baker_least_sales.name, "Baker 2");
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ pub async fn test_multiple_operations() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(feature = "sqlx-mysql", feature = "sqlx-postgres"))]
|
#[cfg(any(feature = "sqlx-mysql", feature = "sqlx-postgres"))]
|
||||||
async fn init_setup(db: &DatabaseConnection) {
|
async fn seed_data(db: &DatabaseConnection) {
|
||||||
let bakery = bakery::ActiveModel {
|
let bakery = bakery::ActiveModel {
|
||||||
name: Set("SeaSide Bakery".to_owned()),
|
name: Set("SeaSide Bakery".to_owned()),
|
||||||
profit_margin: Set(10.4),
|
profit_margin: Set(10.4),
|
||||||
|
@ -14,7 +14,7 @@ pub async fn stream() -> Result<(), DbErr> {
|
|||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
|
|
||||||
let ctx = TestContext::new("stream").await;
|
let ctx = TestContext::new("stream").await;
|
||||||
create_tables(&ctx.db).await;
|
create_tables(&ctx.db).await?;
|
||||||
|
|
||||||
let bakery = bakery::ActiveModel {
|
let bakery = bakery::ActiveModel {
|
||||||
name: Set("SeaSide Bakery".to_owned()),
|
name: Set("SeaSide Bakery".to_owned()),
|
||||||
|
@ -12,7 +12,7 @@ use sea_orm::{entity::prelude::*, entity::*, DatabaseConnection};
|
|||||||
))]
|
))]
|
||||||
async fn main() -> Result<(), DbErr> {
|
async fn main() -> Result<(), DbErr> {
|
||||||
let ctx = TestContext::new("features_schema_string_primary_key_tests").await;
|
let ctx = TestContext::new("features_schema_string_primary_key_tests").await;
|
||||||
create_tables(&ctx.db).await;
|
create_tables(&ctx.db).await?;
|
||||||
create_and_update_repository(&ctx.db).await?;
|
create_and_update_repository(&ctx.db).await?;
|
||||||
insert_repository(&ctx.db).await?;
|
insert_repository(&ctx.db).await?;
|
||||||
ctx.delete().await;
|
ctx.delete().await;
|
||||||
|
@ -7,7 +7,7 @@ use sea_orm::{entity::prelude::*, DatabaseConnection, IntoActiveModel};
|
|||||||
#[cfg(feature = "sqlx-postgres")]
|
#[cfg(feature = "sqlx-postgres")]
|
||||||
async fn main() -> Result<(), DbErr> {
|
async fn main() -> Result<(), DbErr> {
|
||||||
let ctx = TestContext::new("bakery_chain_schema_timestamp_tests").await;
|
let ctx = TestContext::new("bakery_chain_schema_timestamp_tests").await;
|
||||||
create_tables(&ctx.db).await;
|
create_tables(&ctx.db).await?;
|
||||||
create_applog(&ctx.db).await?;
|
create_applog(&ctx.db).await?;
|
||||||
ctx.delete().await;
|
ctx.delete().await;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
pub mod common;
|
pub mod common;
|
||||||
|
|
||||||
pub use common::{features::*, setup::*, TestContext};
|
pub use common::{bakery_chain::*, setup::*, TestContext};
|
||||||
pub use sea_orm::entity::*;
|
pub use sea_orm::entity::*;
|
||||||
pub use sea_orm::{ConnectionTrait, QueryFilter};
|
pub use sea_orm::{ConnectionTrait, QueryFilter};
|
||||||
use sea_orm::{DatabaseTransaction, DbErr};
|
use sea_orm::{DatabaseTransaction, DbErr};
|
||||||
@ -13,7 +13,7 @@ use sea_orm::{DatabaseTransaction, DbErr};
|
|||||||
))]
|
))]
|
||||||
pub async fn transaction() {
|
pub async fn transaction() {
|
||||||
let ctx = TestContext::new("transaction_test").await;
|
let ctx = TestContext::new("transaction_test").await;
|
||||||
create_tables(&ctx.db).await;
|
create_tables(&ctx.db).await.unwrap();
|
||||||
|
|
||||||
ctx.db
|
ctx.db
|
||||||
.transaction::<_, _, DbErr>(|txn| {
|
.transaction::<_, _, DbErr>(|txn| {
|
||||||
@ -58,6 +58,8 @@ pub async fn transaction() {
|
|||||||
))]
|
))]
|
||||||
pub async fn transaction_with_reference() {
|
pub async fn transaction_with_reference() {
|
||||||
let ctx = TestContext::new("transaction_with_reference_test").await;
|
let ctx = TestContext::new("transaction_with_reference_test").await;
|
||||||
|
create_tables(&ctx.db).await.unwrap();
|
||||||
|
|
||||||
let name1 = "SeaSide Bakery";
|
let name1 = "SeaSide Bakery";
|
||||||
let name2 = "Top Bakery";
|
let name2 = "Top Bakery";
|
||||||
let search_name = "Bakery";
|
let search_name = "Bakery";
|
||||||
@ -111,6 +113,7 @@ fn _transaction_with_reference<'a>(
|
|||||||
))]
|
))]
|
||||||
pub async fn transaction_nested() {
|
pub async fn transaction_nested() {
|
||||||
let ctx = TestContext::new("transaction_nested_test").await;
|
let ctx = TestContext::new("transaction_nested_test").await;
|
||||||
|
create_tables(&ctx.db).await.unwrap();
|
||||||
|
|
||||||
ctx.db
|
ctx.db
|
||||||
.transaction::<_, _, DbErr>(|txn| {
|
.transaction::<_, _, DbErr>(|txn| {
|
||||||
|
@ -11,7 +11,7 @@ use sea_orm::{entity::prelude::*, entity::*, DatabaseConnection};
|
|||||||
))]
|
))]
|
||||||
async fn main() -> Result<(), DbErr> {
|
async fn main() -> Result<(), DbErr> {
|
||||||
let ctx = TestContext::new("bakery_chain_schema_uuid_tests").await;
|
let ctx = TestContext::new("bakery_chain_schema_uuid_tests").await;
|
||||||
create_tables(&ctx.db).await;
|
create_tables(&ctx.db).await?;
|
||||||
create_and_update_metadata(&ctx.db).await?;
|
create_and_update_metadata(&ctx.db).await?;
|
||||||
insert_metadata(&ctx.db).await?;
|
insert_metadata(&ctx.db).await?;
|
||||||
ctx.delete().await;
|
ctx.delete().await;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user