Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
oto
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
龚小红
oto
Commits
7ff7c44c
Commit
7ff7c44c
authored
Jul 30, 2021
by
郭姣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
上传链接接口用例修改
parent
762f8388
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
35 deletions
+26
-35
Upload.java
src/test/java/com/kjj/cases/assistant/homePage/Upload.java
+25
-35
BasicConfig.java
src/test/java/com/kjj/config/BasicConfig.java
+1
-0
No files found.
src/test/java/com/kjj/cases/assistant/homePage/Upload.java
View file @
7ff7c44c
package
com
.
kjj
.
cases
.
assistant
.
homePage
;
package
com
.
kjj
.
cases
.
assistant
.
homePage
;
import
static
com
.
kjj
.
config
.
BasicConfig
.*;
import
static
com
.
kjj
.
config
.
BasicConfig
.*;
import
com.kjj.utils.NetworkUtils
;
import
com.kjj.cases.admin.Authorization
;
import
com.kjj.utils.BaseUtils
;
import
io.restassured.response.Response
;
import
io.restassured.response.Response
;
import
org.testng.Assert
;
import
org.testng.Assert
;
import
org.testng.annotations.*
;
import
org.testng.annotations.*
;
...
@@ -12,12 +14,15 @@ import java.io.IOException;
...
@@ -12,12 +14,15 @@ import java.io.IOException;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
public
class
Upload
{
public
class
Upload
implements
Authorization
{
private
static
final
NetworkUtils
network
=
NetworkUtils
.
getInstance
();
@BeforeClass
@BeforeClass
public
void
setUp
()
{
public
void
setUp
()
{
System
.
out
.
println
();
// System.out.println();
agentTku
();
// userTku();
//管理后台登录
BaseUtils
.
ssoLogin
();
}
}
// @Test(description="会员判断",priority = 1)
// @Test(description="会员判断",priority = 1)
...
@@ -92,6 +97,7 @@ public class Upload {
...
@@ -92,6 +97,7 @@ public class Upload {
public
void
上传
_
视频链接
()
throws
IOException
{
public
void
上传
_
视频链接
()
throws
IOException
{
//待上传的视频链接
//待上传的视频链接
String
videoLink
=
"https://v.douyin.com/oEahcd/ 复制此链接,打开【抖音短视频】,直接观看视频!"
;
String
videoLink
=
"https://v.douyin.com/oEahcd/ 复制此链接,打开【抖音短视频】,直接观看视频!"
;
//String videoLink = "https://www.douyin.com/video/6935725226881715460?previous_page=video_detail";
//开始上传
//开始上传
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
...
@@ -151,26 +157,8 @@ public class Upload {
...
@@ -151,26 +157,8 @@ public class Upload {
Assert
.
assertEquals
(
shareLink
,
network_link
,
network
.
message
(
updateParams
,
UPLOAD_UPDATEANDSHARE
,
"传其他链接-上传和分享调用失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
shareLink
,
network_link
,
network
.
message
(
updateParams
,
UPLOAD_UPDATEANDSHARE
,
"传其他链接-上传和分享调用失败"
,
response
.
body
().
asString
()));
}
}
@Test
(
description
=
"上传_本地视频"
,
priority
=
8
)
public
void
上传
_
本地视频
()
throws
IOException
{
//1.上传视频到oss
String
videoFile
=
"src/test/java/com/kjj/resource/uploadCase.mp4"
;
Response
response
=
network
.
postFileResponse
(
videoFile
,
UPLOAD_UPLOADVEDIO
);
String
videoUrl
=
response
.
jsonPath
().
getString
(
"data.videoUrl"
);
String
firstFrameUrl
=
response
.
jsonPath
().
getString
(
"data.firstFrameUrl"
);
Assert
.
assertNotNull
(
videoUrl
,
network
.
message
(
UPLOAD_UPLOADVEDIO
,
"上传本地视频-上传oss失败"
,
response
.
body
().
asString
()));
//2.开始上传视频
// Map<String, Object> params = new HashMap<String, Object>();
// params.put("videoUrl",videoUrl);
// params.put("firstFrameUrl",firstFrameUrl);
// params.put("contentTitle","=自动化测试=");
// response = network.postResponse(params, UPLOAD_SELLERUPLOADVEDIO);
// String contentId = response.jsonPath().getString("data.contentId");
// Assert.assertNotNull(contentId,network.message(params, UPLOAD_SELLERUPLOADVEDIO,"上传本地视频-上传第2步失败"));
}
@Test
(
description
=
"大家都在转_榜单列表"
,
priority
=
9
)
@Test
(
description
=
"大家都在转_榜单列表"
,
priority
=
8
)
public
void
大家都在转
_
榜单列表
()
throws
IOException
{
public
void
大家都在转
_
榜单列表
()
throws
IOException
{
//获取文章的榜单
//获取文章的榜单
Response
response
=
network
.
getResponse
(
UPLOAD_HOT
);
Response
response
=
network
.
getResponse
(
UPLOAD_HOT
);
...
@@ -188,7 +176,7 @@ public class Upload {
...
@@ -188,7 +176,7 @@ public class Upload {
}
}
//我的上传:
//我的上传:
@Test
(
description
=
"我的上传"
,
priority
=
10
)
@Test
(
description
=
"我的上传"
,
priority
=
9
)
public
void
我的上传
()
throws
IOException
{
public
void
我的上传
()
throws
IOException
{
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageIndex"
,
1
);
...
@@ -197,29 +185,30 @@ public class Upload {
...
@@ -197,29 +185,30 @@ public class Upload {
//获取文章的列表
//获取文章的列表
params
.
put
(
"type"
,
"article"
);
params
.
put
(
"type"
,
"article"
);
Response
response
=
network
.
getResponse
(
params
,
UPLOAD_
LIST
);
Response
response
=
network
.
getResponse
(
params
,
UPLOAD_
listV2
);
int
length
=
response
.
jsonPath
().
getInt
(
"data.size()"
);
int
length
=
response
.
jsonPath
().
getInt
(
"data.size()"
);
String
contentType
=
response
.
jsonPath
().
getString
(
"data[0].contentType"
);
String
contentType
=
response
.
jsonPath
().
getString
(
"data[0].contentType"
);
Assert
.
assertEquals
(
length
,
1
,
network
.
message
(
params
,
UPLOAD_
LIST
,
"获取我的上传-文章列表内容有误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
length
,
1
,
network
.
message
(
params
,
UPLOAD_
listV2
,
"获取我的上传-文章列表内容有误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
contentType
,
"article"
,
network
.
message
(
params
,
UPLOAD_
LIST
,
"获取我的上传-文章列表数量有误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
contentType
,
"article"
,
network
.
message
(
params
,
UPLOAD_
listV2
,
"获取我的上传-文章列表数量有误"
,
response
.
body
().
asString
()));
//获取视频的列表
//获取视频的列表
params
.
put
(
"type"
,
"video"
);
params
.
put
(
"type"
,
"video"
);
response
=
network
.
getResponse
(
params
,
UPLOAD_LIST
);
params
.
put
(
"pageNo"
,
1
);
response
=
network
.
getResponse
(
params
,
UPLOAD_listV2
);
length
=
response
.
jsonPath
().
getInt
(
"data.size()"
);
length
=
response
.
jsonPath
().
getInt
(
"data.size()"
);
contentType
=
response
.
jsonPath
().
getString
(
"data[0].contentType"
);
contentType
=
response
.
jsonPath
().
getString
(
"data[0].contentType"
);
Assert
.
assertEquals
(
length
,
1
,
network
.
message
(
params
,
UPLOAD_
LIST
,
"获取我的上传-视频列表内容有误"
,
response
.
body
().
asString
()));
//因为有一篇抖音,一篇本地,所以数量是2
Assert
.
assertEquals
(
length
,
1
,
network
.
message
(
params
,
UPLOAD_
listV2
,
"获取我的上传-视频列表内容有误"
,
response
.
body
().
asString
()));
//因为有一篇抖音,一篇本地,所以数量是2
Assert
.
assertEquals
(
contentType
,
"video"
,
network
.
message
(
params
,
UPLOAD_
LIST
,
"获取我的上传-视频列表数量有误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
contentType
,
"video"
,
network
.
message
(
params
,
UPLOAD_
listV2
,
"获取我的上传-视频列表数量有误"
,
response
.
body
().
asString
()));
//获取其他的列表
//获取其他的列表
params
.
put
(
"type"
,
"network_link"
);
params
.
put
(
"type"
,
"network_link"
);
response
=
network
.
getResponse
(
params
,
UPLOAD_
LIST
);
response
=
network
.
getResponse
(
params
,
UPLOAD_
listV2
);
String
network_linkId
=
response
.
jsonPath
().
getString
(
"data[0].id"
);
//获取列表的第一篇素材
String
network_linkId
=
response
.
jsonPath
().
getString
(
"data[0].id"
);
//获取列表的第一篇素材
length
=
response
.
jsonPath
().
getInt
(
"data.size()"
);
length
=
response
.
jsonPath
().
getInt
(
"data.size()"
);
contentType
=
response
.
jsonPath
().
getString
(
"data[0].contentType"
);
contentType
=
response
.
jsonPath
().
getString
(
"data[0].contentType"
);
Assert
.
assertEquals
(
length
,
1
,
network
.
message
(
params
,
UPLOAD_
LIST
,
"获取我的上传-其他列表失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
length
,
1
,
network
.
message
(
params
,
UPLOAD_
listV2
,
"获取我的上传-其他列表失败"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
contentType
,
"network_link"
,
network
.
message
(
params
,
UPLOAD_
LIST
,
"获取我的上传-其他列表数量有误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
contentType
,
"network_link"
,
network
.
message
(
params
,
UPLOAD_
listV2
,
"获取我的上传-其他列表数量有误"
,
response
.
body
().
asString
()));
//删除其他列表的素材
//删除其他列表的素材
Map
<
String
,
Object
>
unbindParams
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
unbindParams
=
new
HashMap
<
String
,
Object
>();
...
@@ -229,9 +218,10 @@ public class Upload {
...
@@ -229,9 +218,10 @@ public class Upload {
Assert
.
assertTrue
(
data
,
network
.
message
(
unbindParams
,
UPLOAD_UNBIND
,
"删除我的上传-其他列表的素材失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
data
,
network
.
message
(
unbindParams
,
UPLOAD_UNBIND
,
"删除我的上传-其他列表的素材失败"
,
response
.
body
().
asString
()));
//再次获取其他的列表, 检查删除是否生效
//再次获取其他的列表, 检查删除是否生效
response
=
network
.
getResponse
(
params
,
UPLOAD_
LIST
);
response
=
network
.
getResponse
(
params
,
UPLOAD_
listV2
);
length
=
response
.
jsonPath
().
getInt
(
"data.size()"
);
length
=
response
.
jsonPath
().
getInt
(
"data.size()"
);
Assert
.
assertEquals
(
length
,
0
,
network
.
message
(
params
,
UPLOAD_LIST
,
"获取我的上传-其他列表数量有误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
length
,
0
,
network
.
message
(
params
,
UPLOAD_listV2
,
"获取我的上传-其他列表数量有误"
,
response
.
body
().
asString
()));
}
}
}
}
\ No newline at end of file
src/test/java/com/kjj/config/BasicConfig.java
View file @
7ff7c44c
...
@@ -680,6 +680,7 @@ public class BasicConfig {
...
@@ -680,6 +680,7 @@ public class BasicConfig {
public
static
final
String
UPLOAD_HOT
=
HOST
+
"/kjy/mp/seller/import/hot"
;
public
static
final
String
UPLOAD_HOT
=
HOST
+
"/kjy/mp/seller/import/hot"
;
public
static
final
String
UPLOAD_VIDEOHOT
=
HOST
+
"/kjy/mp/seller/import/video/hot"
;
public
static
final
String
UPLOAD_VIDEOHOT
=
HOST
+
"/kjy/mp/seller/import/video/hot"
;
public
static
final
String
UPLOAD_LIST
=
HOST
+
"/kjy/mp/seller/import/list"
;
public
static
final
String
UPLOAD_LIST
=
HOST
+
"/kjy/mp/seller/import/list"
;
public
static
final
String
UPLOAD_listV2
=
HOST
+
"/kjy/mp/seller/import/listV2"
;
public
static
final
String
UPLOAD_UNBIND
=
HOST
+
"/kjy/mp/seller/import/unbind"
;
public
static
final
String
UPLOAD_UNBIND
=
HOST
+
"/kjy/mp/seller/import/unbind"
;
public
static
final
String
UPLOAD_supportDomain
=
HOST
+
"/kjy/mp/supportDomain"
;
public
static
final
String
UPLOAD_supportDomain
=
HOST
+
"/kjy/mp/supportDomain"
;
public
static
final
String
UPLOAD_sellerFirstVisit
=
HOST
+
"/kjy/mp/newFunction/sellerFirstVisit"
;
public
static
final
String
UPLOAD_sellerFirstVisit
=
HOST
+
"/kjy/mp/newFunction/sellerFirstVisit"
;
...
...
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