Refactor tests and stubs: update parsed_manifest assertions with more descriptive values and simplify unused variable patterns in repository rest backend methods.

This commit is contained in:
Till Wegmueller 2025-07-26 18:04:58 +02:00
parent 3ea955fc5f
commit b451099b54
No known key found for this signature in database
2 changed files with 8 additions and 8 deletions

View file

@ -263,12 +263,12 @@ impl ReadableRepository for RestBackend {
fn list_packages( fn list_packages(
&self, &self,
publisher: Option<&str>, publisher: Option<&str>,
pattern: Option<&str>, _pattern: Option<&str>,
) -> Result<Vec<PackageInfo>> { ) -> Result<Vec<PackageInfo>> {
// This is a stub implementation // This is a stub implementation
// In a real implementation, we would make a REST API call to list packages // In a real implementation, we would make a REST API call to list packages
let mut packages = Vec::new(); let packages = Vec::new();
// Filter publishers if specified // Filter publishers if specified
let publishers = if let Some(pub_name) = publisher { let publishers = if let Some(pub_name) = publisher {
@ -281,7 +281,7 @@ impl ReadableRepository for RestBackend {
}; };
// For each publisher, list packages // For each publisher, list packages
for pub_name in publishers { for _pub_name in publishers {
// In a real implementation, we would make a REST API call to get package information // In a real implementation, we would make a REST API call to get package information
// The API call would return a list of packages with their names, versions, and other metadata // The API call would return a list of packages with their names, versions, and other metadata
// We would then parse this information and create PackageInfo structs // We would then parse this information and create PackageInfo structs
@ -400,9 +400,9 @@ impl ReadableRepository for RestBackend {
fn search( fn search(
&self, &self,
query: &str, _query: &str,
publisher: Option<&str>, _publisher: Option<&str>,
limit: Option<usize>, _limit: Option<usize>,
) -> Result<Vec<PackageInfo>> { ) -> Result<Vec<PackageInfo>> {
todo!() todo!()
} }

View file

@ -54,7 +54,7 @@ mod tests {
// Verify that the parsed manifest has the expected attributes // Verify that the parsed manifest has the expected attributes
assert_eq!(parsed_manifest.attributes.len(), 1); assert_eq!(parsed_manifest.attributes.len(), 1);
assert_eq!(parsed_manifest.attributes[0].key, "name"); assert_eq!(parsed_manifest.attributes[0].key, "pkg.fmri");
assert_eq!(parsed_manifest.attributes[0].values[0], "pkg.fmri"); assert_eq!(parsed_manifest.attributes[0].values[0], "pkg://test/example@1.0.0");
} }
} }