Skip to content

Commit 07533e2

Browse files
committed
fix tests
1 parent 0875f72 commit 07533e2

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

testutil/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ edition = "2021"
66
[dependencies]
77
bitcoind = { version = "0.36.0", features = ["26_0"] }
88
spaces_client = { path = "../client" }
9+
hyper = "0.14.28"
910
assert_cmd = "2.0.16"
1011

1112
[build-dependencies]

testutil/src/spaced.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use anyhow::Result;
88
use assert_cmd::cargo::CommandCargoExt;
99
use bitcoind::{anyhow, anyhow::anyhow, get_available_port, tempfile::tempdir};
1010
use spaces_client::{
11+
auth::auth_token_from_creds,
1112
jsonrpsee::{
1213
http_client::{HttpClient, HttpClientBuilder},
1314
tokio,
@@ -53,13 +54,27 @@ impl SpaceD {
5354
.arg(rpc_port.to_string())
5455
.arg("--data-dir")
5556
.arg(tempdir()?.path())
57+
.arg("--rpc-user")
58+
.arg("user")
59+
.arg("--rpc-password")
60+
.arg("pass")
5661
.stdout(stdout)
5762
.spawn()?)
5863
})
5964
.await
6065
.expect("spawn blocking task")?;
6166

62-
let client = HttpClientBuilder::default().build(rpc_url(rpc_port))?;
67+
let client = {
68+
let auth_token = auth_token_from_creds("user", "pass");
69+
let mut headers = hyper::http::HeaderMap::new();
70+
headers.insert(
71+
"Authorization",
72+
hyper::http::HeaderValue::from_str(&format!("Basic {auth_token}")).unwrap(),
73+
);
74+
HttpClientBuilder::default()
75+
.set_headers(headers)
76+
.build(rpc_url(rpc_port))?
77+
};
6378

6479
let mut spaced = Self {
6580
process,

0 commit comments

Comments
 (0)