mirror of
https://github.com/aljazceru/cdk.git
synced 2025-12-22 23:25:22 +01:00
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:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user