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

Function postgres_quote_roundtrip

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

Source from the content-addressed store, hash-verified

1581 #[tokio::test]
1582 #[ignore]
1583 async fn postgres_quote_roundtrip() {
1584 let mut db = PgConnection::connect("postgresql://").await.unwrap();
1585 let mut db = db.begin().await.unwrap();
1586 crate::clear_DANGER_(&mut db).await.unwrap();
1587
1588 let metadata: serde_json::Value = serde_json::from_str(
1589 r#"{ "version":"1.0", "interactions": [ {
1590 "target": "0x0102030405060708091011121314151617181920",
1591 "value": "1",
1592 "callData": "0x0A0B0C102030"
1593 },{
1594 "target": "0xFF02030405060708091011121314151617181920",
1595 "value": "2",
1596 "callData": "0xFF0B0C102030"
1597 }]
1598 }"#,
1599 )
1600 .unwrap();
1601
1602 let quote = Quote {
1603 order_uid: Default::default(),
1604 gas_amount: 1.,
1605 gas_price: 2.,
1606 sell_token_price: 3.,
1607 sell_amount: 4.into(),
1608 buy_amount: 5.into(),
1609 solver: ByteArray([1; 20]),
1610 verified: true,
1611 metadata,
1612 };
1613 insert_quote(&mut db, &quote).await.unwrap();
1614 let quote_ = read_quote(&mut db, &quote.order_uid)
1615 .await
1616 .unwrap()
1617 .unwrap();
1618 assert_eq!(quote, quote_);
1619 }
1620
1621 #[tokio::test]
1622 #[ignore]

Callers

nothing calls this directly

Calls 7

connectFunction · 0.85
clear_DANGER_Function · 0.85
ByteArrayClass · 0.85
insert_quoteFunction · 0.85
read_quoteFunction · 0.85
unwrapMethod · 0.80
intoMethod · 0.45

Tested by

no test coverage detected