-
Notifications
You must be signed in to change notification settings - Fork 6
test authentication
Hippoom edited this page Jul 3, 2017
·
1 revision
A convenient static factory method to populate org.springframework.security.core.Authentication
for spring test.
import org.junit.Test
import static com.github.hippoom.wechat.mp.test.web.servlet.request.WxMpOAuth2AccessTokenRequestPostProcessor.aWeChatMpUser
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status
@Test
public void returns_wechat_user_profile() {
// @formatter:off
this.mockMvc.perform(
get("/rel/wechat/user/profile/me")
.with(aWeChatMpUser().withOpenId(userProfile.openId))
).andDo(print())
.andExpect(status().isOk())
// @formatter:on
}
- Quick start
- weixin-java-mp support
- Autowiring WxMpConfigStorage
- API support
- Inbound messaging
- Identity & Access
- JS SDK support
- Testing
- Release notes