mirror of
https://gitee.com/dromara/sa-token.git
synced 2025-10-21 19:17:25 +08:00
refactor: 补正一些缺失方法
This commit is contained in:
@@ -107,7 +107,7 @@ public class SaSessionTest {
|
||||
|
||||
// 测试token 签名
|
||||
@Test
|
||||
public void testTokenSign() {
|
||||
public void testSaTerminalInfo() {
|
||||
SaSession session = new SaSession("session-1002");
|
||||
|
||||
// 添加 Token 签名
|
||||
@@ -123,7 +123,7 @@ public class SaSessionTest {
|
||||
session.removeTerminal("xxxx-xxxx-xxxx-xxxx-1");
|
||||
Assertions.assertEquals(session.getTerminalList().size(), 1);
|
||||
|
||||
// 删除一个不存在的,则不影响 TokenSign 列表
|
||||
// 删除一个不存在的,则不影响 SaTerminalInfo 列表
|
||||
session.removeTerminal("xxxx-xxxx-xxxx-xxxx-999");
|
||||
Assertions.assertEquals(session.getTerminalList().size(), 1);
|
||||
|
||||
|
@@ -20,7 +20,7 @@ import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* TokenSign 相关测试
|
||||
* SaTerminalInfo 相关测试
|
||||
*
|
||||
* @author click33
|
||||
* @since 2022-9-4
|
||||
@@ -30,14 +30,14 @@ public class SaTerminalInfoTest {
|
||||
// 测试
|
||||
@Test
|
||||
public void testSaTerminalInfo() {
|
||||
SaTerminalInfo tokenSign = new SaTerminalInfo();
|
||||
tokenSign.setDeviceType("PC");
|
||||
tokenSign.setTokenValue("ttt-value");
|
||||
SaTerminalInfo terminal = new SaTerminalInfo();
|
||||
terminal.setDeviceType("PC");
|
||||
terminal.setTokenValue("ttt-value");
|
||||
|
||||
Assertions.assertEquals(tokenSign.getDeviceType(), "PC");
|
||||
Assertions.assertEquals(tokenSign.getTokenValue(), "ttt-value");
|
||||
Assertions.assertEquals(terminal.getDeviceType(), "PC");
|
||||
Assertions.assertEquals(terminal.getTokenValue(), "ttt-value");
|
||||
|
||||
Assertions.assertNotNull(tokenSign.toString());
|
||||
Assertions.assertNotNull(terminal.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -114,8 +114,8 @@ public class ManyLoginTest {
|
||||
Assertions.assertEquals(dao.get("satoken:login:token:" + token1), "-4");
|
||||
|
||||
// Account-Session里的 token1 签名会被移除
|
||||
List<SaTerminalInfo> tokenSignList = StpUtil.getSessionByLoginId(10001).getTerminalList();
|
||||
for (SaTerminalInfo terminal : tokenSignList) {
|
||||
List<SaTerminalInfo> terminalList = StpUtil.getSessionByLoginId(10001).getTerminalList();
|
||||
for (SaTerminalInfo terminal : terminalList) {
|
||||
Assertions.assertNotEquals(terminal.getTokenValue(), token1);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user