|
@@ -1,8 +1,8 @@
|
|
|
package com.hosea.service.user.test.client;
|
|
|
|
|
|
+import cn.hutool.core.lang.Pair;
|
|
|
import cn.hutool.core.util.RandomUtil;
|
|
|
-import com.hosea.cloud.test.Assertions;
|
|
|
-import com.hosea.cloud.test.Tuple;
|
|
|
+import com.hosea.common.test.Assertions;
|
|
|
import com.hosea.cloud.web.login.JwtToken;
|
|
|
import com.hosea.cloud.webmvc.JwtTokenUtil;
|
|
|
import com.hosea.cloud.webmvc.constant.LoginErrorCode;
|
|
@@ -38,10 +38,10 @@ public class UserApiTest {
|
|
|
UserAddCmd cmd = new UserAddCmd(createUser("user" + info.getCurrentRepetition(), RandomUtil.randomString(5)));
|
|
|
Assertions.success(api::add, cmd);
|
|
|
Assertions.error(api::add
|
|
|
- , Tuple.of(null, UserErrorCode.NOT_NULL)
|
|
|
- , Tuple.of(new UserAddCmd(), UserErrorCode.NOT_NULL)
|
|
|
- , Tuple.of(new UserAddCmd(createUser("")), UserErrorCode.NOT_NULL_NAME)
|
|
|
- , Tuple.of(cmd, UserErrorCode.ALREADY_EXISTS)
|
|
|
+ , Pair.of(null, UserErrorCode.NOT_NULL)
|
|
|
+ , Pair.of(new UserAddCmd(), UserErrorCode.NOT_NULL)
|
|
|
+ , Pair.of(new UserAddCmd(createUser("")), UserErrorCode.NOT_NULL_NAME)
|
|
|
+ , Pair.of(cmd, UserErrorCode.ALREADY_EXISTS)
|
|
|
);
|
|
|
}
|
|
|
|
|
@@ -52,10 +52,10 @@ public class UserApiTest {
|
|
|
UserUpdateCmd cmd = new UserUpdateCmd(createUser("user" + index, "name" + index));
|
|
|
Assertions.success(api::update, cmd);
|
|
|
Assertions.error(api::update
|
|
|
- , Tuple.of(null, UserErrorCode.NOT_NULL)
|
|
|
- , Tuple.of(new UserUpdateCmd(), UserErrorCode.NOT_NULL)
|
|
|
- , Tuple.of(new UserUpdateCmd(createUser("")), UserErrorCode.NOT_NULL_ID_OR_NAME)
|
|
|
- , Tuple.of(new UserUpdateCmd(createUser("xxx")), UserErrorCode.NOT_EXIST)
|
|
|
+ , Pair.of(null, UserErrorCode.NOT_NULL)
|
|
|
+ , Pair.of(new UserUpdateCmd(), UserErrorCode.NOT_NULL)
|
|
|
+ , Pair.of(new UserUpdateCmd(createUser("")), UserErrorCode.NOT_NULL_ID_OR_NAME)
|
|
|
+ , Pair.of(new UserUpdateCmd(createUser("xxx")), UserErrorCode.NOT_EXIST)
|
|
|
);
|
|
|
}
|
|
|
|
|
@@ -68,13 +68,13 @@ public class UserApiTest {
|
|
|
// 加入不存在的租户不会报错,但是加不进去
|
|
|
Assertions.success(api::join, new UserJoinTenantCmd(user, List.of(new TenantUniqueDTO(null, "xxxx"))));
|
|
|
Assertions.error(api::join
|
|
|
- , Tuple.of(null, UserErrorCode.NOT_NULL)
|
|
|
- , Tuple.of(new UserJoinTenantCmd(), UserErrorCode.NOT_NULL)
|
|
|
- , Tuple.of(new UserJoinTenantCmd(user, null), TenantErrorCode.NOT_NULL)
|
|
|
- , Tuple.of(new UserJoinTenantCmd(null, tenant), UserErrorCode.NOT_NULL)
|
|
|
- , Tuple.of(new UserJoinTenantCmd(new UserUniqueDTO(null, ""), tenant), UserErrorCode.NOT_NULL_ID_OR_NAME)
|
|
|
- , Tuple.of(new UserJoinTenantCmd(new UserUniqueDTO(null, "xxxx"), tenant), UserErrorCode.NOT_EXIST)
|
|
|
- , Tuple.of(new UserJoinTenantCmd(user, List.of(new TenantUniqueDTO(null, ""))), TenantErrorCode.NOT_NULL_ID_OR_CODE)
|
|
|
+ , Pair.of(null, UserErrorCode.NOT_NULL)
|
|
|
+ , Pair.of(new UserJoinTenantCmd(), UserErrorCode.NOT_NULL)
|
|
|
+ , Pair.of(new UserJoinTenantCmd(user, null), TenantErrorCode.NOT_NULL)
|
|
|
+ , Pair.of(new UserJoinTenantCmd(null, tenant), UserErrorCode.NOT_NULL)
|
|
|
+ , Pair.of(new UserJoinTenantCmd(new UserUniqueDTO(null, ""), tenant), UserErrorCode.NOT_NULL_ID_OR_NAME)
|
|
|
+ , Pair.of(new UserJoinTenantCmd(new UserUniqueDTO(null, "xxxx"), tenant), UserErrorCode.NOT_EXIST)
|
|
|
+ , Pair.of(new UserJoinTenantCmd(user, List.of(new TenantUniqueDTO(null, ""))), TenantErrorCode.NOT_NULL_ID_OR_CODE)
|
|
|
);
|
|
|
}
|
|
|
|
|
@@ -113,9 +113,9 @@ public class UserApiTest {
|
|
|
query.setOrderBy("GROUPCODE");
|
|
|
Assertions.assertEquals(api.list(query).getData().size(), size);
|
|
|
Assertions.error(api::list
|
|
|
- , Tuple.of(null, TenantErrorCode.NOT_NULL)
|
|
|
- , Tuple.of(new UserListByTenantPageQuery(), TenantErrorCode.NOT_NULL)
|
|
|
- , Tuple.of(new UserListByTenantPageQuery(new TenantUniqueDTO(null, "")), TenantErrorCode.NOT_NULL_ID_OR_CODE)
|
|
|
+ , Pair.of(null, TenantErrorCode.NOT_NULL)
|
|
|
+ , Pair.of(new UserListByTenantPageQuery(), TenantErrorCode.NOT_NULL)
|
|
|
+ , Pair.of(new UserListByTenantPageQuery(new TenantUniqueDTO(null, "")), TenantErrorCode.NOT_NULL_ID_OR_CODE)
|
|
|
);
|
|
|
Assertions.assertEquals(api.list(new UserListByTenantPageQuery(new TenantUniqueDTO(null, "code1"))).getTotalCount(), TenantApiTest.TEST_NUM);
|
|
|
Assertions.assertEquals(api.list(new UserListByTenantPageQuery(new TenantUniqueDTO(null, "xxx"))).getTotalCount(), 0);
|