Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/cont_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ jobs:
- name: Run doc tests
run: cargo test ${{ matrix.features }} --doc --verbose

- name: Run RPC client tests
run: cargo test --test test_rpc_client --verbose -- --test-threads=2

# MSRV
msrv:
name: MSRV
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ default = ["30_0"]
28_0 = []

[dev-dependencies]
anyhow = "1"
corepc-node = { version = "0.10.1", features = ["download", "29_0"] }
11 changes: 11 additions & 0 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ mod test_auth {
}

#[test]
#[ignore = "modifies the local filesystem"]
fn test_auth_cookie_file_get_user_pass() {
let temp_dir = std::env::temp_dir();
let cookie_path = temp_dir.join("test_auth_cookie");
Expand All @@ -299,4 +300,14 @@ mod test_auth {

std::fs::remove_file(cookie_path).ok();
}

#[test]
fn test_auth_invalid_cookie_file() {
let dummy_url = "http://127.0.0.1:18443";
let cookie_path = PathBuf::from("/nonexistent/path/to/cookie");

let result = Client::with_auth(dummy_url, Auth::CookieFile(cookie_path));

assert!(matches!(result, Err(Error::InvalidCookieFile)));
}
}
17 changes: 1 addition & 16 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,7 @@ impl fmt::Display for Error {
}
}

impl std::error::Error for Error {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match self {
Error::DecodeHex(e) => Some(e),
Error::JsonRpc(e) => Some(e),
Error::HexToArray(e) => Some(e),
Error::Json(e) => Some(e),
Error::Io(e) => Some(e),
Error::TryFromInt(e) => Some(e),
Error::GetBlockVerboseOne(e) => Some(e),
Error::GetBlockHeaderVerbose(e) => Some(e),
Error::GetBlockFilter(e) => Some(e),
_ => None,
}
}
}
impl std::error::Error for Error {}

// Conversions from other error types
impl From<jsonrpc::Error> for Error {
Expand Down
Loading