mirror of
https://github.com/sismics/docs.git
synced 2025-12-16 03:06:22 +00:00
Closes #30: Delete locale & theme concept
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
package com.sismics.docs.rest;
|
||||
|
||||
import javax.json.JsonArray;
|
||||
import javax.json.JsonObject;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
/**
|
||||
* Test the locale resource.
|
||||
*
|
||||
* @author jtremeaux
|
||||
*/
|
||||
public class TestLocaleResource extends BaseJerseyTest {
|
||||
/**
|
||||
* Test the locale resource.
|
||||
*
|
||||
* @throws JSONException
|
||||
*/
|
||||
@Test
|
||||
public void testLocaleResource() {
|
||||
JsonObject json = target().path("/locale").request().get(JsonObject.class);
|
||||
JsonArray locale = json.getJsonArray("locales");
|
||||
Assert.assertTrue(locale.size() > 0);
|
||||
}
|
||||
}
|
||||
@@ -51,10 +51,8 @@ public class TestSecurity extends BaseJerseyTest {
|
||||
// User testsecurity changes his email OK
|
||||
json = target().path("/user").request()
|
||||
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, testSecurityAuthenticationToken)
|
||||
.post(Entity.form(
|
||||
new Form()
|
||||
.param("email", "testsecurity2@docs.com")
|
||||
.param("locale", "en")), JsonObject.class);
|
||||
.post(Entity.form(new Form()
|
||||
.param("email", "testsecurity2@docs.com")), JsonObject.class);
|
||||
Assert.assertEquals("ok", json.getString("status"));
|
||||
|
||||
// User testsecurity logs out
|
||||
|
||||
@@ -154,7 +154,6 @@ public class TestUserResource extends BaseJerseyTest {
|
||||
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, aliceAuthToken)
|
||||
.get(JsonObject.class);
|
||||
Assert.assertEquals("alice@docs.com", json.getString("email"));
|
||||
Assert.assertFalse(json.getBoolean("first_connection"));
|
||||
Assert.assertFalse(json.getBoolean("is_default_password"));
|
||||
|
||||
// Check bob user information
|
||||
@@ -220,21 +219,20 @@ public class TestUserResource extends BaseJerseyTest {
|
||||
JsonObject json = target().path("/user").request()
|
||||
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, adminAuthenticationToken)
|
||||
.get(JsonObject.class);
|
||||
Assert.assertTrue(json.getBoolean("first_connection"));
|
||||
Assert.assertTrue(json.getBoolean("is_default_password"));
|
||||
|
||||
// User admin updates his information
|
||||
json = target().path("/user").request()
|
||||
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, adminAuthenticationToken)
|
||||
.post(Entity.form(new Form()
|
||||
.param("first_connection", "false")), JsonObject.class);
|
||||
.param("email", "newadminemail@docs.com")), JsonObject.class);
|
||||
Assert.assertEquals("ok", json.getString("status"));
|
||||
|
||||
// Check admin information update
|
||||
json = target().path("/user").request()
|
||||
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, adminAuthenticationToken)
|
||||
.get(JsonObject.class);
|
||||
Assert.assertFalse(json.getBoolean("first_connection"));
|
||||
Assert.assertEquals("newadminemail@docs.com", json.getString("email"));
|
||||
|
||||
// User admin update admin_user1 information
|
||||
json = target().path("/user").request()
|
||||
|
||||
Reference in New Issue
Block a user