dev --- 3.8.0.A版本, openProject引用 ; formao-live --- 3.7.0.B 版本, formallProject引用
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 rivejä
1.9 KiB

  1. package me.chanjar.weixin.api;
  2. import org.testng.Assert;
  3. import org.testng.annotations.Guice;
  4. import org.testng.annotations.Test;
  5. import me.chanjar.weixin.api.ApiTestModule.WxXmlConfigStorage;
  6. import me.chanjar.weixin.bean.result.WxUser;
  7. import me.chanjar.weixin.bean.result.WxUserList;
  8. import me.chanjar.weixin.exception.WxErrorException;
  9. import com.google.inject.Inject;
  10. /**
  11. * 测试用户相关的接口
  12. * @author chanjarster
  13. *
  14. */
  15. @Test(groups = "userAPI", dependsOnGroups = { "baseAPI", "groupAPI" })
  16. @Guice(modules = ApiTestModule.class)
  17. public class WxUserAPITest {
  18. @Inject
  19. protected WxServiceImpl wxService;
  20. public void testUserUpdateRemark() throws WxErrorException {
  21. WxXmlConfigStorage configProvider = (WxXmlConfigStorage) wxService.wxConfigStorage;
  22. wxService.userUpdateRemark(configProvider.getOpenId(), "测试备注名");
  23. }
  24. public void testUserInfo() throws WxErrorException {
  25. WxXmlConfigStorage configProvider = (WxXmlConfigStorage) wxService.wxConfigStorage;
  26. WxUser user = wxService.userInfo(configProvider.getOpenId(), null);
  27. Assert.assertNotNull(user);
  28. }
  29. public void testUserList() throws WxErrorException {
  30. WxUserList wxUserList = wxService.userList(null);
  31. Assert.assertNotNull(wxUserList);
  32. Assert.assertFalse(wxUserList.getCount() == -1);
  33. Assert.assertFalse(wxUserList.getTotal() == -1);
  34. Assert.assertFalse(wxUserList.getOpenIds().size() == -1);
  35. }
  36. public void testGroupQueryUserGroup() throws WxErrorException {
  37. WxXmlConfigStorage configStorage = (WxXmlConfigStorage) wxService.wxConfigStorage;
  38. long groupid = wxService.userGetGroup(configStorage.getOpenId());
  39. Assert.assertTrue(groupid != -1l);
  40. }
  41. public void getGroupMoveUser() throws WxErrorException {
  42. WxXmlConfigStorage configStorage = (WxXmlConfigStorage) wxService.wxConfigStorage;
  43. wxService.userUpdateGroup(configStorage.getOpenId(), wxService.groupGet().get(3).getId());
  44. }
  45. }