feat(registry): paginate package search results
This commit is contained in:
1 parent
41a74bc925
commit
7bd04718df
6 files changed
+73
-8
No files matched your search
@@ -230,6 +230,22 @@ VOID_TEST(RegistryTests, registry_rbac_immutability_csrf_xss_web_and_backup_rest
|
||||
Void::Testing::expect(audit->body.find(*alice_tok) == std::string::npos);
|
||||
}
|
||||
|
||||
// Package search pagination: bounded page plus total/limit/offset envelope.
|
||||
auto page = send_loopback_http(port, "GET", "/api/v1/packages?limit=1&offset=0");
|
||||
Void::Testing::expect(page.has_value() && page->status == 200);
|
||||
if (page) {
|
||||
Void::Testing::expect(page->body.find("\"total\":") != std::string::npos);
|
||||
Void::Testing::expect(page->body.find("\"limit\":1") != std::string::npos);
|
||||
std::size_t name_occurrences = 0;
|
||||
for (std::size_t pos = page->body.find("\"name\":"); pos != std::string::npos;
|
||||
pos = page->body.find("\"name\":", pos + 1)) {
|
||||
++name_occurrences;
|
||||
}
|
||||
Void::Testing::expect(name_occurrences == 1);
|
||||
}
|
||||
auto bad_limit = send_loopback_http(port, "GET", "/api/v1/packages?limit=501");
|
||||
Void::Testing::expect(bad_limit.has_value() && bad_limit->status == 400);
|
||||
|
||||
// 4. Consistent backup & restore into a brand-new registry instance preserves releases &
|
||||
// download!
|
||||
const auto backup_dir = tmp / "backup";
|
||||
|
||||
Reference in new issue
Block a user