Skip to content

Commit

Permalink
Merge pull request #328 from team-haribo/327-test-push-alert-api
Browse files Browse the repository at this point in the history
🔁 푸시 알림 테스트 API 구현
  • Loading branch information
enbraining authored Dec 10, 2024
2 parents 4c3eda2 + 2e86e17 commit d100335
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class SecurityConfig(
// /notification
.mvcMatchers(HttpMethod.POST, "/api/v2/notification/token/{deviceToken}").hasAnyAuthority(Authority.ROLE_STUDENT.name, Authority.ROLE_STUDENT_COUNCIL.name)
.mvcMatchers(HttpMethod.DELETE, "/api/v2/notification/token").hasAnyAuthority(Authority.ROLE_STUDENT.name, Authority.ROLE_STUDENT_COUNCIL.name)
.mvcMatchers(HttpMethod.POST, "/api/v2/notification/token/test").hasAnyAuthority(Authority.ROLE_STUDENT_COUNCIL.name)
.mvcMatchers(HttpMethod.GET, "/api/v2/notification/outing/before").permitAll()
.mvcMatchers(HttpMethod.GET, "/api/v2/notification/outing/after").permitAll()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ class NotificationController(
setDeviceTokenUseCase.execute(deviceToken)
.run { ResponseEntity.status(HttpStatus.NO_CONTENT).build() }

@PostMapping("token/test")
fun sendTest(): ResponseEntity<Void> =
sendNotificationUseCase.execute(NotificationType.FIRST_NOTIFICATION)
.run { ResponseEntity.ok().build() }

@DeleteMapping("token")
fun deleteDeviceToken(): ResponseEntity<Void> =
deleteDeviceTokenUseCase.execute()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import org.springframework.test.web.servlet.result.MockMvcResultHandlers
import org.springframework.test.web.servlet.result.MockMvcResultMatchers.*
import org.springframework.test.web.servlet.setup.MockMvcBuilders
import java.time.LocalTime
import java.time.temporal.ChronoUnit
import java.util.*

internal class OutingControllerTest: DescribeSpec({
Expand Down Expand Up @@ -105,7 +106,9 @@ internal class OutingControllerTest: DescribeSpec({
.andExpect(jsonPath("$[0].grade").value(outingAccountHttpResponse.grade))
.andExpect(jsonPath("$[0].gender").value(outingAccountHttpResponse.gender.toString()))
.andExpect(jsonPath("$[0].profileUrl").value(outingAccountHttpResponse.profileUrl))
.andExpect(jsonPath("$[0].createdTime").value(outingAccountHttpResponse.createdTime.toString()))
.andExpect(jsonPath("$[0].createdTime").value(
outingAccountHttpResponse.createdTime.truncatedTo(ChronoUnit.MICROS).toString()
))
.andDo(MockMvcResultHandlers.print())
}
}
Expand Down

0 comments on commit d100335

Please sign in to comment.