Add support for pure integration tests (#458)

* Embed mint_url as a field of HttpClient

* Create pure integration tests

* DirectMintConnection: convert between String and Uuid
This commit is contained in:
ok300
2024-12-08 14:33:58 +00:00
committed by GitHub
parent 9cb684e5db
commit 86c4c2dfeb
18 changed files with 426 additions and 170 deletions

View File

@@ -144,16 +144,17 @@ async fn main() -> Result<()> {
let mints = localstore.get_mints().await?;
for (mint, _) in mints {
for (mint_url, _) in mints {
let mut wallet = Wallet::new(
&mint.to_string(),
&mint_url.to_string(),
cdk::nuts::CurrencyUnit::Sat,
localstore.clone(),
&mnemonic.to_seed_normalized(""),
None,
)?;
if let Some(proxy_url) = args.proxy.as_ref() {
wallet.set_client(HttpClient::with_proxy(proxy_url.clone(), None, true)?);
let http_client = HttpClient::with_proxy(mint_url, proxy_url.clone(), None, true)?;
wallet.set_client(Arc::from(http_client));
}
wallets.push(wallet);

View File

@@ -1,6 +1,6 @@
use anyhow::Result;
use cdk::mint_url::MintUrl;
use cdk::wallet::client::HttpClientMethods;
use cdk::wallet::client::MintConnector;
use cdk::HttpClient;
use clap::Args;
use url::Url;
@@ -11,14 +11,13 @@ pub struct MintInfoSubcommand {
}
pub async fn mint_info(proxy: Option<Url>, sub_command_args: &MintInfoSubcommand) -> Result<()> {
let mint_url = sub_command_args.mint_url.clone();
let client = match proxy {
Some(proxy) => HttpClient::with_proxy(proxy, None, true)?,
None => HttpClient::new(),
Some(proxy) => HttpClient::with_proxy(mint_url, proxy, None, true)?,
None => HttpClient::new(mint_url),
};
let info = client
.get_mint_info(sub_command_args.mint_url.clone())
.await?;
let info = client.get_mint_info().await?;
println!("{:#?}", info);