Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Team6-Digital Insight for Health
Manage
Activity
Members
Labels
Plan
Issues
12
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Chen Liang
Team6-Digital Insight for Health
Commits
45c38d42
Commit
45c38d42
authored
1 month ago
by
Chen Liang
Browse files
Options
Downloads
Patches
Plain Diff
Delete HttpTest.java
parent
4cb162ef
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/com/cardiff/wylTest/HttpTest.java
+0
-56
0 additions, 56 deletions
src/test/java/com/cardiff/wylTest/HttpTest.java
with
0 additions
and
56 deletions
src/test/java/com/cardiff/wylTest/HttpTest.java
deleted
100644 → 0
+
0
−
56
View file @
4cb162ef
package
com.cardiff.wylTest
;
import
com.cardiff.client_project.utils.Result
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.boot.test.web.client.TestRestTemplate
;
import
org.springframework.http.ResponseEntity
;
import
java.util.HashMap
;
import
java.util.Map
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
@SpringBootTest
(
webEnvironment
=
SpringBootTest
.
WebEnvironment
.
RANDOM_PORT
)
public
class
HttpTest
{
@Value
(
value
=
"${local.server.port}"
)
private
int
port
;
@Autowired
private
TestRestTemplate
restTemplate
;
@Test
public
void
testFaultPage
()
throws
Exception
{
assertThat
(
this
.
restTemplate
.
getForObject
(
"http://localhost:"
+
port
+
"/fault.html"
,
String
.
class
)).
contains
(
"You do not have sufficient access rights, the page will be redirected to the login page within"
);
}
@Test
public
void
testLoginPage
()
throws
Exception
{
assertThat
(
this
.
restTemplate
.
getForObject
(
"http://localhost:"
+
port
+
"/login.html"
,
String
.
class
)).
contains
(
"Verification code"
);
}
@Test
public
void
testLogin
()
throws
Exception
{
String
loginUrl
=
"http://localhost:"
+
port
+
"/superAdmin/sign"
;
Map
<
String
,
String
>
loginData
=
new
HashMap
<>();
loginData
.
put
(
"name"
,
"2649783657@qq.com"
);
loginData
.
put
(
"password"
,
"admin"
);
loginData
.
put
(
"role"
,
"super"
);
loginData
.
put
(
"status"
,
"1"
);
ResponseEntity
<
Result
>
loginResponse
=
this
.
restTemplate
.
postForEntity
(
loginUrl
,
loginData
,
Result
.
class
);
assertThat
(
loginResponse
.
getStatusCode
().
value
()).
isEqualTo
(
200
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment