feat: def interface to check if user exists
This commit is contained in:
parent
3edafd4f6d
commit
e2cf9460e5
2 changed files with 12 additions and 0 deletions
|
@ -45,6 +45,9 @@ pub trait Federate: Sync + Send {
|
|||
/// check if a forge instance exists
|
||||
async fn forge_exists(&self, hostname: &str) -> Result<bool, Self::Error>;
|
||||
|
||||
/// check if an user exists.
|
||||
async fn user_exists(&self, username: &str, hostname: &str) -> Result<bool, Self::Error>;
|
||||
|
||||
/// create user isntance
|
||||
async fn create_user(&self, f: &AddUser<'_>) -> Result<(), Self::Error>;
|
||||
|
||||
|
|
|
@ -29,8 +29,17 @@ pub async fn adding_forge_works<'a, T: Federate>(
|
|||
assert!(!ff.forge_exists(&create_forge_msg.hostname).await.unwrap());
|
||||
ff.create_forge_isntance(&create_forge_msg).await.unwrap();
|
||||
assert!(ff.forge_exists(&create_forge_msg.hostname).await.unwrap());
|
||||
|
||||
// add user
|
||||
assert!(!ff
|
||||
.user_exists(&create_user_msg.username, &create_user_msg.hostname)
|
||||
.await
|
||||
.unwrap());
|
||||
ff.create_user(&create_user_msg).await.unwrap();
|
||||
assert!(ff
|
||||
.user_exists(&create_user_msg.username, &create_user_msg.hostname)
|
||||
.await
|
||||
.unwrap());
|
||||
|
||||
// add repository
|
||||
ff.create_repository(&add_repo_msg).await.unwrap();
|
||||
|
|
Loading…
Reference in a new issue