Test case for #244
This commit is contained in:
parent
47f31fb27d
commit
9abfdf4838
@ -1,7 +1,7 @@
|
||||
pub mod common;
|
||||
|
||||
pub use common::{bakery_chain::*, setup::*, TestContext};
|
||||
use sea_orm::{entity::prelude::*, DatabaseConnection, IntoActiveModel, Set};
|
||||
use sea_orm::{entity::*, entity::prelude::*, DatabaseConnection};
|
||||
|
||||
#[sea_orm_macros::test]
|
||||
#[cfg(any(
|
||||
@ -11,13 +11,32 @@ use sea_orm::{entity::prelude::*, DatabaseConnection, IntoActiveModel, Set};
|
||||
))]
|
||||
async fn main() -> Result<(), DbErr> {
|
||||
let ctx = TestContext::new("bakery_chain_schema_uuid_tests").await;
|
||||
create_metadata(&ctx.db).await?;
|
||||
create_and_update_metadata(&ctx.db).await?;
|
||||
insert_metadata(&ctx.db).await?;
|
||||
ctx.delete().await;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn create_metadata(db: &DatabaseConnection) -> Result<(), DbErr> {
|
||||
pub async fn insert_metadata(db: &DatabaseConnection) -> Result<(), DbErr> {
|
||||
let metadata = metadata::Model {
|
||||
uuid: Uuid::new_v4(),
|
||||
ty: "Type".to_owned(),
|
||||
key: "markup".to_owned(),
|
||||
value: "1.18".to_owned(),
|
||||
bytes: vec![1, 2, 3],
|
||||
date: Some(Date::from_ymd(2021, 9, 27)),
|
||||
time: Some(Time::from_hms(11, 32, 55)),
|
||||
}.into_active_model();
|
||||
|
||||
let result = metadata.clone().insert(db).await?;
|
||||
|
||||
assert_eq!(metadata, result);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn create_and_update_metadata(db: &DatabaseConnection) -> Result<(), DbErr> {
|
||||
let metadata = metadata::Model {
|
||||
uuid: Uuid::new_v4(),
|
||||
ty: "Type".to_owned(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user