Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrylavrenov committed May 7, 2024
1 parent a32730e commit 2b9c452
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions crates/facetec-api-client/src/enrollment3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ mod tests {
response,
Response {
external_database_ref_id,
scan_result_blob: None,
scan_result_blob,
success: false,
face_scan: FaceScanResponse {
face_scan_security_checks: FaceScanSecurityChecks {
Expand All @@ -221,7 +221,7 @@ mod tests {
retry_screen_enum_int: 0,
age_estimate_group_enum_int: 2,
},
} if external_database_ref_id == "qwe"
} if external_database_ref_id == "qwe" && scan_result_blob == Some("AQEAAABCAAAAAAAAABod8Ab2TBI4O9XmVyim3AxlDaV4QoP2eFBAmQTkB2dOiL4becto+NXWqUxdo6JBjSUoreo9Lm7MToQFpqj/HB+Hzw\\u003d\\u003d".to_owned())
)
}

Expand Down
11 changes: 9 additions & 2 deletions crates/robonode-client/src/enroll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,17 @@ mod tests {
public_key: b"123",
liveness_data_signature: b"signature",
};
let sample_response = serde_json::json!({
"scanResultBlob": "scanResultBlob"
});

let expected_response: EnrollResponse =
serde_json::from_value(sample_response.clone()).unwrap();

Mock::given(matchers::method("POST"))
.and(matchers::path("/enroll"))
.and(matchers::body_json(&sample_request))
.respond_with(ResponseTemplate::new(201))
.respond_with(ResponseTemplate::new(201).set_body_json(&sample_response))
.mount(&mock_server)
.await;

Expand All @@ -143,7 +149,8 @@ mod tests {
reqwest: reqwest::Client::new(),
};

client.enroll(sample_request).await.unwrap();
let actual_response = client.enroll(sample_request).await.unwrap();
assert_eq!(actual_response, expected_response);
}

#[tokio::test]
Expand Down

0 comments on commit 2b9c452

Please sign in to comment.