1
0
mirror of synced 2025-12-19 23:08:13 +08:00

🆕 #3077【小程序】增加openApi管理的接口支持

This commit is contained in:
水依寒
2023-07-12 11:04:59 +08:00
committed by GitHub
parent 9bd7940195
commit 831aac31ba
10 changed files with 362 additions and 4 deletions

View File

@@ -0,0 +1,48 @@
package cn.binarywang.wx.miniapp.api.impl;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.openapi.WxMiniGetApiQuotaResult;
import cn.binarywang.wx.miniapp.test.ApiTestModule;
import com.google.gson.Gson;
import com.google.inject.Inject;
import me.chanjar.weixin.common.error.WxErrorException;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
import static org.testng.Assert.assertNotNull;
import static org.testng.AssertJUnit.assertTrue;
/**
* openApi管理测试
*
* @author shuiyihan12
* @since 2023/7/7 17:08
*/
@Test
@Guice(modules = ApiTestModule.class)
public class WxMaOpenApiServiceImplTest {
@Inject
private WxMaService wxMaService;
@Test
public void clearQuota() throws WxErrorException {
final boolean result = wxMaService.getWxMaOpenApiService().clearQuota();
assertTrue(result);
}
@Test
public void getApiQuota() throws WxErrorException {
String cgiPath = "/cgi-bin/openapi/quota/get";
final WxMiniGetApiQuotaResult apiQuota = wxMaService.getWxMaOpenApiService().getApiQuota(cgiPath);
assertNotNull(apiQuota);
System.out.println(new Gson().toJson(apiQuota));
}
@Test
public void clearQuotaByAppSecret() throws WxErrorException {
final boolean result = wxMaService.getWxMaOpenApiService().clearQuotaByAppSecret();
assertTrue(result);
}
}