Commit 0507141d by zhangying

添加账号信息

parent 1050f1e5
package com.live.cases.apollo;
import com.alibaba.fastjson.JSONObject;
import com.live.cases.largeClassLive.LargeClassLiveTools;
import com.live.enums.ApiModele;
import com.live.enums.RequestType;
import com.live.enums.Terminal;
import com.xiaomai.utils.XMBaseTest;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
* Created by zhangying on 2020/11/28
*/
public class TestJudgeLessonPermission extends XMBaseTest {
@BeforeMethod
public void beforeTest() {
xmAppApi.setApiModule(ApiModele.CloudClass_apollo) // API 所属模块 必传 读取配置文件config.properties配置的api地址
.setApiName("api_judgeLessonPermission") // API 名称 必传
.setLoginUser("zhangy-b") // http 接口,测试账号 必传
.setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传)
super.beforeTest();
}
/**
* 判断是否有备课本权限
*/
@Test
public void testJudgeLessonPermission() {
JSONObject jsonObject = new JSONObject();
jsonObject.put("instId","1235115978015883266");
jsonObject.put("permissionCode",2001);
xmAppApi.doRequest(RequestType.JSON, params, jsonObject.toJSONString(), headers);
JSONObject jsonBody = xmAppApi.getBodyInJSON();
Assert.assertEquals("true", jsonBody.getString("success"));
// Assert.assertEquals("操作成功!", jsonBody.getString("message"));
}
}
package com.live.xmutils;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.client.SSLRestfulClient;
import org.testng.annotations.Test;
......@@ -12,10 +13,9 @@ import java.util.List;
* Created by zhangying on 2020/11/19
*/
public class GetMsgAuthCode {
public class GetMsgAuthCodeAndLogin {
public static SSLRestfulClient sslhttpclient = new SSLRestfulClient();
// public static OkHttpClient okHttpClient = null;
public static HashMap<String, String> headers =new HashMap<>();
public static List params=new ArrayList() {
};
......@@ -23,11 +23,7 @@ public class GetMsgAuthCode {
@Test
public void getMsgAuthCode(){
// dataApi.setApiModule(ApiModele.CloudClass_customerLive) // API 所属模块 必传 读取配置文件config.properties配置的api地址
//// .setApiName("api_msgAuthCode");
// super.beforeTest();
public static void getMsgAuthCode(){
String json="{\n" +
" \"phone\":15068165765,\n" +
......@@ -37,19 +33,30 @@ public class GetMsgAuthCode {
sslhttpclient.doPostRequest("https://gateway.xiaomai5.com/horn/anon/horn/msgAuthCode", params,json,headers);
// okHttpClient.doPostRequest(dataApi.getUrl(),jsonObject.toJSONString(),headers);
// xmAppApi.doRequest(RequestType.JSON,params,jsonObject.toJSONString(),headers).assetsSuccess(true);
// //
// JSONObject responseRes = xmAppApi.getBodyInJSON();
// System.out.println("responseRes= " + responseRes);
}
/**
* 直播学员端,验证码登录
*/
// public static void main(String[] args) {
// GetMsgAuthCode getMsgAuthCode= new GetMsgAuthCode();
// getMsgAuthCode.getMsgAuthCode();
//
// }
@Test
public void liveCLogin(){
headers.put("Content-Type", "application/json");
GetMsgAuthCodeAndLogin.getMsgAuthCode();
JSONObject jsonObject = new JSONObject();
jsonObject.put("accountNo","15068165765");
jsonObject.put("certificate", "0000");
jsonObject.put("loginType", "PHONE_AUTH_CODE");
jsonObject.put("appTerm", "IOS");
jsonObject.put("userType", "C");
System.out.println("jsonObject= " + jsonObject);
sslhttpclient.doPostRequest("https://gateway.xiaomai5.com/zeus/anon/account/login", params,jsonObject.toJSONString(),headers);
JSONObject response = sslhttpclient.getBodyInJSON();
String xmToken=response.getString("result/xmToken");
System.out.println("response = " + response);
System.out.println("xmToken = " + xmToken);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment