feat: def interface to check if repository exists

This commit is contained in:
Aravinth Manivannan 2022-06-04 21:29:59 +05:30
parent 5e8c3a10cf
commit 76cd9a0fd6
Signed by: realaravinth
GPG key ID: AD9F0F08E855ED88
2 changed files with 16 additions and 0 deletions

View file

@ -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<bool, Self::Error>;
/// delete user
async fn delete_user(&self, username: &str, hostname: &str) -> Result<(), Self::Error>;

View file

@ -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();