1
0
mirror of https://github.com/sismics/docs.git synced 2025-12-16 11:15:07 +00:00

Edition of tag name (server)

This commit is contained in:
jendib
2013-07-31 21:02:08 +02:00
parent 4dc5cb12b3
commit 6c1354a2f6
3 changed files with 58 additions and 2 deletions

View File

@@ -51,6 +51,26 @@ public class TestTagResource extends BaseJerseyTest {
JSONArray tags = json.getJSONArray("tags");
Assert.assertTrue(tags.length() > 0);
// Update a document
tagResource = resource().path("/tag/" + tag3Id);
tagResource.addFilter(new CookieAuthenticationFilter(tag1Token));
postParams = new MultivaluedMapImpl();
postParams.add("name", "Updated name");
response = tagResource.post(ClientResponse.class, postParams);
Assert.assertEquals(Status.OK, Status.fromStatusCode(response.getStatus()));
json = response.getEntity(JSONObject.class);
Assert.assertEquals(tag3Id, json.getString("id"));
// Get all tags
tagResource = resource().path("/tag/list");
tagResource.addFilter(new CookieAuthenticationFilter(tag1Token));
response = tagResource.get(ClientResponse.class);
Assert.assertEquals(Status.OK, Status.fromStatusCode(response.getStatus()));
json = response.getEntity(JSONObject.class);
tags = json.getJSONArray("tags");
Assert.assertTrue(tags.length() > 0);
Assert.assertEquals("Updated name", tags.getJSONObject(0).getString("name"));
// Deletes a tag
tagResource = resource().path("/tag/" + tag3Id);
tagResource.addFilter(new CookieAuthenticationFilter(tag1Token));