🐛 #4110 【小程序】修正服务卡片几个接口的地址
This commit is contained in:
@@ -115,6 +115,7 @@
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>false</skip>
|
||||
<suiteXmlFiles>
|
||||
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
|
||||
</suiteXmlFiles>
|
||||
|
||||
@@ -122,7 +122,7 @@ public interface WxMaSubscribeService {
|
||||
* 激活与更新服务卡片
|
||||
*
|
||||
* 详情请见: <a href="https://developers.weixin.qq.com/miniprogram/dev/server/API/mp-message-management/subscribe-message/api_setusernotify.html">激活与更新服务卡片</a>
|
||||
* 接口url格式: POST https://api.weixin.qq.com/wxa/setusernotify?access_token=ACCESS_TOKEN
|
||||
* 接口url格式: POST https://api.weixin.qq.com/wxa/set_user_notify?access_token=ACCESS_TOKEN
|
||||
* </pre>
|
||||
*
|
||||
* @param request 请求参数
|
||||
@@ -135,7 +135,7 @@ public interface WxMaSubscribeService {
|
||||
* 更新服务卡片扩展信息
|
||||
*
|
||||
* 详情请见: <a href="https://developers.weixin.qq.com/miniprogram/dev/server/API/mp-message-management/subscribe-message/api_setusernotifyext.html">更新服务卡片扩展信息</a>
|
||||
* 接口url格式: POST https://api.weixin.qq.com/wxa/setusernotifyext?access_token=ACCESS_TOKEN
|
||||
* 接口url格式: POST https://api.weixin.qq.com/wxa/set_user_notifyext?access_token=ACCESS_TOKEN
|
||||
* </pre>
|
||||
*
|
||||
* @param request 请求参数
|
||||
@@ -148,7 +148,7 @@ public interface WxMaSubscribeService {
|
||||
* 查询服务卡片状态
|
||||
*
|
||||
* 详情请见: <a href="https://developers.weixin.qq.com/miniprogram/dev/server/API/mp-message-management/subscribe-message/api_getusernotify.html">查询服务卡片状态</a>
|
||||
* 接口url格式: POST https://api.weixin.qq.com/wxa/getusernotify?access_token=ACCESS_TOKEN
|
||||
* 接口url格式: POST https://api.weixin.qq.com/wxa/get_user_notify?access_token=ACCESS_TOKEN
|
||||
* </pre>
|
||||
*
|
||||
* @param request 请求参数
|
||||
|
||||
@@ -370,13 +370,13 @@ public class WxMaApiUrlConstants {
|
||||
String SUBSCRIBE_MSG_SEND_URL = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send";
|
||||
|
||||
/** 激活与更新服务卡片 */
|
||||
String SERVICE_NOTIFY_SET_URL = "https://api.weixin.qq.com/wxa/setusernotify";
|
||||
String SERVICE_NOTIFY_SET_URL = "https://api.weixin.qq.com/wxa/set_user_notify";
|
||||
|
||||
/** 更新服务卡片扩展信息 */
|
||||
String SERVICE_NOTIFY_SET_EXT_URL = "https://api.weixin.qq.com/wxa/setusernotifyext";
|
||||
String SERVICE_NOTIFY_SET_EXT_URL = "https://api.weixin.qq.com/wxa/set_user_notifyext";
|
||||
|
||||
/** 查询服务卡片状态 */
|
||||
String SERVICE_NOTIFY_GET_URL = "https://api.weixin.qq.com/wxa/getusernotify";
|
||||
String SERVICE_NOTIFY_GET_URL = "https://api.weixin.qq.com/wxa/get_user_notify";
|
||||
}
|
||||
|
||||
public interface User {
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package cn.binarywang.wx.miniapp.api.impl;
|
||||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.api.WxMaSubscribeService;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaGetUserNotifyRequest;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaServiceNotifyExtRequest;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaServiceNotifyRequest;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import org.mockito.Mockito;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class WxMaSubscribeServiceImplUrlTest {
|
||||
|
||||
@Test
|
||||
public void setUserNotifyUsesOfficialEndpoint() throws WxErrorException {
|
||||
WxMaService service = successService();
|
||||
|
||||
subscribeService(service).setUserNotify(WxMaServiceNotifyRequest.builder().build());
|
||||
|
||||
verify(service).post(eq("https://api.weixin.qq.com/wxa/set_user_notify"), anyString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setUserNotifyExtUsesOfficialEndpoint() throws WxErrorException {
|
||||
WxMaService service = successService();
|
||||
|
||||
subscribeService(service).setUserNotifyExt(WxMaServiceNotifyExtRequest.builder().build());
|
||||
|
||||
verify(service).post(eq("https://api.weixin.qq.com/wxa/set_user_notifyext"), anyString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getUserNotifyUsesOfficialEndpoint() throws WxErrorException {
|
||||
WxMaService service = successService();
|
||||
|
||||
subscribeService(service).getUserNotify(WxMaGetUserNotifyRequest.builder().build());
|
||||
|
||||
verify(service).post(eq("https://api.weixin.qq.com/wxa/get_user_notify"), anyString());
|
||||
}
|
||||
|
||||
private WxMaSubscribeService subscribeService(WxMaService service) {
|
||||
return new WxMaSubscribeServiceImpl(service);
|
||||
}
|
||||
|
||||
private WxMaService successService() throws WxErrorException {
|
||||
WxMaService service = Mockito.mock(WxMaService.class);
|
||||
when(service.post(anyString(), anyString())).thenReturn("{\"errcode\":0,\"errmsg\":\"ok\"}");
|
||||
return service;
|
||||
}
|
||||
}
|
||||
9
weixin-java-miniapp/src/test/resources/testng.xml
Normal file
9
weixin-java-miniapp/src/test/resources/testng.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
|
||||
|
||||
<suite name="weixin-java-miniapp-unit-tests" verbose="1">
|
||||
<test name="Unit_Test">
|
||||
<classes>
|
||||
<class name="cn.binarywang.wx.miniapp.api.impl.WxMaSubscribeServiceImplUrlTest"/>
|
||||
</classes>
|
||||
</test>
|
||||
</suite>
|
||||
Reference in New Issue
Block a user