[Remote signer] Add signer consumer lib (#1763)

Adds a library `common/remote_signer_consumer`
This commit is contained in:
Herman Junge
2020-11-19 04:04:52 +00:00
parent 3db9072fee
commit 1a530e5a93
19 changed files with 2233 additions and 320 deletions

View File

@@ -0,0 +1,20 @@
use crate::*;
use httpmock::{Method::POST, MockServer};
use tokio::time::Duration;
pub fn set_up_mock_server(status: u16, body: &str) -> MockServer {
set_up_mock_server_with_timeout(status, body, 0)
}
pub fn set_up_mock_server_with_timeout(status: u16, body: &str, delay: u64) -> MockServer {
let server = MockServer::start();
server.mock(|when, then| {
when.method(POST).path(format!("/sign/{}", PUBLIC_KEY_1));
then.status(status)
.delay(Duration::from_secs(delay))
.body(body);
});
server
}