cpsky commented on a change in pull request #3403:
URL: 
https://github.com/apache/incubator-dolphinscheduler/pull/3403#discussion_r464964159



##########
File path: 
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java
##########
@@ -498,6 +498,61 @@ public void testRegisterUser() {
         }
     }
 
+
+    @Test
+    public void testActivateUser() {
+        User user = new User();
+        user.setUserType(UserType.GENERAL_USER);
+        String userName = "userTest0002~";
+        try {
+            //not admin
+            Map<String, Object> result = usersService.activateUser(user, 
userName);
+            Assert.assertEquals(Status.USER_NO_OPERATION_PERM, 
result.get(Constants.STATUS));
+
+            //userName error
+            user.setUserType(UserType.ADMIN_USER);
+            result = usersService.activateUser(user, userName);
+            Assert.assertEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR, 
result.get(Constants.STATUS));
+
+            //user not exist
+            userName = "userTest10013";
+            result = usersService.activateUser(user, userName);
+            Assert.assertEquals(Status.USER_NOT_EXIST, 
result.get(Constants.STATUS));
+            logger.info(result.toString());
+
+            //user state error
+            userName = "userTest0001";
+            
when(userMapper.queryByUserNameAccurately(userName)).thenReturn(getUser());
+            result = usersService.activateUser(user, userName);
+            Assert.assertEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR, 
result.get(Constants.STATUS));
+            logger.info(result.toString());
+
+            //success
+            
when(userMapper.queryByUserNameAccurately(userName)).thenReturn(getDisabledUser());
+            result = usersService.activateUser(user, userName);
+            logger.info(result.toString());

Review comment:
       ok, thanks!




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to