1
0
mirror of https://github.com/sismics/docs.git synced 2025-12-17 19:51:39 +00:00

#65: PUT /vocabulary resource

This commit is contained in:
jendib
2016-02-14 19:23:44 +01:00
parent 7f2f480b25
commit d3a74ed361
5 changed files with 379 additions and 273 deletions

View File

@@ -1,7 +1,14 @@
package com.sismics.docs.rest;
import javax.json.JsonObject;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.Form;
import org.junit.Assert;
import org.junit.Test;
import com.sismics.util.filter.TokenBasedSecurityFilter;
/**
* Exhaustive test of the vocabulary resource.
*
@@ -15,5 +22,18 @@ public class TestVocabularyResource extends BaseJerseyTest {
*/
@Test
public void testVocabularyResource() throws Exception {
// Login vocabulary1
clientUtil.createUser("vocabulary1");
String vocabulary1Token = clientUtil.login("vocabulary1");
// Create a vocabulary entry with vocabulary1
JsonObject json = target().path("/vocabulary").request()
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, vocabulary1Token)
.put(Entity.form(new Form()
.param("name", "TEST_VOC_1")
.param("value", "First value")
.param("order", "0")), JsonObject.class);
String vocabulary1Id = json.getString("id");
Assert.assertNotNull(vocabulary1Id);
}
}