Skip to content

Commit

Permalink
Fix LocalSecret serializaton tests
Browse files Browse the repository at this point in the history
  • Loading branch information
inetic committed Feb 14, 2024
1 parent 1c3543b commit 24662fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/src/access_control/local_secret.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ mod tests {
#[test]
fn serialize_deserialize_bincode() {
let orig = LocalSecret::Password("mellon".to_string().into());
let expected_serialized_hex = "06000000000000006d656c6c6f6e";
let expected_serialized_hex = "0000000006000000000000006d656c6c6f6e";

let serialized = bincode::serialize(&orig).unwrap();
assert_eq!(hex::encode(&serialized), expected_serialized_hex);
Expand All @@ -40,7 +40,7 @@ mod tests {
#[test]
fn serialize_deserialize_msgpack() {
let orig = LocalSecret::Password("mellon".to_string().into());
let expected_serialized_hex = "a66d656c6c6f6e";
let expected_serialized_hex = "81a870617373776f7264a66d656c6c6f6e";

let serialized = rmp_serde::to_vec(&orig).unwrap();
assert_eq!(hex::encode(&serialized), expected_serialized_hex);
Expand Down
4 changes: 2 additions & 2 deletions lib/src/access_control/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ mod tests {
for (orig, expected_serialized) in [
(
AccessChange::Enable(Some(LocalSecret::Password("mellon".to_string().into()))),
"{\"enable\":\"mellon\"}",
"{\"enable\":{\"password\":\"mellon\"}}",
),
(AccessChange::Enable(None), "{\"enable\":null}"),
(AccessChange::Disable, "\"disable\""),
Expand All @@ -431,7 +431,7 @@ mod tests {
for (orig, expected_serialized_hex) in [
(
AccessChange::Enable(Some(LocalSecret::Password("mellon".to_string().into()))),
"81a6656e61626c65a66d656c6c6f6e",
"81a6656e61626c6581a870617373776f7264a66d656c6c6f6e",
),
(AccessChange::Enable(None), "81a6656e61626c65c0"),
(AccessChange::Disable, "a764697361626c65"),
Expand Down

0 comments on commit 24662fe

Please sign in to comment.