Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions crates/chat-cli/src/database/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ pub struct CredentialsJson {
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct AuthProfile {
pub arn: String,
#[serde(alias = "profileName")]
pub profile_name: String,
}

Expand Down Expand Up @@ -669,6 +670,20 @@ mod tests {
store.delete_secret(key).await.unwrap();
}

#[test]
fn test_auth_profile_deserialization_snake_case() {
let json = r#"{"arn":"arn:aws:codewhisperer:us-east-1:123456:profile/TEST","profile_name":"TestProfile"}"#;
let profile: AuthProfile = serde_json::from_str(json).unwrap();
assert_eq!(profile.profile_name, "TestProfile");
}

#[test]
fn test_auth_profile_deserialization_camel_case() {
let json = r#"{"arn":"arn:aws:codewhisperer:us-east-1:123456:profile/TEST","profileName":"TestProfile"}"#;
let profile: AuthProfile = serde_json::from_str(json).unwrap();
assert_eq!(profile.profile_name, "TestProfile");
}

#[tokio::test]
#[ignore = "not on ci"]
async fn secret_delete() {
Expand Down