core: type auth profile timestamps
This commit is contained in:
@@ -120,9 +120,14 @@ mod tests {
|
||||
BasicAuthConfig, BearerAuthConfig, SecretId, WorkspaceId,
|
||||
};
|
||||
use serde_json::json;
|
||||
use time::{OffsetDateTime, format_description::well_known::Rfc3339};
|
||||
|
||||
use crate::{PreparedRequest, auth::ResolvedAuth};
|
||||
|
||||
fn timestamp(value: &str) -> OffsetDateTime {
|
||||
OffsetDateTime::parse(value, &Rfc3339).unwrap()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn applies_bearer_auth_to_headers() {
|
||||
let auth = ResolvedAuth::from_profile(
|
||||
@@ -135,8 +140,8 @@ mod tests {
|
||||
header_name: "Authorization".to_owned(),
|
||||
secret_id: SecretId::new("secret_token"),
|
||||
}),
|
||||
created_at: "2026-04-07T00:00:00Z".to_owned(),
|
||||
updated_at: "2026-04-07T00:00:00Z".to_owned(),
|
||||
created_at: timestamp("2026-04-07T00:00:00Z"),
|
||||
updated_at: timestamp("2026-04-07T00:00:00Z"),
|
||||
},
|
||||
&BTreeMap::from([(SecretId::new("secret_token"), json!({"token":"abc"}))]),
|
||||
)
|
||||
@@ -163,8 +168,8 @@ mod tests {
|
||||
username_secret_id: SecretId::new("secret_user"),
|
||||
password_secret_id: SecretId::new("secret_pass"),
|
||||
}),
|
||||
created_at: "2026-04-07T00:00:00Z".to_owned(),
|
||||
updated_at: "2026-04-07T00:00:00Z".to_owned(),
|
||||
created_at: timestamp("2026-04-07T00:00:00Z"),
|
||||
updated_at: timestamp("2026-04-07T00:00:00Z"),
|
||||
},
|
||||
&BTreeMap::from([
|
||||
(SecretId::new("secret_user"), json!({"username":"demo"})),
|
||||
@@ -194,8 +199,8 @@ mod tests {
|
||||
header_name: "X-Api-Key".to_owned(),
|
||||
secret_id: SecretId::new("secret_api_key"),
|
||||
}),
|
||||
created_at: "2026-04-07T00:00:00Z".to_owned(),
|
||||
updated_at: "2026-04-07T00:00:00Z".to_owned(),
|
||||
created_at: timestamp("2026-04-07T00:00:00Z"),
|
||||
updated_at: timestamp("2026-04-07T00:00:00Z"),
|
||||
},
|
||||
&BTreeMap::from([(SecretId::new("secret_api_key"), json!("key-123"))]),
|
||||
)
|
||||
@@ -222,8 +227,8 @@ mod tests {
|
||||
param_name: "api_key".to_owned(),
|
||||
secret_id: SecretId::new("secret_api_key"),
|
||||
}),
|
||||
created_at: "2026-04-07T00:00:00Z".to_owned(),
|
||||
updated_at: "2026-04-07T00:00:00Z".to_owned(),
|
||||
created_at: timestamp("2026-04-07T00:00:00Z"),
|
||||
updated_at: timestamp("2026-04-07T00:00:00Z"),
|
||||
},
|
||||
&BTreeMap::from([(SecretId::new("secret_api_key"), json!({"value":"key-123"}))]),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user