| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- import cn.reghao.devops.manager.ManagerApplication;
- import cn.reghao.devops.manager.notification.NotifyService;
- import cn.reghao.devops.manager.notification.notifier.ding.DingMsg;
- import cn.reghao.devops.manager.rbac.service.UserService;
- import lombok.extern.slf4j.Slf4j;
- import org.junit.Test;
- import org.junit.runner.RunWith;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.boot.test.context.SpringBootTest;
- import org.springframework.test.context.ActiveProfiles;
- import org.springframework.test.context.junit4.SpringRunner;
- /**
- * @author reghao
- * @date 2022-08-17 15:53:04
- */
- @Slf4j
- @ActiveProfiles("dev")
- @SpringBootTest(classes = ManagerApplication.class)
- @RunWith(SpringRunner.class)
- public class AccountTest {
- @Autowired
- UserService userService;
- @Test
- public void createAccount() {
- String username = "admin";
- int userId = 102;
- String password = "ecUgpUeIX2ub84EYPsiQ";
- userService.modifyUserPassword(userId, password);
- /*String role = RoleType.ROLE_ADMIN.name();
- User user = new User(username, password, Set.of(new UserAuthority(role)));
- userService.createUser(user);*/
- }
- @Autowired
- NotifyService notifyService;
- @Test
- public void notifyTest() throws InterruptedException {
- String title = "测试";
- String text = "应用测试内容";
- DingMsg dingMsg = new DingMsg(title, text);
- notifyService.notify(dingMsg);
- Thread.sleep(3600_000);
- }
- }
|