Skip to content

Commit ee52af4

Browse files
committed
test: Improve unit, integration tests
- test,deps: Add `anyhow` - test: Add `testenv` module
1 parent d77416c commit ee52af4

File tree

5 files changed

+193
-208
lines changed

5 files changed

+193
-208
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.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ default = ["30_0"]
2222
28_0 = []
2323

2424
[dev-dependencies]
25+
anyhow = "1"
2526
corepc-node = { version = "0.10.1", features = ["download", "29_0"] }

src/client.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ mod test_auth {
284284
}
285285

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

300301
std::fs::remove_file(cookie_path).ok();
301302
}
303+
304+
#[test]
305+
fn test_auth_invalid_cookie_file() {
306+
let dummy_url = "http://127.0.0.1:18443";
307+
let cookie_path = PathBuf::from("/nonexistent/path/to/cookie");
308+
309+
let result = Client::with_auth(dummy_url, Auth::CookieFile(cookie_path));
310+
311+
assert!(matches!(result, Err(Error::InvalidCookieFile)));
312+
}
302313
}

0 commit comments

Comments
 (0)