Skip to content

Commit 8f3fc10

Browse files
committed
test: add APIs to create dom@example.net and elena@example.net
1 parent 97b0d09 commit 8f3fc10

File tree

1 file changed

+57
-1
lines changed

1 file changed

+57
-1
lines changed

src/test_utils.rs

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,22 @@ impl TestContextManager {
8989
.await
9090
}
9191

92+
pub async fn dom(&mut self) -> TestContext {
93+
TestContext::builder()
94+
.configure_dom()
95+
.with_log_sink(self.log_sink.clone())
96+
.build()
97+
.await
98+
}
99+
100+
pub async fn elena(&mut self) -> TestContext {
101+
TestContext::builder()
102+
.configure_elena()
103+
.with_log_sink(self.log_sink.clone())
104+
.build()
105+
.await
106+
}
107+
92108
pub async fn fiona(&mut self) -> TestContext {
93109
TestContext::builder()
94110
.configure_fiona()
@@ -249,11 +265,25 @@ impl TestContextBuilder {
249265

250266
/// Configures as charlie@example.net with fixed secret key.
251267
///
252-
/// This is a shortcut for `.with_key_pair(fiona_keypair())`.
268+
/// This is a shortcut for `.with_key_pair(charlie_keypair())`.
253269
pub fn configure_charlie(self) -> Self {
254270
self.with_key_pair(charlie_keypair())
255271
}
256272

273+
/// Configures as dom@example.net with fixed secret key.
274+
///
275+
/// This is a shortcut for `.with_key_pair(dom_keypair())`.
276+
pub fn configure_dom(self) -> Self {
277+
self.with_key_pair(dom_keypair())
278+
}
279+
280+
/// Configures as elena@example.net with fixed secret key.
281+
///
282+
/// This is a shortcut for `.with_key_pair(elena_keypair())`.
283+
pub fn configure_elena(self) -> Self {
284+
self.with_key_pair(elena_keypair())
285+
}
286+
257287
/// Configures as fiona@example.net with fixed secret key.
258288
///
259289
/// This is a shortcut for `.with_key_pair(fiona_keypair())`.
@@ -1148,6 +1178,32 @@ pub fn charlie_keypair() -> KeyPair {
11481178
KeyPair { public, secret }
11491179
}
11501180

1181+
/// Load a pre-generated keypair for dom@example.net from disk.
1182+
///
1183+
/// Like [alice_keypair] but a different key and identity.
1184+
pub fn dom_keypair() -> KeyPair {
1185+
let public = key::SignedPublicKey::from_asc(include_str!("../test-data/key/dom-public.asc"))
1186+
.unwrap()
1187+
.0;
1188+
let secret = key::SignedSecretKey::from_asc(include_str!("../test-data/key/dom-secret.asc"))
1189+
.unwrap()
1190+
.0;
1191+
KeyPair { public, secret }
1192+
}
1193+
1194+
/// Load a pre-generated keypair for elena@example.net from disk.
1195+
///
1196+
/// Like [alice_keypair] but a different key and identity.
1197+
pub fn elena_keypair() -> KeyPair {
1198+
let public = key::SignedPublicKey::from_asc(include_str!("../test-data/key/elena-public.asc"))
1199+
.unwrap()
1200+
.0;
1201+
let secret = key::SignedSecretKey::from_asc(include_str!("../test-data/key/elena-secret.asc"))
1202+
.unwrap()
1203+
.0;
1204+
KeyPair { public, secret }
1205+
}
1206+
11511207
/// Load a pre-generated keypair for fiona@example.net from disk.
11521208
///
11531209
/// Like [alice_keypair] but a different key and identity.

0 commit comments

Comments
 (0)