fix tests

This commit is contained in:
Joe Ardent 2024-01-15 14:11:30 -08:00
parent ba3e8625f6
commit 88b870031e

View file

@ -438,9 +438,11 @@ mod test {
// this function adds a user with the omega id, so the invite can be added // this function adds a user with the omega id, so the invite can be added
let server = server_with_pool(&pool).await; let server = server_with_pool(&pool).await;
let invite = let invite = Invitation::new(Julid::omega())
Invitation::new(Julid::omega()).with_expires_in(Duration::from_millis(1)); .with_expires_in(Duration::from_millis(1))
let invite = invite.commit(&pool).await.unwrap(); .commit(&pool)
.await
.unwrap();
std::thread::sleep(Duration::from_millis(100)); std::thread::sleep(Duration::from_millis(100));
@ -611,7 +613,7 @@ mod test {
.await; .await;
// no user in db // no user in db
let user = User::try_get("bad_user", &pool).await; let user = User::try_get("", &pool).await;
assert!(user.is_ok() && user.unwrap().is_none()); assert!(user.is_ok() && user.unwrap().is_none());
let body = std::str::from_utf8(resp.as_bytes()).unwrap(); let body = std::str::from_utf8(resp.as_bytes()).unwrap();
@ -640,7 +642,7 @@ mod test {
.await; .await;
// no user in db // no user in db
let user = User::try_get("bad_user", &pool).await; let user = User::try_get("bad_user12345678901234567890", &pool).await;
assert!(user.is_ok() && user.unwrap().is_none()); assert!(user.is_ok() && user.unwrap().is_none());
let body = std::str::from_utf8(resp.as_bytes()).unwrap(); let body = std::str::from_utf8(resp.as_bytes()).unwrap();
@ -669,7 +671,7 @@ mod test {
// get the new user from the db // get the new user from the db
let user = User::try_get("good_user", &pool).await; let user = User::try_get("good_user", &pool).await;
assert!(user.is_ok()); assert!(user.unwrap().is_some());
// now try again // now try again
let resp = server let resp = server