#246 修复企业号用户信息相关属性,对比实际接口返回内容,移除已失效属性(weixinid、tel),添加缺失的属性(telephone, english_name, hide_mobile)
This commit is contained in:
@@ -5,7 +5,7 @@ import com.google.inject.Module;
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import me.chanjar.weixin.common.util.xml.XStreamInitializer;
|
||||
import me.chanjar.weixin.cp.api.impl.apache.WxCpServiceImpl;
|
||||
import me.chanjar.weixin.cp.api.impl.WxCpServiceImpl;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package me.chanjar.weixin.cp.api.impl.apache;
|
||||
package me.chanjar.weixin.cp.api;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||
import me.chanjar.weixin.cp.api.ApiTestModule;
|
||||
import me.chanjar.weixin.cp.api.WxCpConfigStorage;
|
||||
import me.chanjar.weixin.cp.api.impl.WxCpServiceImpl;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.testng.*;
|
||||
import org.testng.annotations.*;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Guice;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* 基础API测试
|
||||
@@ -1,10 +1,11 @@
|
||||
package me.chanjar.weixin.cp.api.impl.apache;
|
||||
package me.chanjar.weixin.cp.api;
|
||||
|
||||
import me.chanjar.weixin.common.bean.result.WxError;
|
||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.http.RequestExecutor;
|
||||
import me.chanjar.weixin.cp.api.WxCpService;
|
||||
import org.testng.annotations.*;
|
||||
import me.chanjar.weixin.cp.api.impl.WxCpServiceImpl;
|
||||
import org.testng.annotations.DataProvider;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
@@ -2,19 +2,23 @@ package me.chanjar.weixin.cp.api;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||
import me.chanjar.weixin.cp.api.impl.apache.WxCpServiceImpl;
|
||||
import me.chanjar.weixin.cp.api.impl.WxCpServiceImpl;
|
||||
import me.chanjar.weixin.cp.bean.WxCpDepart;
|
||||
import org.testng.*;
|
||||
import org.testng.annotations.*;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Guice;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* 测试部门接口
|
||||
*
|
||||
* @author Daniel Qian
|
||||
*/
|
||||
@Test(groups = "departAPI", dependsOnGroups = "baseAPI")
|
||||
@Test(groups = "departAPI")
|
||||
@Guice(modules = ApiTestModule.class)
|
||||
public class WxCpDepartAPITest {
|
||||
|
||||
@@ -23,6 +27,7 @@ public class WxCpDepartAPITest {
|
||||
|
||||
protected WxCpDepart depart;
|
||||
|
||||
@Test
|
||||
public void testDepartCreate() throws WxErrorException {
|
||||
WxCpDepart cpDepart = new WxCpDepart();
|
||||
cpDepart.setName("子部门" + System.currentTimeMillis());
|
||||
@@ -32,16 +37,16 @@ public class WxCpDepartAPITest {
|
||||
System.out.println(departId);
|
||||
}
|
||||
|
||||
@Test(dependsOnMethods = "testDepartCreate")
|
||||
@Test//(dependsOnMethods = "testDepartCreate")
|
||||
public void testDepartGet() throws WxErrorException {
|
||||
System.out.println("=================获取部门");
|
||||
List<WxCpDepart> departList = this.wxCpService.departGet();
|
||||
Assert.assertNotNull(departList);
|
||||
Assert.assertTrue(departList.size() > 0);
|
||||
assertNotNull(departList);
|
||||
assertTrue(departList.size() > 0);
|
||||
for (WxCpDepart g : departList) {
|
||||
this.depart = g;
|
||||
System.out.println(this.depart.getId() + ":" + this.depart.getName());
|
||||
Assert.assertNotNull(g.getName());
|
||||
assertNotNull(g.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,11 @@ import com.google.inject.Inject;
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
|
||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||
import me.chanjar.weixin.cp.api.impl.apache.WxCpServiceImpl;
|
||||
import org.testng.*;
|
||||
import org.testng.annotations.*;
|
||||
import me.chanjar.weixin.cp.api.impl.WxCpServiceImpl;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.DataProvider;
|
||||
import org.testng.annotations.Guice;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package me.chanjar.weixin.cp.api.impl.apache;
|
||||
package me.chanjar.weixin.cp.api;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||
import me.chanjar.weixin.cp.api.ApiTestModule;
|
||||
import me.chanjar.weixin.cp.api.impl.WxCpServiceImpl;
|
||||
import me.chanjar.weixin.cp.bean.WxCpMessage;
|
||||
import org.testng.annotations.*;
|
||||
import org.testng.annotations.Guice;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/***
|
||||
* 测试发送消息
|
||||
@@ -5,8 +5,9 @@ import me.chanjar.weixin.common.session.StandardSessionManager;
|
||||
import me.chanjar.weixin.common.session.WxSessionManager;
|
||||
import me.chanjar.weixin.cp.bean.WxCpXmlMessage;
|
||||
import me.chanjar.weixin.cp.bean.WxCpXmlOutMessage;
|
||||
import org.testng.*;
|
||||
import org.testng.annotations.*;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.DataProvider;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package me.chanjar.weixin.cp.api;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import me.chanjar.weixin.cp.api.impl.apache.WxCpServiceImpl;
|
||||
import me.chanjar.weixin.cp.api.impl.WxCpServiceImpl;
|
||||
import me.chanjar.weixin.cp.bean.WxCpTag;
|
||||
import me.chanjar.weixin.cp.bean.WxCpUser;
|
||||
import org.testng.*;
|
||||
import org.testng.annotations.*;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Guice;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -2,28 +2,30 @@ package me.chanjar.weixin.cp.api;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||
import me.chanjar.weixin.cp.api.impl.apache.WxCpServiceImpl;
|
||||
import me.chanjar.weixin.cp.bean.WxCpDepart;
|
||||
import me.chanjar.weixin.cp.api.impl.WxCpServiceImpl;
|
||||
import me.chanjar.weixin.cp.bean.WxCpUser;
|
||||
import org.testng.*;
|
||||
import org.testng.annotations.*;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Guice;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.testng.Assert.assertNotEquals;
|
||||
|
||||
/**
|
||||
* 测试用户接口
|
||||
*
|
||||
* @author Daniel Qian
|
||||
*/
|
||||
@Test(groups = "userAPI", dependsOnGroups = "baseAPI")
|
||||
@Test(groups = "userAPI")
|
||||
@Guice(modules = ApiTestModule.class)
|
||||
public class WxCpUserAPITest {
|
||||
|
||||
@Inject
|
||||
protected WxCpServiceImpl wxCpService;
|
||||
|
||||
protected WxCpDepart depart;
|
||||
|
||||
public void testUserCreate() throws WxErrorException {
|
||||
WxCpUser user = new WxCpUser();
|
||||
user.setUserId("some.woman");
|
||||
@@ -33,7 +35,7 @@ public class WxCpUserAPITest {
|
||||
user.setGender("女");
|
||||
user.setMobile("13560084979");
|
||||
user.setPosition("woman");
|
||||
user.setTel("3300393");
|
||||
user.setTelephone("3300393");
|
||||
user.addExtAttr("爱好", "table");
|
||||
this.wxCpService.userCreate(user);
|
||||
}
|
||||
@@ -56,11 +58,19 @@ public class WxCpUserAPITest {
|
||||
@Test(dependsOnMethods = "testUserGet")
|
||||
public void testDepartGetUsers() throws WxErrorException {
|
||||
List<WxCpUser> users = this.wxCpService.departGetUsers(1, true, 0);
|
||||
Assert.assertNotEquals(users.size(), 0);
|
||||
assertNotEquals(users.size(), 0);
|
||||
}
|
||||
|
||||
@Test(dependsOnMethods = "testDepartGetUsers")
|
||||
public void testUserDelete() throws WxErrorException {
|
||||
this.wxCpService.userDelete("some.woman");
|
||||
}
|
||||
|
||||
public void testUserList() throws WxErrorException {
|
||||
List<WxCpUser> users = this.wxCpService.userList(1, true, 0);
|
||||
assertNotEquals(users.size(), 0);
|
||||
for (WxCpUser user : users) {
|
||||
System.out.println(ToStringBuilder.reflectionToString(user, ToStringStyle.MULTI_LINE_STYLE));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,11 @@ import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.common.bean.menu.WxMenu;
|
||||
import me.chanjar.weixin.common.bean.menu.WxMenuButton;
|
||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||
import me.chanjar.weixin.cp.api.impl.apache.WxCpServiceImpl;
|
||||
import org.testng.*;
|
||||
import org.testng.annotations.*;
|
||||
import me.chanjar.weixin.cp.api.impl.WxCpServiceImpl;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.DataProvider;
|
||||
import org.testng.annotations.Guice;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* 测试菜单
|
||||
|
||||
@@ -3,9 +3,9 @@ package me.chanjar.weixin.cp.bean;
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.cp.bean.article.MpnewsArticle;
|
||||
import me.chanjar.weixin.cp.bean.article.NewArticle;
|
||||
import org.testng.annotations.*;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import static org.testng.Assert.*;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
@Test
|
||||
public class WxCpMessageTest {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package me.chanjar.weixin.cp.bean;
|
||||
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import org.testng.*;
|
||||
import org.testng.annotations.*;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Test
|
||||
public class WxCpXmlMessageTest {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package me.chanjar.weixin.cp.bean;
|
||||
|
||||
import org.testng.*;
|
||||
import org.testng.annotations.*;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Test
|
||||
public class WxCpXmlOutImageMessageTest {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package me.chanjar.weixin.cp.bean;
|
||||
|
||||
import org.testng.*;
|
||||
import org.testng.annotations.*;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Test
|
||||
public class WxCpXmlOutNewsMessageTest {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package me.chanjar.weixin.cp.bean;
|
||||
|
||||
import org.testng.*;
|
||||
import org.testng.annotations.*;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Test
|
||||
public class WxCpXmlOutTextMessageTest {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package me.chanjar.weixin.cp.bean;
|
||||
|
||||
import org.testng.*;
|
||||
import org.testng.annotations.*;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Test
|
||||
public class WxCpXmlOutVideoMessageTest {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package me.chanjar.weixin.cp.bean;
|
||||
|
||||
import org.testng.*;
|
||||
import org.testng.annotations.*;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Test
|
||||
public class WxCpXmlOutVoiceMessageTest {
|
||||
|
||||
@@ -5,7 +5,7 @@ import me.chanjar.weixin.cp.api.WxCpConfigStorage;
|
||||
import me.chanjar.weixin.cp.api.WxCpMessageHandler;
|
||||
import me.chanjar.weixin.cp.api.WxCpMessageRouter;
|
||||
import me.chanjar.weixin.cp.api.WxCpService;
|
||||
import me.chanjar.weixin.cp.api.impl.apache.WxCpServiceImpl;
|
||||
import me.chanjar.weixin.cp.api.impl.WxCpServiceImpl;
|
||||
import me.chanjar.weixin.cp.bean.WxCpXmlMessage;
|
||||
import me.chanjar.weixin.cp.bean.WxCpXmlOutMessage;
|
||||
import me.chanjar.weixin.cp.bean.WxCpXmlOutTextMessage;
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
<suite name="Weixin-java-tool-suite" verbose="1">
|
||||
<test name="API_Test">
|
||||
<classes>
|
||||
<class name="me.chanjar.weixin.cp.api.impl.apache.WxCpBusyRetryTest"/>
|
||||
<class name="me.chanjar.weixin.cp.api.impl.apache.WxCpBaseAPITest"/>
|
||||
<class name="me.chanjar.weixin.cp.api.impl.apache.WxCpMessageAPITest"/>
|
||||
<class name="me.chanjar.weixin.cp.api.WxCpBusyRetryTest"/>
|
||||
<class name="me.chanjar.weixin.cp.api.WxCpBaseAPITest"/>
|
||||
<class name="me.chanjar.weixin.cp.api.WxCpMessageAPITest"/>
|
||||
<class name="me.chanjar.weixin.cp.api.WxMenuAPITest"/>
|
||||
<class name="me.chanjar.weixin.cp.api.WxCpDepartAPITest"/>
|
||||
<class name="me.chanjar.weixin.cp.api.WxCpMediaAPITest"/>
|
||||
|
||||
Reference in New Issue
Block a user