增加测试类中修改登录用户身份

beetlsql3-dev
Mlxa0324
parent cf670ca774
commit a4d4ed77ee

@ -11,7 +11,7 @@ import java.util.Map;
public class TestEnvUtil { public class TestEnvUtil {
/** /**
* Put *
* 便remove * 便remove
* *
* @param name * @param name
@ -63,7 +63,10 @@ public class TestEnvUtil {
* *
* @param name * @param name
*/ */
public static void removeProperty(String name) throws Exception { public static void removeProperty(String... name) throws Exception {
getModifiableEnvironment().remove(name); Map<String, String> modifiableEnvironment = getModifiableEnvironment();
for (String nm : name) {
modifiableEnvironment.remove(nm);
}
} }
} }

@ -68,8 +68,7 @@ class TeacherOpenCourseQuestionLogControllerTest extends BaseTest {
.andReturn().getResponse().getContentAsString(); .andReturn().getResponse().getContentAsString();
// 换回去原始的登录方式 // 换回去原始的登录方式
TestEnvUtil.removeProperty("user.id"); TestEnvUtil.removeProperty("user.id", "user.orgId");
TestEnvUtil.removeProperty("user.orgId");
System.out.println(result); System.out.println(result);
} }

Loading…
Cancel
Save