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
ef6afeaf
Commit
ef6afeaf
authored
Dec 19, 2018
by
赵然
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zr
parent
a94d0f69
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
1 deletion
+90
-1
Authorization.java
src/test/java/http/service/Authorization.java
+1
-1
mallService.java
src/test/java/http/service/Saas/mallService.java
+89
-0
No files found.
src/test/java/http/service/Authorization.java
View file @
ef6afeaf
...
...
@@ -405,7 +405,7 @@ public class Authorization {
Map
<
String
,
String
>
paras
=
new
HashMap
<>();
paras
.
put
(
"email"
,
ssoName
);
paras
.
put
(
"password"
,
ssoPassword
);
//
paras.put("loginTimeout", "1");
paras
.
put
(
"loginTimeout"
,
"1"
);
paras
.
put
(
"systemId"
,
"1"
);
paras
.
put
(
"redirect"
,
"http://mng.duibatest.com.cn/AItem/index.htm"
);
...
...
src/test/java/http/service/Saas/mallService.java
0 → 100644
View file @
ef6afeaf
package
http
.
service
.
Saas
;
import
base.DuibaLog
;
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
;
/**
* Created by zhaoran on 2018/12/19.
*/
@Service
public
class
mallService
{
@Value
(
"${activity.host}"
)
String
activityHost
;
@Autowired
Authorization
authorization
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
//获取购物车列表商品
public
Response
mallget
(
Integer
uid
)
throws
Exception
{
String
url
=
activityHost
+
"/mall-api/consumer/shopping-trolley/get"
;
Response
response
=
given
().
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
get
(
url
);
response
.
prettyPrint
();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"购物车列表接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"购物车列表接口失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//获取购物车列表商品
public
Response
getMallCount
(
Integer
uid
)
throws
Exception
{
String
url
=
activityHost
+
"/mall-api/consumer/market-activity/getMallCount"
;
Response
response
=
given
().
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
get
(
url
);
response
.
prettyPrint
();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"购物车数目接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"购物车数目接口失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
// 加入购物车
public
Response
malladd
(
String
appItemId
,
Integer
uid
)
throws
Exception
{
String
url
=
activityHost
+
"/mall-api/consumer/shopping-trolley/add"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appItemId"
,
appItemId
);
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
body
(
jsonParam
).
post
(
url
);
response
.
prettyPrint
();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"添加购物车接口失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"添加购物车接口失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
}
\ No newline at end of file
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