MCPcopy Create free account
hub / github.com/Migorithm/rustiful-backend / test_transaction_rollback

Function test_transaction_rollback

tests/database.rs:56–77  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

54
55 #[tokio::test]
56 async fn test_transaction_rollback() {
57 run_test(async {
58 let pool = connection_pool().await;
59 let executor = Arc::new(RwLock::new(Executor::new(pool)));
60
61 executor.write().await.begin().await.unwrap();
62 // let trx: Transactions = connection.begin().await.unwrap();
63 let mut board_repo: Repository<BoardAggregate> =
64 board_repository_helper(executor.clone());
65
66 let mut board_aggregate = board_create_helper(BoardState::Unpublished);
67 let id = board_repo.add(&mut board_aggregate).await.unwrap();
68
69 executor.write().await.rollback().await.unwrap();
70
71 //TODO Shouldn't exist
72 if board_repo.get(&id).await.is_ok() {
73 panic!("Shouldn't exist!")
74 }
75 })
76 .await;
77 }
78}

Callers

nothing calls this directly

Calls 8

connection_poolFunction · 0.85
board_repository_helperFunction · 0.85
board_create_helperFunction · 0.85
run_testFunction · 0.70
beginMethod · 0.45
addMethod · 0.45
rollbackMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected