Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xm-autotest-live
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiamai-test
xm-autotest-live
Commits
0507141d
Commit
0507141d
authored
Nov 28, 2020
by
zhangying
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加账号信息
parent
1050f1e5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
19 deletions
+70
-19
src/main/java/com/live/cases/apollo/TestJudgeLessonPermission.java
+44
-0
src/main/java/com/live/xmutils/GetMsgAuthCodeAndLogin.java
+26
-19
No files found.
src/main/java/com/live/cases/apollo/TestJudgeLessonPermission.java
0 → 100644
View file @
0507141d
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"));
}
}
src/main/java/com/live/xmutils/GetMsgAuthCode.java
→
src/main/java/com/live/xmutils/GetMsgAuthCode
AndLogin
.java
View file @
0507141d
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
GetMsgAuthCode
AndLogin
{
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
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment