Skip to content

Commit 0886375

Browse files
committed
fix tests
1 parent 77c88c4 commit 0886375

File tree

1 file changed

+3
-22
lines changed

1 file changed

+3
-22
lines changed

crates/chat-cli/src/auth/builder_id.rs

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,6 @@ pub enum OAuthFlow {
6666
Pkce,
6767
}
6868

69-
impl std::fmt::Display for OAuthFlow {
70-
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
71-
match *self {
72-
OAuthFlow::DeviceCode => write!(f, "DeviceCode"),
73-
OAuthFlow::Pkce => write!(f, "PKCE"),
74-
}
75-
}
76-
}
77-
7869
/// Indicates if an expiration time has passed, there is a small 1 min window that is removed
7970
/// so the token will not expire in transit
8071
fn is_expired(expiration_time: &OffsetDateTime) -> bool {
@@ -565,20 +556,10 @@ mod tests {
565556
const US_EAST_1: Region = Region::from_static("us-east-1");
566557
const US_WEST_2: Region = Region::from_static("us-west-2");
567558

568-
macro_rules! test_ser_deser {
569-
($ty:ident, $variant:expr, $text:expr) => {
570-
let quoted = format!("\"{}\"", $text);
571-
assert_eq!(quoted, serde_json::to_string(&$variant).unwrap());
572-
assert_eq!($variant, serde_json::from_str(&quoted).unwrap());
573-
574-
assert_eq!($text, format!("{}", $variant));
575-
};
576-
}
577-
578559
#[test]
579-
fn test_oauth_flow_ser_deser() {
580-
test_ser_deser!(OAuthFlow, OAuthFlow::DeviceCode, "DeviceCode");
581-
test_ser_deser!(OAuthFlow, OAuthFlow::Pkce, "PKCE");
560+
fn test_oauth_flow_deser() {
561+
assert_eq!(OAuthFlow::Pkce, serde_json::from_str("\"PKCE\"").unwrap());
562+
assert_eq!(OAuthFlow::Pkce, serde_json::from_str("\"Pkce\"").unwrap());
582563
}
583564

584565
#[tokio::test]

0 commit comments

Comments
 (0)