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

Tag colors (client)

This commit is contained in:
jendib
2013-08-08 01:38:30 +02:00
parent b2ab313d11
commit 6c347ff826
20 changed files with 802 additions and 27 deletions

View File

@@ -38,7 +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");
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);
@@ -76,7 +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"));
Assert.assertEquals("#ffff00", tags.getJSONObject(0).getString("color"));
// Search documents by query
documentResource = resource().path("/document/list");
@@ -143,7 +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");
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,7 +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");
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);
@@ -47,7 +47,7 @@ public class TestTagResource extends BaseJerseyTest {
tagResource.addFilter(new CookieAuthenticationFilter(tag1Token));
postParams = new MultivaluedMapImpl();
postParams.add("name", "Tag 4");
postParams.add("color", "00ff00");
postParams.add("color", "#00ff00");
response = tagResource.put(ClientResponse.class, postParams);
Assert.assertEquals(Status.OK, Status.fromStatusCode(response.getStatus()));
json = response.getEntity(JSONObject.class);
@@ -94,14 +94,14 @@ public class TestTagResource extends BaseJerseyTest {
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"));
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");
postParams.add("color", "#0000ff");
response = tagResource.post(ClientResponse.class, postParams);
Assert.assertEquals(Status.OK, Status.fromStatusCode(response.getStatus()));
json = response.getEntity(JSONObject.class);
@@ -116,7 +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"));
Assert.assertEquals("#0000ff", tags.getJSONObject(1).getString("color"));
// Deletes a tag
tagResource = resource().path("/tag/" + tag4Id);