Skip to content

Commit

Permalink
tests: update messages format for last redis version
Browse files Browse the repository at this point in the history
  • Loading branch information
negezor committed Mar 31, 2024
1 parent 5ceb323 commit 018cec9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions tests/derive_from_redis_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub fn it_should_fail_if_input_is_not_compatible_with_type() {
let val = Value::Data("{}".as_bytes().into());
let result = User::from_redis_value(&val);
if let Err(err) = result {
assert_eq!(err.to_string(), "Response was of incompatible type: Response type not deserializable to User with serde_json. (response was string-data('\"{}\"'))".to_string());
assert_eq!(err.to_string(), "Response was of incompatible type - TypeError: Response type not deserializable to User with serde_json. (response was string-data('\"{}\"'))".to_string());
} else {
panic!("Deserialization should fail.");
}
Expand All @@ -63,7 +63,7 @@ pub fn it_should_fail_if_input_is_not_valid_utf8() {
let val = Value::Data(vec![0, 159, 146, 150]); // Some invalid utf8
let result = User::from_redis_value(&val);
if let Err(err) = result {
assert_eq!(err.to_string(), "Response was of incompatible type: Response was not valid UTF-8 string. (response was binary-data([0, 159, 146, 150]))".to_string());
assert_eq!(err.to_string(), "Response was of incompatible type - TypeError: Response was not valid UTF-8 string. (response was binary-data([0, 159, 146, 150]))".to_string());
} else {
panic!("UTF-8 parsing should fail.");
}
Expand All @@ -74,7 +74,7 @@ pub fn it_should_fail_if_input_is_missing() {
let val = Value::Nil;
let result = User::from_redis_value(&val);
if let Err(err) = result {
assert_eq!(err.to_string(), "Response was of incompatible type: Response type was not deserializable to User. (response was nil)".to_string());
assert_eq!(err.to_string(), "Response was of incompatible type - TypeError: Response type was not deserializable to User. (response was nil)".to_string());
} else {
panic!("UTF-8 parsing should fail.");
}
Expand Down
8 changes: 4 additions & 4 deletions tests/json_wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub fn it_should_fail_if_the_result_is_not_redis_json() {
let val = Value::Data("{\"id\":1,\"name\":\"Ziggy\",\"addresses\":[{\"Street\":\"Downing\"},{\"Road\":\"Abbey\"}]}".as_bytes().into());
let result = Json::<User>::from_redis_value(&val);
if let Err(err) = result {
assert_eq!(err.to_string(), "Response was of incompatible type: Response type was not JSON type. (response was string-data('\"{\\\"id\\\":1,\\\"name\\\":\\\"Ziggy\\\",\\\"addresses\\\":[{\\\"Street\\\":\\\"Downing\\\"},{\\\"Road\\\":\\\"Abbey\\\"}]}\"'))".to_string());
assert_eq!(err.to_string(), "Response was of incompatible type - TypeError: Response type was not JSON type. (response was string-data('\"{\\\"id\\\":1,\\\"name\\\":\\\"Ziggy\\\",\\\"addresses\\\":[{\\\"Street\\\":\\\"Downing\\\"},{\\\"Road\\\":\\\"Abbey\\\"}]}\"'))".to_string());
} else {
panic!("RedisJSON unwrapping should fail.");
}
Expand All @@ -73,7 +73,7 @@ pub fn it_should_fail_if_input_is_not_compatible_with_type() {
let val = Value::Data("[{}]".as_bytes().into());
let result = Json::<User>::from_redis_value(&val);
if let Err(err) = result {
assert_eq!(err.to_string(), "Response was of incompatible type: Response type in JSON was not deserializable. (response was string-data('\"[{}]\"'))".to_string());
assert_eq!(err.to_string(), "Response was of incompatible type - TypeError: Response type in JSON was not deserializable. (response was string-data('\"[{}]\"'))".to_string());
} else {
panic!("Deserialization should fail.");
}
Expand All @@ -84,7 +84,7 @@ pub fn it_should_fail_if_input_is_not_valid_utf8() {
let val = Value::Data(vec![0, 159, 146, 150]); // Some invalid utf8
let result = Json::<User>::from_redis_value(&val);
if let Err(err) = result {
assert_eq!(err.to_string(), "Response was of incompatible type: Response was not valid UTF-8 string. (response was binary-data([0, 159, 146, 150]))".to_string());
assert_eq!(err.to_string(), "Response was of incompatible type - TypeError: Response was not valid UTF-8 string. (response was binary-data([0, 159, 146, 150]))".to_string());
} else {
panic!("UTF-8 parsing should fail.");
}
Expand All @@ -95,7 +95,7 @@ pub fn it_should_fail_if_input_is_missing() {
let val = Value::Nil;
let result = Json::<User>::from_redis_value(&val);
if let Err(err) = result {
assert_eq!(err.to_string(), "Response was of incompatible type: Response type not RedisJSON deserializable. (response was nil)".to_string());
assert_eq!(err.to_string(), "Response was of incompatible type - TypeError: Response type not RedisJSON deserializable. (response was nil)".to_string());
} else {
panic!("Value Nil should fail.");
}
Expand Down

0 comments on commit 018cec9

Please sign in to comment.