1
0
mirror of https://github.com/sismics/docs.git synced 2025-12-16 03:06:22 +00:00

Tag colors (server)

This commit is contained in:
jendib
2013-08-07 23:45:47 +02:00
parent 1deda6e993
commit b2ab313d11
12 changed files with 90 additions and 13 deletions

View File

@@ -38,6 +38,7 @@ public class TestDocumentResource extends BaseJerseyTest {
tagResource.addFilter(new CookieAuthenticationFilter(document1Token));
MultivaluedMapImpl postParams = new MultivaluedMapImpl();
postParams.add("name", "Super tag");
postParams.add("color", "ffff00");
ClientResponse response = tagResource.put(ClientResponse.class, postParams);
Assert.assertEquals(Status.OK, Status.fromStatusCode(response.getStatus()));
JSONObject json = response.getEntity(JSONObject.class);
@@ -75,6 +76,7 @@ public class TestDocumentResource extends BaseJerseyTest {
Assert.assertEquals(1, tags.length());
Assert.assertEquals(tag1Id, tags.getJSONObject(0).getString("id"));
Assert.assertEquals("Super tag", tags.getJSONObject(0).getString("name"));
Assert.assertEquals("ffff00", tags.getJSONObject(0).getString("color"));
// Search documents by query
documentResource = resource().path("/document/list");
@@ -141,6 +143,7 @@ public class TestDocumentResource extends BaseJerseyTest {
tagResource.addFilter(new CookieAuthenticationFilter(document1Token));
postParams = new MultivaluedMapImpl();
postParams.add("name", "Super tag 2");
postParams.add("color", "00ffff");
response = tagResource.put(ClientResponse.class, postParams);
Assert.assertEquals(Status.OK, Status.fromStatusCode(response.getStatus()));
json = response.getEntity(JSONObject.class);

View File

@@ -35,6 +35,7 @@ public class TestTagResource extends BaseJerseyTest {
tagResource.addFilter(new CookieAuthenticationFilter(tag1Token));
MultivaluedMapImpl postParams = new MultivaluedMapImpl();
postParams.add("name", "Tag 3");
postParams.add("color", "ff0000");
ClientResponse response = tagResource.put(ClientResponse.class, postParams);
Assert.assertEquals(Status.OK, Status.fromStatusCode(response.getStatus()));
JSONObject json = response.getEntity(JSONObject.class);
@@ -46,6 +47,7 @@ public class TestTagResource extends BaseJerseyTest {
tagResource.addFilter(new CookieAuthenticationFilter(tag1Token));
postParams = new MultivaluedMapImpl();
postParams.add("name", "Tag 4");
postParams.add("color", "00ff00");
response = tagResource.put(ClientResponse.class, postParams);
Assert.assertEquals(Status.OK, Status.fromStatusCode(response.getStatus()));
json = response.getEntity(JSONObject.class);
@@ -91,12 +93,15 @@ public class TestTagResource extends BaseJerseyTest {
json = response.getEntity(JSONObject.class);
JSONArray tags = json.getJSONArray("tags");
Assert.assertTrue(tags.length() > 0);
Assert.assertEquals("Tag 4", tags.getJSONObject(1).getString("name"));
Assert.assertEquals("00ff00", tags.getJSONObject(1).getString("color"));
// Update a tag
tagResource = resource().path("/tag/" + tag4Id);
tagResource.addFilter(new CookieAuthenticationFilter(tag1Token));
postParams = new MultivaluedMapImpl();
postParams.add("name", "Updated name");
postParams.add("color", "0000ff");
response = tagResource.post(ClientResponse.class, postParams);
Assert.assertEquals(Status.OK, Status.fromStatusCode(response.getStatus()));
json = response.getEntity(JSONObject.class);
@@ -111,6 +116,7 @@ public class TestTagResource extends BaseJerseyTest {
tags = json.getJSONArray("tags");
Assert.assertTrue(tags.length() > 0);
Assert.assertEquals("Updated name", tags.getJSONObject(1).getString("name"));
Assert.assertEquals("0000ff", tags.getJSONObject(1).getString("color"));
// Deletes a tag
tagResource = resource().path("/tag/" + tag4Id);