2014-08-26 12:13:28 +08:00
|
|
|
package chanjarster.weixin.api;
|
|
|
|
|
|
2014-08-26 12:37:38 +08:00
|
|
|
import org.testng.Assert;
|
2014-08-26 12:13:28 +08:00
|
|
|
import org.testng.annotations.Guice;
|
|
|
|
|
import org.testng.annotations.Test;
|
|
|
|
|
|
|
|
|
|
import chanjarster.weixin.api.ApiTestModule.WxXmlConfigStorage;
|
2014-08-26 12:37:38 +08:00
|
|
|
import chanjarster.weixin.bean.result.WxUser;
|
2014-08-26 13:50:53 +08:00
|
|
|
import chanjarster.weixin.bean.result.WxUserList;
|
2014-08-26 12:13:28 +08:00
|
|
|
import chanjarster.weixin.exception.WxErrorException;
|
|
|
|
|
|
|
|
|
|
import com.google.inject.Inject;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 测试用户相关的接口
|
|
|
|
|
* @author chanjarster
|
|
|
|
|
*
|
|
|
|
|
*/
|
2014-08-26 16:16:14 +08:00
|
|
|
@Test(groups = "userAPI", dependsOnGroups = { "baseAPI", "groupAPI" })
|
2014-08-26 12:13:28 +08:00
|
|
|
@Guice(modules = ApiTestModule.class)
|
|
|
|
|
public class WxUserAPITest {
|
|
|
|
|
|
|
|
|
|
@Inject
|
|
|
|
|
protected WxServiceImpl wxService;
|
|
|
|
|
|
|
|
|
|
public void testUserUpdateRemark() throws WxErrorException {
|
|
|
|
|
WxXmlConfigStorage configProvider = (WxXmlConfigStorage) wxService.wxConfigStorage;
|
|
|
|
|
wxService.userUpdateRemark(configProvider.getOpenId(), "测试备注名");
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-26 12:37:38 +08:00
|
|
|
public void testUserInfo() throws WxErrorException {
|
|
|
|
|
WxXmlConfigStorage configProvider = (WxXmlConfigStorage) wxService.wxConfigStorage;
|
|
|
|
|
WxUser user = wxService.userInfo(configProvider.getOpenId(), null);
|
|
|
|
|
Assert.assertNotNull(user);
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-26 13:50:53 +08:00
|
|
|
public void testUserList() throws WxErrorException {
|
|
|
|
|
WxUserList wxUserList = wxService.userList(null);
|
|
|
|
|
Assert.assertNotNull(wxUserList);
|
|
|
|
|
Assert.assertFalse(wxUserList.getCount() == -1);
|
|
|
|
|
Assert.assertFalse(wxUserList.getTotal() == -1);
|
|
|
|
|
Assert.assertFalse(wxUserList.getOpenids().size() == -1);
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-26 16:16:14 +08:00
|
|
|
public void testGroupQueryUserGroup() throws WxErrorException {
|
|
|
|
|
WxXmlConfigStorage configStorage = (WxXmlConfigStorage) wxService.wxConfigStorage;
|
|
|
|
|
long groupid = wxService.userGetGroup(configStorage.getOpenId());
|
|
|
|
|
Assert.assertTrue(groupid != -1l);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void getGroupMoveUser() throws WxErrorException {
|
|
|
|
|
WxXmlConfigStorage configStorage = (WxXmlConfigStorage) wxService.wxConfigStorage;
|
|
|
|
|
wxService.userUpdateGroup(configStorage.getOpenId(), wxService.groupGet().get(3).getId());
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-26 12:13:28 +08:00
|
|
|
}
|