+
+ #[tokio::test]
+ async fn parses_negative_getutxos() {
+ let server = HttpServer::responding_with_ok(MessageBody::Content(
+ // A real response contains a few more fields, but we actually only look at the
+ // "bitmap" field, so this should suffice for testing
+ "{\"chainHeight\": 1, \"bitmap\":\"0\",\"utxos\":[]}"
+ ));
+ let client = RestClient::new(server.endpoint()).unwrap();
+
+ let outpoint = OutPoint::new(bitcoin::Txid::from_byte_array([0; 32]), 0);
+ let unspent_output = client.is_output_unspent(outpoint).await.unwrap();
+ assert_eq!(unspent_output, false);
+ }
+
+ #[tokio::test]
+ async fn parses_positive_getutxos() {
+ let server = HttpServer::responding_with_ok(MessageBody::Content(
+ // A real response contains lots more data, but we actually only look at the "bitmap"
+ // field, so this should suffice for testing
+ "{\"chainHeight\": 1, \"bitmap\":\"1\",\"utxos\":[]}"
+ ));
+ let client = RestClient::new(server.endpoint()).unwrap();
+
+ let outpoint = OutPoint::new(bitcoin::Txid::from_byte_array([0; 32]), 0);
+ let unspent_output = client.is_output_unspent(outpoint).await.unwrap();
+ assert_eq!(unspent_output, true);
+ }