mirror of
https://github.com/sismics/docs.git
synced 2025-12-17 03:31:48 +00:00
#83: GET /tag/id
This commit is contained in:
@@ -291,6 +291,12 @@ public class TestAclResource extends BaseJerseyTest {
|
||||
JsonArray tags = json.getJsonArray("tags");
|
||||
Assert.assertEquals(0, tags.size());
|
||||
|
||||
// acltag2 cannot see tag1
|
||||
response = target().path("/tag/" + tag1Id).request()
|
||||
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, acltag2Token)
|
||||
.get();
|
||||
Assert.assertEquals(Status.NOT_FOUND.getStatusCode(), response.getStatus());
|
||||
|
||||
// acltag2 cannot see any document
|
||||
json = target().path("/document/list")
|
||||
.queryParam("sort_column", 3)
|
||||
@@ -327,6 +333,13 @@ public class TestAclResource extends BaseJerseyTest {
|
||||
.param("target", "acltag2")
|
||||
.param("type", "USER")), JsonObject.class);
|
||||
|
||||
// acltag2 can see tag1
|
||||
json = target().path("/tag/" + tag1Id).request()
|
||||
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, acltag2Token)
|
||||
.get(JsonObject.class);
|
||||
Assert.assertFalse(json.getBoolean("writable"));
|
||||
Assert.assertEquals(3, json.getJsonArray("acls").size());
|
||||
|
||||
// acltag2 still cannot edit tag1
|
||||
response = target().path("/tag/" + tag1Id).request()
|
||||
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, acltag2Token)
|
||||
@@ -379,6 +392,13 @@ public class TestAclResource extends BaseJerseyTest {
|
||||
.param("target", "acltag2")
|
||||
.param("type", "USER")), JsonObject.class);
|
||||
|
||||
// acltag2 can see and edit tag1
|
||||
json = target().path("/tag/" + tag1Id).request()
|
||||
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, acltag2Token)
|
||||
.get(JsonObject.class);
|
||||
Assert.assertTrue(json.getBoolean("writable"));
|
||||
Assert.assertEquals(4, json.getJsonArray("acls").size());
|
||||
|
||||
// acltag2 can edit tag1
|
||||
target().path("/tag/" + tag1Id).request()
|
||||
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, acltag2Token)
|
||||
|
||||
@@ -46,6 +46,16 @@ public class TestTagResource extends BaseJerseyTest {
|
||||
.param("parent", tag3Id)), JsonObject.class);
|
||||
String tag4Id = json.getString("id");
|
||||
Assert.assertNotNull(tag4Id);
|
||||
|
||||
// Get the tag
|
||||
json = target().path("/tag/" + tag4Id).request()
|
||||
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, tag1Token)
|
||||
.get(JsonObject.class);
|
||||
Assert.assertEquals("Tag4", json.getString("name"));
|
||||
Assert.assertEquals("#00ff00", json.getString("color"));
|
||||
Assert.assertTrue(json.getBoolean("writable"));
|
||||
JsonArray acls = json.getJsonArray("acls");
|
||||
Assert.assertEquals(2, acls.size());
|
||||
|
||||
// Create a tag with space (not allowed)
|
||||
Response response = target().path("/tag").request()
|
||||
|
||||
Reference in New Issue
Block a user