Skip to content

Commit

Permalink
fix: signer raised error when register_signature returned 202
Browse files Browse the repository at this point in the history
  • Loading branch information
Alenar committed Oct 9, 2024
1 parent ed87bdc commit 02cd14d
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion mithril-signer/src/services/aggregator_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ impl AggregatorClient for AggregatorHTTPClient {

match response {
Ok(response) => match response.status() {
StatusCode::CREATED => Ok(()),
StatusCode::CREATED | StatusCode::ACCEPTED => Ok(()),
StatusCode::GONE => {
debug!(self.logger, "Aggregator already certified that message"; "signed_entity_type" => ?signed_entity_type);
Ok(())
Expand Down Expand Up @@ -899,6 +899,31 @@ mod tests {
register_signatures.expect("unexpected error");
}

#[tokio::test]
async fn test_register_signatures_ok_202() {
let single_signatures = fake_data::single_signatures((1..5).collect());
let (server, config, api_version_provider) = setup_test();
let _server_mock = server.mock(|when, then| {
when.method(POST).path("/register-signatures");
then.status(202);
});
let certificate_handler = AggregatorHTTPClient::new(
config.aggregator_endpoint,
config.relay_endpoint,
Arc::new(api_version_provider),
None,
TestLogger::stdout(),
);
let register_signatures = certificate_handler
.register_signatures(
&SignedEntityType::dummy(),
&single_signatures,
&ProtocolMessage::default(),
)
.await;
register_signatures.expect("unexpected error");
}

#[tokio::test]
async fn test_register_signatures_ko_412() {
let (server, config, api_version_provider) = setup_test();
Expand Down

0 comments on commit 02cd14d

Please sign in to comment.