Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
test-platform
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
马博
test-platform
Commits
12e07b97
Commit
12e07b97
authored
Nov 28, 2018
by
wangxiaoshuang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wxs
parent
467b1c62
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
192 additions
and
0 deletions
+192
-0
自有实物商品.java
src/test/java/http/cases/GoodsAndTradeTest/自有实物商品.java
+12
-0
DevDoUpdateObject.java
src/test/java/http/service/goods/DevDoUpdateObject.java
+116
-0
DuibadoUpdateObject.java
src/test/java/http/service/goods/DuibadoUpdateObject.java
+64
-0
No files found.
src/test/java/http/cases/GoodsAndTradeTest/自有实物商品.java
0 → 100644
View file @
12e07b97
package
http
.
cases
.
GoodsAndTradeTest
;
import
base.Config
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.test.context.testng.AbstractTestNGSpringContextTests
;
@ContextConfiguration
(
classes
=
Config
.
class
)
public
class
自有实物商品
extends
AbstractTestNGSpringContextTests
{
}
src/test/java/http/service/goods/DevDoUpdateObject.java
0 → 100644
View file @
12e07b97
package
http
.
service
.
goods
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
http.service.Authorization
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.testng.Assert
;
import
java.util.HashMap
;
import
java.util.Map
;
import
static
io
.
restassured
.
RestAssured
.
given
;
@Service
public
class
DevDoUpdateObject
{
@Value
(
"${hdserver.host}"
)
String
hdHost
;
@Autowired
Authorization
authorization
;
//单规格实物---自有商品
public
Response
doUpdateAppItem
(
String
appId
,
String
levelLimitType
,
String
classifyIds
,
String
title
,
String
sellingPoint
,
String
levelCheckbox
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/devItemNew/doUpdateObject"
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
appId
);
//应用ID
map
.
put
(
"isOwner"
,
"1"
);
//是否自有商品 1:是 0:否
map
.
put
(
"multiImage"
,
"[\"//yun.dui88.com/images/201811/i01a314qr1.jpg\"]"
);
//商品主图列表,json数组
map
.
put
(
"multiSku"
,
"false"
);
//是否为多规格,true:是, false:否
map
.
put
(
"levelLimitType"
,
levelLimitType
);
map
.
put
(
"classifyIds"
,
classifyIds
);
//商品分组id列表
map
.
put
(
"title"
,
title
);
//标题
map
.
put
(
"sellingPoint"
,
sellingPoint
);
//卖点描述
map
.
put
(
"devAudit"
,
"true"
);
//是否开启商品审核 true:开启 false:关闭
map
.
put
(
"arealimitSwitch"
,
"true"
);
map
.
put
(
"arealimitAreas"
,
"[{\"provinceCode\":\"320000\",\"provinceName\":\"江苏省\",\"cityName\":\"全省范围\",\"cityCode\":\"all\"}]"
);
map
.
put
(
"levelLimit"
,
"true"
);
//是否开启vip等级限制 true开启,false 未开启
map
.
put
(
"levelCheckbox"
,
levelCheckbox
);
//会员等级列表
map
.
put
(
"expressPrice"
,
"0"
);
//运费价格
map
.
put
(
"weixinShareDesc"
,
""
);
//微信分享描述
map
.
put
(
"description"
,
"<p>图文详情:接口自动化的图文信息</p>"
);
map
.
put
(
"type"
,
"object"
);
//商品类型 object:实物,coupon:优惠券,virtual:虚拟商品 ,phonebill:话费 , alipay:支付宝 ,qb:Q币 ,phoneflow:流量
map
.
put
(
"subType"
,
"0"
);
//优惠券子类型 0:普通, 1:链接型 , 2:可重复, 3:卡密
map
.
put
(
"limitType"
,
"forever"
);
//限制类型,forever:永久 everyday 每天 DAY_3:表示每3天
map
.
put
(
"limitCount"
,
"10"
);
//限制次数
map
.
put
(
"expressType"
,
"free"
);
//运费类型,free:包邮,unity:统一运费,template:运费模板
map
.
put
(
"attributes"
,
"[{\"skuInfo\":{\"remaining\":\"22\",\"salePrice\":\"222\",\"facePrice\":\"22\",\"merchantCoding\":\"test\"},\"children\":null}]"
);
//json 格式转成form表单
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
body
(
jsonParam
).
post
(
url
);
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"创建接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"创建失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//查询商品列表
public
Response
appItems
(
String
appId
,
String
itemName
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/devItem/appItems"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
appId
);
map
.
put
(
"itemName"
,
itemName
);
map
.
put
(
"rowId"
,
"1"
);
map
.
put
(
"pageSize"
,
"10"
);
map
.
put
(
"itemType"
,
""
);
map
.
put
(
"status"
,
""
);
map
.
put
(
"belong"
,
""
);
map
.
put
(
"priceType"
,
""
);
map
.
put
(
"classifyId"
,
""
);
// logger.info("======="+url);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
post
(
url
);
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
,
"/devItem/appItems接口失败"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"/devItem/appItems接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"/devItem/appItems接口失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//保存积分配置
public
Response
doUpdateCredits
(
String
appId
,
String
appItemId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/devItemNew/doUpdateCredits"
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
appId
);
//appid
map
.
put
(
"appItemId"
,
appItemId
);
//商品ID
map
.
put
(
"buttonText"
,
""
);
map
.
put
(
"creditsInfos"
,
"[{skuId: \"0\"}]"
);
//自定义
map
.
put
(
"dateRage"
,
"[\"2018-11-29\", \"2019-05-31\"]"
);
map
.
put
(
"exchangeType"
,
"1"
);
//兑换类型,1:自动 2:自定义
map
.
put
(
"indexHidden"
,
"true"
);
//是否在首页商品区隐藏,true:隐藏 false:显示
map
.
put
(
"limitDate"
,
"2018-11-29,2019-05-31"
);
//兑换日期限制
map
.
put
(
"limitEverydayQuantity"
,
"6"
);
//每日限量
map
.
put
(
"multiSku"
,
"false"
);
map
.
put
(
"onSale"
,
"false"
);
//是否上架 true:立即上架 false:放入仓库
map
.
put
(
"originalPriceBuy"
,
"true"
);
//是否支持原价购买 ,true:支持 false:不支持
//json 格式转成form表单
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
body
(
jsonParam
).
post
(
url
);
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"创建接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"创建失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
}
src/test/java/http/service/goods/DuibadoUpdateObject.java
0 → 100644
View file @
12e07b97
package
http
.
service
.
goods
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
http.service.Authorization
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.testng.Assert
;
import
java.util.HashMap
;
import
java.util.Map
;
import
static
io
.
restassured
.
RestAssured
.
given
;
@Service
public
class
DuibadoUpdateObject
{
@Value
(
"${manager.host}"
)
String
ManagerHost
;
//ManagerHost = mng.duibatest.com.cn
@Autowired
Authorization
authorization
;
/*
{,"attributes":[{"skuInfo":{"remaining":"100","supplyPrice":"10","salePrice":"22","facePrice":"11","merchantCoding":"TTTYYY"},"children":null}]}
*/
//单规格实物---兑吧商品
public
Response
doUpdateObject
(
String
name
)
throws
Exception
{
String
url
=
"http://"
+
ManagerHost
+
"/goods/object/doUpdateObject"
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"type"
,
"object"
);
map
.
put
(
"multiImage"
,
"[\"//yun.dui88.com/images/201811/ndz1zqhyh3.png\"]"
);
map
.
put
(
"preSaasMallVTypeList"
,
"[]"
);
map
.
put
(
"saasMallVTypeList"
,
"[1,2,3,4]"
);
map
.
put
(
"expressType"
,
"unity"
);
map
.
put
(
"directRecharge"
,
"0"
);
map
.
put
(
"multiSku"
,
"false"
);
map
.
put
(
"attrsCopy"
,
"[]"
);
map
.
put
(
"opTypeActivity"
,
"off"
);
map
.
put
(
"name"
,
name
);
map
.
put
(
"memo"
,
"兑吧商品备注"
);
map
.
put
(
"multiImageStr"
,
"//yun.dui88.com/images/201811/ndz1zqhyh3.png"
);
//商品主图
map
.
put
(
"smallImage"
,
"//yun.dui88.com/images/201811/8quo3igywn.png"
);
//商品缩略图
map
.
put
(
"expressPrice"
,
"3"
);
map
.
put
(
"description"
,
"商品描述分享信息"
);
map
.
put
(
"alertMessage"
,
"999"
);
map
.
put
(
"attributes"
,
"888"
);
map
.
put
(
"attributes"
,
"[{\"skuInfo\":{\"remaining\":\"100\",\"supplyPrice\":\"10\",\"salePrice\":\"22\",\"facePrice\":\"11\",\"merchantCoding\":\"TTTYYY\"},\"children\":null}]"
);
//json 格式转成form表单
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
ssoLogin
()).
body
(
jsonParam
).
post
(
url
);
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"创建接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"创建失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
}
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