From 25d78c14b1b1ea05db908e8d9052d39adc0e8ecc Mon Sep 17 00:00:00 2001 From: n-dusan Date: Wed, 13 Dec 2023 19:25:56 +0100 Subject: [PATCH] feat: work on initializing repositories.json --- tests/archive_testtools/mod.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/archive_testtools/mod.rs b/tests/archive_testtools/mod.rs index 3661f2f..7f70ef9 100644 --- a/tests/archive_testtools/mod.rs +++ b/tests/archive_testtools/mod.rs @@ -180,6 +180,29 @@ pub fn get_basic_test_data_repositories() -> Result> for Repository { + fn from(context: TestDataRepositoryContext) -> Self { + let mut custom = Custom::default(); + custom.repository_type = Some(match context.kind { + TestDataRepositoryType::Html => "html".to_string(), + TestDataRepositoryType::Rdf => "rdf".to_string(), + TestDataRepositoryType::Xml => "xml".to_string(), + TestDataRepositoryType::Pdf => "pdf".to_string(), + TestDataRepositoryType::Other(_) => "other".to_string(), + }); + custom.serve = "latest".to_string(); + custom.scope = context.serve_prefix.map(|s| s.to_string()); + custom.routes = context + .route_glob_patterns + .map(|r| r.iter().map(|s| s.to_string()).collect()); + custom.is_fallback = Some(context.is_fallback); + Self { + name: context.name.to_string(), + custom, + } + } +} + pub struct GitRepository { pub repo: git2::Repository, pub path: PathBuf,