获取当前登录的老师信息
parent
aa64cebd40
commit
8faeb5e5df
@ -0,0 +1,32 @@
|
|||||||
|
package com.ibeetl.jlw.web;
|
||||||
|
|
||||||
|
import base.BaseTest;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.test.web.servlet.RequestBuilder;
|
||||||
|
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||||
|
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||||
|
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
|
||||||
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||||
|
|
||||||
|
class IndexControllerTest extends BaseTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void index() throws Exception {
|
||||||
|
//构造请求参数
|
||||||
|
RequestBuilder rb = MockMvcRequestBuilders.post("/index.do");
|
||||||
|
|
||||||
|
// 测试账号,佟老师
|
||||||
|
putLoginInfoToEnv("102", "26");
|
||||||
|
|
||||||
|
//发送请求,验证返回结果
|
||||||
|
String result = mvc.perform(rb)
|
||||||
|
.andExpect(status().isOk())
|
||||||
|
.andExpect(MockMvcResultMatchers.jsonPath("$.code").value("0"))
|
||||||
|
.andReturn().getResponse().getContentAsString(Charset.defaultCharset());
|
||||||
|
|
||||||
|
System.out.println(result);
|
||||||
|
clearEnvLoginInfo();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue