Skip to content

Commit a5c4680

Browse files
committed
..
1 parent 0562c01 commit a5c4680

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

crates/uv-auth/src/credentials.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ impl From<Option<String>> for Username {
7272
pub struct Password(String);
7373

7474
impl Password {
75+
pub fn new(password: String) -> Self {
76+
Self(password)
77+
}
78+
7579
pub fn as_str(&self) -> &str {
7680
self.0.as_str()
7781
}

crates/uv-auth/src/middleware.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,8 @@ mod tests {
538538
use wiremock::matchers::{basic_auth, method, path_regex};
539539
use wiremock::{Mock, MockServer, ResponseTemplate};
540540

541+
use crate::credentials::Password;
542+
541543
use super::*;
542544

543545
type Error = Box<dyn std::error::Error>;
@@ -1868,7 +1870,7 @@ mod tests {
18681870
// Log username but mask password if a password is present
18691871
let creds = Credentials::Basic {
18701872
username: Username::new(Some(String::from("user"))),
1871-
password: Some(String::from("password")),
1873+
password: Some(Password::new(String::from("password"))),
18721874
};
18731875
let req = create_request("https://pypi-proxy.fly.dev/basic-auth/simple");
18741876
assert_eq!(

0 commit comments

Comments
 (0)