MCPcopy Create free account
hub / github.com/cowprotocol/services / postgres_order_roundtrip

Function postgres_order_roundtrip

crates/database/src/orders.rs:1120–1157  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1118 #[tokio::test]
1119 #[ignore]
1120 async fn postgres_order_roundtrip() {
1121 let mut db = PgConnection::connect("postgresql://").await.unwrap();
1122 let mut db = db.begin().await.unwrap();
1123 crate::clear_DANGER_(&mut db).await.unwrap();
1124
1125 let order = Order {
1126 ..Default::default()
1127 };
1128 insert_order(&mut db, &order).await.unwrap();
1129 let order_ = read_order(&mut db, &order.uid).await.unwrap().unwrap();
1130 assert_eq!(order, order_);
1131
1132 let full_order = single_full_order_with_quote(&mut db, &order.uid)
1133 .await
1134 .unwrap()
1135 .unwrap()
1136 .full_order;
1137
1138 assert_eq!(order.uid, full_order.uid);
1139 assert_eq!(order.owner, full_order.owner);
1140 assert_eq!(order.creation_timestamp, full_order.creation_timestamp);
1141 assert_eq!(order.sell_token, full_order.sell_token);
1142 assert_eq!(order.buy_token, full_order.buy_token);
1143 assert_eq!(order.sell_amount, full_order.sell_amount);
1144 assert_eq!(order.buy_amount, full_order.buy_amount);
1145 assert_eq!(order.valid_to, full_order.valid_to);
1146 assert_eq!(order.app_data, full_order.app_data);
1147 assert_eq!(order.fee_amount, full_order.fee_amount);
1148 assert_eq!(order.kind, full_order.kind);
1149 assert_eq!(order.class, full_order.class);
1150 assert_eq!(order.partially_fillable, full_order.partially_fillable);
1151 assert_eq!(order.signature, full_order.signature);
1152 assert_eq!(order.receiver, full_order.receiver);
1153 assert_eq!(order.signing_scheme, full_order.signing_scheme);
1154 assert_eq!(order.settlement_contract, full_order.settlement_contract);
1155 assert_eq!(order.sell_token_balance, full_order.sell_token_balance);
1156 assert_eq!(order.buy_token_balance, full_order.buy_token_balance);
1157 }
1158
1159 #[tokio::test]
1160 #[ignore]

Callers

nothing calls this directly

Calls 6

connectFunction · 0.85
clear_DANGER_Function · 0.85
unwrapMethod · 0.80
insert_orderFunction · 0.70
read_orderFunction · 0.70

Tested by

no test coverage detected