feat: def forge_exists interface

This commit is contained in:
Aravinth Manivannan 2022-06-03 23:10:31 +05:30
parent 6fb71e0641
commit 0d0f5270fd
Signed by: realaravinth
GPG key ID: AD9F0F08E855ED88
2 changed files with 5 additions and 0 deletions

View file

@ -42,6 +42,9 @@ pub trait Federate: Sync + Send {
/// delete forge isntance
async fn delete_forge_instance(&self, hostname: &str) -> Result<(), Self::Error>;
/// check if a forge instance exists
async fn forge_exists(&self, hostname: &str) -> Result<bool, Self::Error>;
/// create user isntance
async fn create_user(&self, f: &AddUser<'_>) -> Result<(), Self::Error>;

View file

@ -26,7 +26,9 @@ pub async fn adding_forge_works<'a, T: Federate>(
add_repo_msg: AddRepository<'a>,
) {
let _ = ff.delete_forge_instance(create_forge_msg.hostname).await;
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
ff.create_user(&create_user_msg).await.unwrap();