feat(registry,daemon): patch package metadata; report workspace info
This commit is contained in:
1 parent
85ff7a8c75
commit
e7698a411d
8 files changed
+250
-4
No files matched your search
+41
-3
@@ -205,6 +205,44 @@ VOID_TEST(RegistryTests, registry_rbac_immutability_csrf_xss_web_and_backup_rest
|
||||
*bytes1);
|
||||
Void::Testing::expect(half_sig_pub.has_value() && half_sig_pub->status == 400);
|
||||
|
||||
// Mutable metadata: an owner can patch the description; invalid updates are rejected.
|
||||
// A private package keeps anonymous search totals unchanged for later assertions.
|
||||
auto meta_pub = send_loopback_http(port, "PUT", "/api/v1/packages/meta-pkg/1.0.0",
|
||||
{{"Authorization", "Bearer " + *alice_tok},
|
||||
{"X-Content-SHA256", *sha1},
|
||||
{"X-Package-Private", "true"}},
|
||||
*bytes1);
|
||||
Void::Testing::expect(meta_pub.has_value() && meta_pub->status == 201);
|
||||
auto patched = send_loopback_http(
|
||||
port, "PATCH", "/api/v1/packages/meta-pkg",
|
||||
{{"Authorization", "Bearer " + *alice_tok}, {"Content-Type", "application/json"}},
|
||||
"{\"description\":\"patched description\"}");
|
||||
Void::Testing::expect(patched.has_value() && patched->status == 200);
|
||||
auto patched_detail = send_loopback_http(port, "GET", "/api/v1/packages/meta-pkg",
|
||||
{{"Authorization", "Bearer " + *alice_tok}});
|
||||
Void::Testing::expect(patched_detail.has_value() && patched_detail->status == 200);
|
||||
if (patched_detail) {
|
||||
Void::Testing::expect(patched_detail->body.find("patched description") !=
|
||||
std::string::npos);
|
||||
}
|
||||
auto patch_no_auth = send_loopback_http(port, "PATCH", "/api/v1/packages/meta-pkg", {},
|
||||
"{\"description\":\"x\"}");
|
||||
Void::Testing::expect(patch_no_auth.has_value() && patch_no_auth->status == 401);
|
||||
auto patch_non_owner = send_loopback_http(
|
||||
port, "PATCH", "/api/v1/packages/meta-pkg",
|
||||
{{"Authorization", "Bearer " + *bob_tok}, {"Content-Type", "application/json"}},
|
||||
"{\"description\":\"x\"}");
|
||||
Void::Testing::expect(patch_non_owner.has_value() && patch_non_owner->status == 403);
|
||||
auto patch_empty = send_loopback_http(
|
||||
port, "PATCH", "/api/v1/packages/meta-pkg",
|
||||
{{"Authorization", "Bearer " + *alice_tok}, {"Content-Type", "application/json"}}, "{}");
|
||||
Void::Testing::expect(patch_empty.has_value() && patch_empty->status == 400);
|
||||
auto patch_bad_private = send_loopback_http(
|
||||
port, "PATCH", "/api/v1/packages/meta-pkg",
|
||||
{{"Authorization", "Bearer " + *alice_tok}, {"Content-Type", "application/json"}},
|
||||
"{\"private\":\"yes\"}");
|
||||
Void::Testing::expect(patch_bad_private.has_value() && patch_bad_private->status == 400);
|
||||
|
||||
// Package ownership management (bearer tokens are not ambient browser credentials).
|
||||
auto owner_pkg_pub = send_loopback_http(
|
||||
port, "PUT", "/api/v1/packages/owner-pkg/1.0.0",
|
||||
@@ -878,15 +916,15 @@ VOID_TEST(RegistryTests, registry_binary_variant_publish_download_and_materializ
|
||||
Void::Testing::expect(etag_it != etag_head->headers.end());
|
||||
if (etag_it != etag_head->headers.end()) {
|
||||
auto cached = send_loopback_http(port, "GET", binary_path + "/download",
|
||||
{{"If-None-Match", etag_it->second}});
|
||||
{{"If-None-Match", etag_it->second}});
|
||||
Void::Testing::expect(cached.has_value() && cached->status == 304);
|
||||
if (cached) {
|
||||
Void::Testing::expect(cached->body.empty());
|
||||
}
|
||||
}
|
||||
}
|
||||
auto ranged = send_loopback_http(port, "GET", binary_path + "/download",
|
||||
{{"Range", "bytes=0-3"}});
|
||||
auto ranged =
|
||||
send_loopback_http(port, "GET", binary_path + "/download", {{"Range", "bytes=0-3"}});
|
||||
Void::Testing::expect(ranged.has_value() && ranged->status == 206);
|
||||
if (ranged) {
|
||||
Void::Testing::expect_eq(ranged->body, artifact.substr(0, 4));
|
||||
|
||||
Reference in new issue
Block a user