fix: return string instead of pathbuf
This commit is contained in:
parent
df1edefb9d
commit
3f088a8cb8
4 changed files with 8 additions and 6 deletions
|
@ -78,7 +78,7 @@ pub trait Federate: Sync + Send {
|
|||
async fn tar(&self) -> Result<PathBuf, Self::Error>;
|
||||
|
||||
/// get latest tar ball
|
||||
async fn latest_tar(&self) -> Result<PathBuf, Self::Error>;
|
||||
async fn latest_tar(&self) -> Result<String, Self::Error>;
|
||||
}
|
||||
|
||||
pub fn get_hostname(url: &Url) -> &str {
|
||||
|
|
|
@ -53,9 +53,9 @@ pub async fn adding_forge_works<'a, T: Federate>(
|
|||
.unwrap());
|
||||
|
||||
// tar()
|
||||
let tar = ff.tar().await.unwrap();
|
||||
let tar = ff.tar().await.unwrap().to_str().unwrap().to_string();
|
||||
let latest = ff.latest_tar().await.unwrap();
|
||||
assert_eq!(tar, latest);
|
||||
assert!(tar.contains(&latest));
|
||||
|
||||
// delete repository
|
||||
ff.delete_repository(add_repo_msg.owner, add_repo_msg.name, &add_repo_msg.url)
|
||||
|
|
|
@ -258,7 +258,7 @@ impl Federate for PccFederate {
|
|||
}
|
||||
|
||||
/// get latest tar ball
|
||||
async fn latest_tar(&self) -> Result<PathBuf, Self::Error> {
|
||||
async fn latest_tar(&self) -> Result<String, Self::Error> {
|
||||
use std::fs::File;
|
||||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
|
||||
|
@ -293,7 +293,6 @@ impl Federate for PccFederate {
|
|||
times.sort();
|
||||
|
||||
let latest = times.pop().unwrap();
|
||||
let latest = Path::new(&self.base_dir).join(format!("{}.tar", latest.to_string()));
|
||||
Ok(latest)
|
||||
Ok(format!("{}.tar", latest))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ async fn everything_works() {
|
|||
let create_forge_msg = CreateForge {
|
||||
url: url.clone(),
|
||||
forge_type: ForgeImplementation::Gitea,
|
||||
import: false,
|
||||
};
|
||||
|
||||
let add_user_msg = AddUser {
|
||||
|
@ -44,6 +45,7 @@ async fn everything_works() {
|
|||
html_link: HTML_PROFILE_URL,
|
||||
profile_photo: None,
|
||||
username: USERNAME,
|
||||
import: false,
|
||||
};
|
||||
|
||||
let add_repo_msg = AddRepository {
|
||||
|
@ -54,6 +56,7 @@ async fn everything_works() {
|
|||
website: None,
|
||||
description: None,
|
||||
url: url.clone(),
|
||||
import: false,
|
||||
};
|
||||
|
||||
let pcc = PccFederate::new(tmp_dir.to_str().unwrap().to_string())
|
||||
|
|
Loading…
Reference in a new issue