Skip to content

Commit 7f77334

Browse files
committed
Merge #5: Reconcile AuthData::BearerToken with upstream AuthData::None
2 parents 490a305 + b7676a5 commit 7f77334

3 files changed

Lines changed: 23 additions & 1 deletion

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,4 @@ __pycache__/
8686
# Allow vscode
8787
# !.vscode # Commented by default
8888
CLAUDE.md
89+
CLAUDE.md

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# rust-genai Agent Instructions
22

33
## Your Task
4-
You are implementing issue #1 for the rust-genai Rust library.
4+
You are implementing issue #5 for the rust-genai Rust library.
55
Focus ALL your effort on writing production-quality Rust code and tests.
66
Do NOT run gitea-robot, tea, or any task-tracking commands.
77
The orchestrator handles all task tracking.

src/resolver/auth_data.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ impl AuthData {
6363
Ok(value)
6464
}
6565
AuthData::Key(value) => Ok(value.to_string()),
66+
// No-auth providers return an empty string
67+
AuthData::None => Ok(String::new()),
6668
_ => Err(Error::ResolverAuthDataNotSingleValue),
6769
}
6870
}
@@ -126,6 +128,25 @@ mod tests {
126128
let value = auth.single_key_value().unwrap();
127129
assert_eq!(value, "");
128130
}
131+
#[test]
132+
fn test_none_single_key_value_returns_empty() {
133+
let auth = AuthData::None;
134+
let value = auth.single_key_value().unwrap();
135+
assert_eq!(value, "");
136+
}
137+
138+
#[test]
139+
fn test_none_debug() {
140+
let auth = AuthData::None;
141+
let debug = format!("{:?}", auth);
142+
assert_eq!(debug, "None");
143+
}
144+
145+
#[test]
146+
fn test_multi_keys_single_key_value_errors() {
147+
let auth = AuthData::from_multi(HashMap::new());
148+
assert!(auth.single_key_value().is_err());
149+
}
129150
}
130151

131152
// endregion: --- Tests

0 commit comments

Comments
 (0)