MCPcopy Create free account
hub / github.com/SeaQL/sea-orm / test_load_one

Function test_load_one

src/query/loader.rs:505–520  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

503
504 #[tokio::test]
505 async fn test_load_one() {
506 use sea_orm::{entity::prelude::*, tests_cfg::*, DbBackend, LoaderTrait, MockDatabase};
507
508 let db = MockDatabase::new(DbBackend::Postgres)
509 .append_query_results([[cake_model(1), cake_model(2)]])
510 .into_connection();
511
512 let fruits = vec![fruit_model(1, Some(1))];
513
514 let cakes = fruits
515 .load_one(cake::Entity::find(), &db)
516 .await
517 .expect("Should return something");
518
519 assert_eq!(cakes, [Some(cake_model(1))]);
520 }
521
522 #[tokio::test]
523 async fn test_load_one_same_cake() {

Callers

nothing calls this directly

Calls 5

into_connectionMethod · 0.80
append_query_resultsMethod · 0.80
load_oneMethod · 0.80
cake_modelFunction · 0.70
newFunction · 0.50

Tested by

no test coverage detected