diff --git a/federate/federate-core/src/lib.rs b/federate/federate-core/src/lib.rs index b96250b..bad7f94 100644 --- a/federate/federate-core/src/lib.rs +++ b/federate/federate-core/src/lib.rs @@ -54,6 +54,14 @@ pub trait Federate: Sync + Send { /// add repository isntance async fn create_repository(&self, f: &AddRepository<'_>) -> Result<(), Self::Error>; + /// check if a repository exists. + async fn repository_exists( + &self, + name: &str, + owner: &str, + hostname: &str, + ) -> Result; + /// delete user async fn delete_user(&self, username: &str, hostname: &str) -> Result<(), Self::Error>; diff --git a/federate/federate-core/src/tests.rs b/federate/federate-core/src/tests.rs index d966c7a..df9a268 100644 --- a/federate/federate-core/src/tests.rs +++ b/federate/federate-core/src/tests.rs @@ -42,7 +42,15 @@ pub async fn adding_forge_works<'a, T: Federate>( .unwrap()); // add repository + assert!(!ff + .repository_exists(add_repo_msg.name, add_repo_msg.owner, add_repo_msg.hostname) + .await + .unwrap()); ff.create_repository(&add_repo_msg).await.unwrap(); + assert!(ff + .repository_exists(add_repo_msg.name, add_repo_msg.owner, add_repo_msg.hostname) + .await + .unwrap()); // tar() ff.tar().await.unwrap();