Skip to content

Commit

Permalink
Move MsgParts Display trait test
Browse files Browse the repository at this point in the history
Signed-off-by: Patrik Stas <patrik.stas@absa.africa>
  • Loading branch information
Patrik-Stas committed Nov 29, 2023
1 parent 55ea882 commit a861b63
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 22 deletions.
15 changes: 14 additions & 1 deletion aries/messages/src/msg_fields/protocols/did_exchange/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub struct RequestDecorators {
#[cfg(test)]
#[allow(clippy::unwrap_used)]
#[allow(clippy::field_reassign_with_default)]
pub mod tests {
mod tests {
use diddoc_legacy::aries::diddoc::AriesDidDoc;
use serde_json::json;

Expand All @@ -49,6 +49,7 @@ pub mod tests {
timing::tests::make_extended_timing,
},
misc::test_utils,
msg_fields::protocols::did_exchange::request::{Request, RequestDecorators},
msg_types::protocols::did_exchange::DidExchangeTypeV1_0,
};

Expand All @@ -73,6 +74,18 @@ pub mod tests {
}
}

#[test]
fn test_print_message() {
let msg: Request = Request::builder()
.id("test_id".to_owned())
.content(request_content())
.decorators(RequestDecorators::default())
.build();
let printed_json = format!("{}", msg);
let parsed_request: Request = serde_json::from_str(&printed_json).unwrap();
assert_eq!(msg, parsed_request);
}

#[test]
fn test_minimal_didexchange_request() {
let content = request_content();
Expand Down
21 changes: 0 additions & 21 deletions aries/messages/src/msg_parts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,24 +65,3 @@ impl<C, D> MsgPartsBuilder<C, D, ((String,), (C,), (D,))> {
self.__build().into()
}
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
#[allow(clippy::field_reassign_with_default)]
pub mod tests {
use crate::msg_fields::protocols::did_exchange::request::{
tests::request_content, Request, RequestDecorators,
};

#[test]
fn test_print_message() {
let msg: Request = Request::builder()
.id("test_id".to_owned())
.content(request_content())
.decorators(RequestDecorators::default())
.build();
let printed_json = format!("{}", msg);
let parsed_request: Request = serde_json::from_str(&printed_json).unwrap();
assert_eq!(msg, parsed_request);
}
}

0 comments on commit a861b63

Please sign in to comment.