WIP - failing for postgres on Customer::find().count(db).await.unwrap();

This commit is contained in:
Sam Samai 2021-08-05 20:55:40 +10:00
parent 54461172de
commit 402c003d84
4 changed files with 8 additions and 8 deletions

View File

@ -31,6 +31,6 @@ async fn create_entities(db: &DatabaseConnection) {
crud::updates::test_update_bakery(db).await;
crud::updates::test_update_deleted_customer(db).await;
// crud::deletes::test_delete_cake(db).await;
// crud::deletes::test_delete_bakery(db).await;
crud::deletes::test_delete_cake(db).await;
crud::deletes::test_delete_bakery(db).await;
}

View File

@ -113,7 +113,7 @@ pub async fn test_create_order(db: &DbConn) {
let customer_model = customer.unwrap();
assert_eq!(customer_model.name, "Kate");
let bakery: Option<bakery::Model> = Bakery::find_by_id(order_model.bakery_id as u64)
let bakery: Option<bakery::Model> = Bakery::find_by_id(order_model.bakery_id as i64)
.one(db)
.await
.expect("could not find bakery");

View File

@ -130,10 +130,11 @@ pub async fn test_update_deleted_customer(db: &DbConn) {
assert_eq!(Customer::find().count(db).await.unwrap(), init_n_customers);
let customer: Option<customer::Model> = Customer::find_by_id(customer_id.clone().unwrap())
.one(db)
.await
.expect("could not find customer");
let customer: Option<customer::Model> =
Customer::find_by_id(customer_id.clone().unwrap() as i64)
.one(db)
.await
.expect("could not find customer");
assert_eq!(customer, None);
}

View File

@ -12,7 +12,6 @@ use sea_query::{ColumnDef, TableCreateStatement};
#[cfg_attr(feature = "runtime-async-std", async_std::test)]
#[cfg_attr(feature = "runtime-actix", actix_rt::test)]
#[cfg_attr(feature = "runtime-tokio", tokio::test)]
#[async_std::test]
#[cfg(feature = "sqlx-postgres")]
async fn main() {
let base_url = "postgres://root:root@localhost";