summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/fixtures/identity.rs12
-rw-r--r--src/test/fixtures/login.rs7
2 files changed, 10 insertions, 9 deletions
diff --git a/src/test/fixtures/identity.rs b/src/test/fixtures/identity.rs
index 56b4ffa..c434473 100644
--- a/src/test/fixtures/identity.rs
+++ b/src/test/fixtures/identity.rs
@@ -3,7 +3,7 @@ use uuid::Uuid;
use crate::{
app::App,
clock::RequestedAt,
- login::Password,
+ login::{Login, Password},
token::{
extract::{Identity, IdentityToken},
Secret,
@@ -14,11 +14,11 @@ pub fn not_logged_in() -> IdentityToken {
IdentityToken::new()
}
-pub async fn logged_in(app: &App, login: &(String, Password), now: &RequestedAt) -> IdentityToken {
- let (name, password) = login;
- let token = app
+pub async fn logged_in(app: &App, login: &(Login, Password), now: &RequestedAt) -> IdentityToken {
+ let (login, password) = login;
+ let (_, token) = app
.tokens()
- .login(name, password, now)
+ .login(&login.name, password, now)
.await
.expect("should succeed given known-valid credentials");
@@ -36,7 +36,7 @@ pub async fn from_token(app: &App, token: &IdentityToken, issued_at: &RequestedA
Identity { token, login }
}
-pub async fn identity(app: &App, login: &(String, Password), issued_at: &RequestedAt) -> Identity {
+pub async fn identity(app: &App, login: &(Login, Password), issued_at: &RequestedAt) -> Identity {
let secret = logged_in(app, login, issued_at).await;
from_token(app, &secret, issued_at).await
}
diff --git a/src/test/fixtures/login.rs b/src/test/fixtures/login.rs
index e5ac716..b6766fe 100644
--- a/src/test/fixtures/login.rs
+++ b/src/test/fixtures/login.rs
@@ -7,14 +7,15 @@ use crate::{
login::{self, Login, Password},
};
-pub async fn create_with_password(app: &App, created_at: &RequestedAt) -> (String, Password) {
+pub async fn create_with_password(app: &App, created_at: &RequestedAt) -> (Login, Password) {
let (name, password) = propose();
- app.logins()
+ let login = app
+ .logins()
.create(&name, &password, created_at)
.await
.expect("should always succeed if the login is actually new");
- (name, password)
+ (login, password)
}
pub async fn create(app: &App, created_at: &RequestedAt) -> Login {