mirror of
https://github.com/sigoden/dufs.git
synced 2026-04-09 00:59:02 +03:00
fix: auth precedence (#325)
This commit is contained in:
@@ -282,3 +282,22 @@ fn auth_data(
|
||||
assert_eq!(json["allow_upload"], serde_json::Value::Bool(true));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
fn auth_precedence(
|
||||
#[with(&["--auth", "user:pass@/dir1:rw,/dir1/test.txt", "-A"])] server: TestServer,
|
||||
) -> Result<(), Error> {
|
||||
let url = format!("{}dir1/test.txt", server.url());
|
||||
let resp = fetch!(b"PUT", &url)
|
||||
.body(b"abc".to_vec())
|
||||
.send_with_digest_auth("user", "pass")?;
|
||||
assert_eq!(resp.status(), 403);
|
||||
|
||||
let url = format!("{}dir1/file1", server.url());
|
||||
let resp = fetch!(b"PUT", &url)
|
||||
.body(b"abc".to_vec())
|
||||
.send_with_digest_auth("user", "pass")?;
|
||||
assert_eq!(resp.status(), 201);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user