Skip to content

Commit

Permalink
test: 테스트 코드의 기존 토큰 인증 방식을 쿠키로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
seokmyungham committed Aug 1, 2024
1 parent 8d56479 commit 58b9ab0
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ void lock() {
String token = getToken(attendee, meeting);

RestAssured.given().log().all()
.cookie("ACCESS_TOKEN", token)
.contentType(ContentType.JSON)
.pathParam("uuid", meeting.getUuid())
.header("Authorization", "Bearer " + token)
.when().patch("/api/v1/meetings/{uuid}/lock")
.then().log().all()
.statusCode(HttpStatus.OK.value());
Expand All @@ -170,9 +170,9 @@ void lockWithInvalidUUID() {
String token = getToken(attendee, meeting);

RestAssured.given().log().all()
.cookie("ACCESS_TOKEN", token)
.contentType(ContentType.JSON)
.pathParam("uuid", invalidUUID)
.header("Authorization", "Bearer " + token)
.when().patch("/api/v1/meetings/{uuid}/lock")
.then().log().all()
.statusCode(HttpStatus.NOT_FOUND.value());
Expand All @@ -186,9 +186,9 @@ void lockWithNoPermission() {
String token = getToken(attendee, meeting);

RestAssured.given().log().all()
.cookie("ACCESS_TOKEN", token)
.contentType(ContentType.JSON)
.pathParam("uuid", meeting.getUuid())
.header("Authorization", "Bearer " + token)
.when().patch("/api/v1/meetings/{uuid}/lock")
.then().log().all()
.statusCode(HttpStatus.FORBIDDEN.value());
Expand All @@ -202,9 +202,9 @@ void unlock() {
String token = getToken(attendee, meeting);

RestAssured.given().log().all()
.cookie("ACCESS_TOKEN", token)
.contentType(ContentType.JSON)
.pathParam("uuid", meeting.getUuid())
.header("Authorization", "Bearer " + token)
.when().patch("/api/v1/meetings/{uuid}/unlock")
.then().log().all()
.statusCode(HttpStatus.OK.value());
Expand All @@ -219,9 +219,9 @@ void unlockWithInvalidUUID() {
String token = getToken(attendee, meeting);

RestAssured.given().log().all()
.cookie("ACCESS_TOKEN", token)
.contentType(ContentType.JSON)
.pathParam("uuid", invalidUUID)
.header("Authorization", "Bearer " + token)
.when().patch("/api/v1/meetings/{uuid}/unlock")
.then().log().all()
.statusCode(HttpStatus.BAD_REQUEST.value());
Expand All @@ -235,9 +235,9 @@ void unlockWithNoPermission() {
String token = getToken(attendee, meeting);

RestAssured.given().log().all()
.cookie("ACCESS_TOKEN", token)
.contentType(ContentType.JSON)
.pathParam("uuid", meeting.getUuid())
.header("Authorization", "Bearer " + token)
.when().patch("/api/v1/meetings/{uuid}/unlock")
.then().log().all()
.statusCode(HttpStatus.FORBIDDEN.value());
Expand All @@ -252,6 +252,6 @@ private String getToken(Attendee attendee, Meeting meeting) {
.when().post("/api/v1/meetings/{uuid}/login", meeting.getUuid())
.then().log().all()
.statusCode(HttpStatus.OK.value())
.extract().jsonPath().getString("data.token");
.extract().cookie("ACCESS_TOKEN");
}
}

0 comments on commit 58b9ab0

Please sign in to comment.