Skip to content

Commit

Permalink
chore: clippy tests
Browse files Browse the repository at this point in the history
Signed-off-by: James Ebert <jamesebert.k@gmail.com>
  • Loading branch information
JamesKEbert committed Dec 11, 2024
1 parent 00c31c4 commit 2c16a54
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 29 deletions.
7 changes: 4 additions & 3 deletions aries/aries_vcx/tests/test_connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@ async fn decrypt_message(
>,
received: Vec<u8>,
) -> AriesMessage {
let (message, _, _) = EncryptionEnvelope::unpack_aries_msg(&consumer.wallet, received, None)
.await
.unwrap();
let (message, _, _) =
EncryptionEnvelope::unpack_aries_msg(&consumer.wallet, received.as_slice(), &None)
.await
.unwrap();
message
}

Expand Down
17 changes: 8 additions & 9 deletions aries/messages/src/msg_fields/protocols/cred_issuance/v1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,15 @@ impl DelayedSerde for CredentialIssuanceV1 {
D: Deserializer<'de>,
{
let (protocol, kind_str) = msg_type;
let kind = match protocol {
CredentialIssuanceKind::V1(CredentialIssuanceTypeV1::V1_0(kind)) => {
kind.kind_from_str(kind_str)
}
CredentialIssuanceKind::V2(_) => {
return Err(D::Error::custom(
let kind =
match protocol {
CredentialIssuanceKind::V1(CredentialIssuanceTypeV1::V1_0(kind)) => {
kind.kind_from_str(kind_str)
}
CredentialIssuanceKind::V2(_) => return Err(D::Error::custom(
"Cannot deserialize issue-credential-v2 message type into issue-credential-v1",
))
}
};
)),
};

match kind.map_err(D::Error::custom)? {
CredentialIssuanceTypeV1_0::OfferCredential => {
Expand Down
17 changes: 8 additions & 9 deletions aries/messages/src/msg_fields/protocols/cred_issuance/v2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,15 @@ impl DelayedSerde for CredentialIssuanceV2 {
D: Deserializer<'de>,
{
let (protocol, kind_str) = msg_type;
let kind = match protocol {
CredentialIssuanceKind::V2(CredentialIssuanceTypeV2::V2_0(kind)) => {
kind.kind_from_str(kind_str)
}
CredentialIssuanceKind::V1(_) => {
return Err(D::Error::custom(
let kind =
match protocol {
CredentialIssuanceKind::V2(CredentialIssuanceTypeV2::V2_0(kind)) => {
kind.kind_from_str(kind_str)
}
CredentialIssuanceKind::V1(_) => return Err(D::Error::custom(
"Cannot deserialize issue-credential-v1 message type into issue-credential-v2",
))
}
};
)),
};

match kind.map_err(D::Error::custom)? {
CredentialIssuanceTypeV2_0::OfferCredential => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,10 @@ mod tests {

#[test]
fn test_process_elements_with_multiple_elements() {
let did: Did =
"did:peer:2.Vz6MkqRYqQiSgvZQdnBytw86Qbs2ZWUkGv22od935YF4s8M7V.\
let did: Did = "did:peer:2.Vz6MkqRYqQiSgvZQdnBytw86Qbs2ZWUkGv22od935YF4s8M7V.\
SeyJpZCI6IiNzZXJ2aWNlLTAiLCJ0IjoiZG0iLCJzIjoiaHR0cHM6Ly9leGFtcGxlLmNvbS9lbmRwb2ludCJ9"
.parse()
.unwrap();
.parse()
.unwrap();

let did_doc = diddoc_from_peerdid2_elements(
DidDocument::new(did.clone()),
Expand All @@ -164,12 +163,11 @@ mod tests {

#[test]
fn test_process_elements_error_on_invalid_element() {
let did: Did =
"did:peer:2.Vz6MkqRYqQiSgvZQdnBytw86Qbs2ZWUkGv22od935YF4s8M7V.\
let did: Did = "did:peer:2.Vz6MkqRYqQiSgvZQdnBytw86Qbs2ZWUkGv22od935YF4s8M7V.\
SeyJpZCI6IiNzZXJ2aWNlLTAiLCJ0IjoiZG0iLCJzIjoiaHR0cHM6Ly9leGFtcGxlLmNvbS9lbmRwb2ludCJ9.\
Xinvalid"
.parse()
.unwrap();
.parse()
.unwrap();

match diddoc_from_peerdid2_elements(
DidDocument::new(did.clone()),
Expand Down

0 comments on commit 2c16a54

Please sign in to comment.