Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
minwoox committed Nov 18, 2024
1 parent 1ffab05 commit 35459a1
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void grantPermissionToMemberForMetaRepository() throws Exception {
assertThat(res.status()).isSameAs(HttpStatus.FORBIDDEN);
assertThat(res.contentUtf8()).contains("You must have READ permission for repository");

// Grant a READ permission to the member.
// Grant a READ permission to the member with the legacy format.
request = HttpRequest.builder()
.post("/api/v1/metadata/" + projectName + "/repos/meta/perm/role")
.content(MediaType.JSON,
Expand All @@ -115,5 +115,20 @@ void grantPermissionToMemberForMetaRepository() throws Exception {
// Now the member can access the meta repository.
res = memberClient.get("/api/v1/projects/" + projectName + "/repos/meta/list").aggregate().join();
assertThat(res.status()).isSameAs(HttpStatus.NO_CONTENT);

// With the new format.
request = HttpRequest.builder()
.post("/api/v1/metadata/" + projectName + "/repos/meta/perm/role")
.content(MediaType.JSON,
'{' +
" \"member\": null," +
" \"guest\": null" +
'}')
.build();
adminClient.execute(request).aggregate().join();

// Now the member cannot access the meta repository.
res = memberClient.get("/api/v1/projects/" + projectName + "/repos/meta/list").aggregate().join();
assertThat(res.status()).isSameAs(HttpStatus.FORBIDDEN);
}
}

0 comments on commit 35459a1

Please sign in to comment.