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
93e51304
Commit
93e51304
authored
Feb 07, 2021
by
fanyuanmeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
create:创建视频课api
parent
45f1fc3b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
102 additions
and
6 deletions
+102
-6
src/main/java/com/live/cases/videoClass/TestCreateLesson.java
+94
-0
src/main/java/com/live/cases/videoClass/TestLessonScheduleListPage.java
+1
-1
src/main/java/com/live/xmutils/GetVideoClassData.java
+7
-5
No files found.
src/main/java/com/live/cases/videoClass/TestCreateLesson.java
0 → 100644
View file @
93e51304
package
com
.
live
.
cases
.
videoClass
;
import
com.alibaba.fastjson.JSONObject
;
import
com.live.enums.ApiModele
;
import
com.live.enums.RequestType
;
import
com.live.enums.Terminal
;
import
com.live.utils.RandomStringUtil
;
import
com.live.utils.XMBaseTest
;
import
com.live.xmutils.GetVideoClassData
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeMethod
;
import
org.testng.annotations.Test
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/*
* fym
* 2021-02-07
* */
public
class
TestCreateLesson
extends
XMBaseTest
{
@BeforeMethod
public
void
beforeTest
()
{
xmAppApi
.
setApiModule
(
ApiModele
.
CloudClass_B
)
// API 所属模块 必传 读取配置文件config.properties配置的api地址
.
setApiName
(
"API_createLesson"
)
// API 名称 必传
.
setLoginUser
(
"fym-b"
)
// http 接口,测试账号 必传
.
setTerminal
(
Terminal
.
B
);
// 所属端位(B端,C端,M端等, 必传)
super
.
beforeTest
();
}
@Test
public
void
testCreateLesson
(){
String
scheduleName
=
RandomStringUtil
.
randomNumber
(
20
,
"VideoClass"
);
List
studentIds
=
new
ArrayList
();
studentIds
.
add
(
""
);
Map
picMap
=
new
HashMap
();
picMap
.
put
(
"size"
,
1791124
);
picMap
.
put
(
"mediaName"
,
"微信截图_20190122110413.png"
);
picMap
.
put
(
"mediaContent"
,
"1358261654633242626"
);
picMap
.
put
(
"mediaType"
,
"PICTURE"
);
picMap
.
put
(
"mediaUrl"
,
"blob:https://b.xiaomai5.com/6f8def48-3cc5-4b6b-8266-615ca9129523"
);
Map
textMap
=
new
HashMap
();
textMap
.
put
(
"mediaType"
,
"TEXT"
);
textMap
.
put
(
"mediaContent"
,
"<p>这是视频课简介</p>"
);
textMap
.
put
(
"key"
,
"XeaxxDS5NmSfjEpp"
);
textMap
.
put
(
"mediaContentLength"
,
7
);
List
scheduleMedia
=
new
ArrayList
();
scheduleMedia
.
add
(
picMap
);
scheduleMedia
.
add
(
textMap
);
Map
bodyMap
=
new
HashMap
();
bodyMap
.
put
(
"size"
,
16341066
);
bodyMap
.
put
(
"instId"
,
xmAppApi
.
getLoginInfo
().
getInstId
());
bodyMap
.
put
(
"videoName"
,
"胖胖的你悠然自得.mp4"
);
bodyMap
.
put
(
"videoDuration"
,
30.808644
);
bodyMap
.
put
(
"scheduleName"
,
scheduleName
);
bodyMap
.
put
(
"scheduleVideoId"
,
"1357973439543160834"
);
bodyMap
.
put
(
"joinType"
,
"ALL"
);
bodyMap
.
put
(
"teacherId"
,
"1303609085537103873"
);
bodyMap
.
put
(
"scheduleMedia"
,
scheduleMedia
);
bodyMap
.
put
(
"studentIds"
,
studentIds
);
JSONObject
jsonObject
=
new
JSONObject
(
bodyMap
);
String
bodyData
=
jsonObject
.
toString
();
xmAppApi
.
doRequest
(
RequestType
.
JSON
,
params
,
bodyData
,
headers
);
System
.
out
.
println
(
xmAppApi
);
com
.
alibaba
.
fastjson
.
JSONObject
jsonBody
=
xmAppApi
.
getBodyInJSON
();
GetVideoClassData
getVideoClassData
=
new
GetVideoClassData
();
JSONObject
jsonObject1
=
getVideoClassData
.
VideoClassData
();
String
id
=
jsonObject1
.
getJSONObject
(
"result"
).
getJSONArray
(
"records"
).
getJSONObject
(
0
).
getString
(
"id"
);
Assert
.
assertEquals
(
jsonBody
.
getString
(
"result"
),
id
);
}
}
src/main/java/com/live/cases/
apollo
/TestLessonScheduleListPage.java
→
src/main/java/com/live/cases/
videoClass
/TestLessonScheduleListPage.java
View file @
93e51304
package
com
.
live
.
cases
.
apollo
;
package
com
.
live
.
cases
.
videoClass
;
import
com.live.enums.ApiModele
;
import
com.live.enums.ApiModele
;
import
com.live.enums.RequestType
;
import
com.live.enums.RequestType
;
...
...
src/main/java/com/live/xmutils/GetVideoClassData.java
View file @
93e51304
package
com
.
live
.
xmutils
;
package
com
.
live
.
xmutils
;
import
com.alibaba.fastjson.JSONObject
;
import
com.live.enums.ApiModele
;
import
com.live.enums.ApiModele
;
import
com.live.enums.RequestType
;
import
com.live.enums.RequestType
;
import
com.live.enums.Terminal
;
import
com.live.enums.Terminal
;
import
com.live.utils.XMBaseTest
;
import
com.live.utils.XMBaseTest
;
import
org.json.JSONObject
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -15,7 +17,7 @@ import java.util.Map;
...
@@ -15,7 +17,7 @@ import java.util.Map;
*/
*/
public
class
GetVideoClassData
extends
XMBaseTest
{
public
class
GetVideoClassData
extends
XMBaseTest
{
public
com
.
alibaba
.
fastjson
.
JSONObject
VideoClassData
(){
public
JSONObject
VideoClassData
(){
dataApi
.
setApiModule
(
ApiModele
.
CloudClass_B
)
// API 所属模块 必传 读取配置文件config.properties配置的api地址
dataApi
.
setApiModule
(
ApiModele
.
CloudClass_B
)
// API 所属模块 必传 读取配置文件config.properties配置的api地址
.
setApiName
(
"API_lessonScheduleListPage"
)
// API 名称 必传
.
setApiName
(
"API_lessonScheduleListPage"
)
// API 名称 必传
...
@@ -26,15 +28,15 @@ public class GetVideoClassData extends XMBaseTest {
...
@@ -26,15 +28,15 @@ public class GetVideoClassData extends XMBaseTest {
Map
bodyMap
=
new
HashMap
();
Map
bodyMap
=
new
HashMap
();
bodyMap
.
put
(
"current"
,
1
);
bodyMap
.
put
(
"current"
,
1
);
bodyMap
.
put
(
"instId"
,
xmApp
Api
.
getLoginInfo
().
getInstId
());
bodyMap
.
put
(
"instId"
,
data
Api
.
getLoginInfo
().
getInstId
());
bodyMap
.
put
(
"size"
,
10
);
bodyMap
.
put
(
"size"
,
10
);
JSONObject
jsonObject
=
new
JSONObject
(
bodyMap
);
JSONObject
jsonObject
=
new
JSONObject
(
bodyMap
);
String
bodyData
=
jsonObject
.
toString
();
String
bodyData
=
jsonObject
.
toString
();
dataApi
.
doRequest
(
RequestType
.
JSON
,
params
,
bodyData
,
headers
);
dataApi
.
doRequest
(
RequestType
.
JSON
,
params
,
bodyData
,
headers
);
//System.out.println(dataApi);
com
.
alibaba
.
fastjson
.
JSONObject
jsonBody
=
dataApi
.
getBodyInJSON
();
JSONObject
jsonBody
=
dataApi
.
getBodyInJSON
();
return
jsonBody
;
return
jsonBody
;
...
...
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