Skip to content

Commit 12cea4c

Browse files
committed
test: Improve unit, integration tests
1 parent 0a5dc87 commit 12cea4c

2 files changed

Lines changed: 138 additions & 221 deletions

File tree

src/client.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ mod test_auth {
303303
}
304304

305305
#[test]
306+
#[ignore = "modifies the local filesystem"]
306307
fn test_auth_cookie_file_get_user_pass() {
307308
let temp_dir = std::env::temp_dir();
308309
let cookie_path = temp_dir.join("test_auth_cookie");
@@ -318,4 +319,21 @@ mod test_auth {
318319

319320
std::fs::remove_file(cookie_path).ok();
320321
}
322+
323+
#[test]
324+
fn test_auth_none_returns_error() {
325+
let result = Client::with_auth("http://invalid-url", Auth::None);
326+
327+
assert!(matches!(result, Err(Error::MissingAuthentication)));
328+
}
329+
330+
#[test]
331+
fn test_auth_invalid_cookie_file() {
332+
let dummy_url = "http://127.0.0.1:18443";
333+
let cookie_path = PathBuf::from("/nonexistent/path/to/cookie");
334+
335+
let result = Client::with_auth(dummy_url, Auth::CookieFile(cookie_path));
336+
337+
assert!(matches!(result, Err(Error::InvalidCookieFile)));
338+
}
321339
}

0 commit comments

Comments
 (0)