Keiichi Watanabe 8 年之前
父節點
當前提交
7171b12ed9

+ 2 - 2
src/main/java/org/codelibs/fess/app/web/api/admin/role/ApiAdminRoleAction.java

@@ -36,8 +36,8 @@ public class ApiAdminRoleAction extends FessApiAdminAction {
     @Resource
     @Resource
     private RoleService roleService;
     private RoleService roleService;
 
 
-    // GET /api/admin/role
-    // POST /api/admin/role
+    // GET /api/admin/role/settings
+    // POST /api/admin/role/settings
     @Execute
     @Execute
     public JsonResponse<ApiResult> settings(final SearchBody body) {
     public JsonResponse<ApiResult> settings(final SearchBody body) {
         validateApi(body, messages -> {});
         validateApi(body, messages -> {});

+ 2 - 2
src/main/java/org/codelibs/fess/app/web/api/admin/user/ApiAdminUserAction.java

@@ -36,8 +36,8 @@ public class ApiAdminUserAction extends FessApiAdminAction {
     @Resource
     @Resource
     private UserService userService;
     private UserService userService;
 
 
-    // GET /api/admin/user
-    // POST /api/admin/user
+    // GET /api/admin/user/settings
+    // POST /api/admin/user/settings
     @Execute
     @Execute
     public JsonResponse<ApiResult> settings(final SearchBody body) {
     public JsonResponse<ApiResult> settings(final SearchBody body) {
         validateApi(body, messages -> {});
         validateApi(body, messages -> {});

+ 1 - 1
src/test/java/org/codelibs/fess/it/CrudTestBase.java

@@ -164,7 +164,7 @@ public abstract class CrudTestBase extends ITBase {
         for (Map.Entry<String, Object> entry : updateMap.entrySet()) {
         for (Map.Entry<String, Object> entry : updateMap.entrySet()) {
             List<String> updatedList = getPropList(searchBody, entry.getKey());
             List<String> updatedList = getPropList(searchBody, entry.getKey());
             for (String val : updatedList) {
             for (String val : updatedList) {
-                assertEquals(val, entry.getValue().toString());
+                assertEquals(entry.getValue().toString(), val);
             }
             }
         }
         }
     }
     }

+ 84 - 0
src/test/java/org/codelibs/fess/it/admin/UserTests.java

@@ -0,0 +1,84 @@
+/*
+ * Copyright 2012-2017 CodeLibs Project and the Others.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.codelibs.fess.it.admin;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.codelibs.fess.it.CrudTestBase;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
+
+@Tag("it")
+public class UserTests extends CrudTestBase {
+
+    private static final String NAME_PREFIX = "userTest_";
+    private static final String API_PATH = "/api/admin/user";
+    private static final String LIST_ENDPOINT_SUFFIX = "settings";
+    private static final String ITEM_ENDPOINT_SUFFIX = "setting";
+
+    private static final String KEY_PROPERTY = "name";
+
+    @Override
+    protected String getNamePrefix() {
+        return NAME_PREFIX;
+    }
+
+    @Override
+    protected String getApiPath() {
+        return API_PATH;
+    }
+
+    @Override
+    protected String getKeyProperty() {
+        return KEY_PROPERTY;
+    }
+
+    @Override
+    protected String getListEndpointSuffix() {
+        return LIST_ENDPOINT_SUFFIX;
+    }
+
+    @Override
+    protected String getItemEndpointSuffix() {
+        return ITEM_ENDPOINT_SUFFIX;
+    }
+
+    @Override
+    protected Map<String, Object> createTestParam(int id) {
+        final Map<String, Object> requestBody = new HashMap<>();
+        final String keyProp = NAME_PREFIX + id;
+        requestBody.put(KEY_PROPERTY, keyProp);
+        requestBody.put("password", "password" + id);
+        requestBody.put("confirm_password", "password" + id);
+        return requestBody;
+    }
+
+    @Override
+    protected Map<String, Object> getUpdateMap() {
+        final Map<String, Object> updateMap = new HashMap<>();
+        updateMap.put("name", NAME_PREFIX + "new");
+        return updateMap;
+    }
+
+    @Test
+    void crudTest() {
+        testCreate();
+        testRead();
+        testUpdate();
+        testDelete();
+    }
+}