Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(test): create recruitment fixture #576

Closed
wants to merge 27 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5d5f74e
refactor(Term): change response of create api
summerlunaa Jul 16, 2022
167f820
refactor(Recruitment): change response of create api
summerlunaa Jul 16, 2022
785593a
refactor(Mission): change response of create api
summerlunaa Jul 16, 2022
f89f58d
refactor(Evaluation): change response of create api
summerlunaa Jul 16, 2022
ef10ede
refactor(Cheater): change response of create api
summerlunaa Jul 16, 2022
7cdff9e
refactor(Assignment): change response of create api
summerlunaa Jul 16, 2022
813ef60
refactor(Mail): change response of create api
summerlunaa Jul 16, 2022
de9b9d6
refactor: change variable name
summerlunaa Jul 16, 2022
ec6a95b
refactor: change variable name
summerlunaa Jul 16, 2022
0ebb612
feat(Mission): getById api
summerlunaa Jul 16, 2022
d194515
feat(Cheater): getById api
summerlunaa Jul 16, 2022
b68f355
refactor(Term): add administrator authorization
summerlunaa Jul 16, 2022
2b28b1c
refactor(Term): add entity to response of create api
summerlunaa Jul 18, 2022
18ccfb2
refactor(Recruitment): add entity to response of create api
summerlunaa Jul 18, 2022
82591c6
refactor(Term): change response type of create api
summerlunaa Jul 18, 2022
9633834
refactor(Mission): add entity to response of create api
summerlunaa Jul 18, 2022
f00a755
refactor(Evaluation): add entity to response of create api
summerlunaa Jul 18, 2022
3e00b4b
refactor(Cheater): add entity to response of create api
summerlunaa Jul 19, 2022
8560310
refactor(MailHistory): add entity to response of create api
summerlunaa Jul 19, 2022
d3d6a69
refactor(Assignment): add entity to response of create api
summerlunaa Jul 19, 2022
b6024a7
chore: add RestAssured dependency
summerlunaa Jul 24, 2022
5ada03c
test(Term): add TermFixture
summerlunaa Jul 24, 2022
7cf3109
test(RecruitmentItem): add RecruitmentItem Fixture
summerlunaa Jul 24, 2022
f7ed647
test(Recruitment): add Recruitment Fixture
summerlunaa Jul 24, 2022
ef02010
test(Term): add Term id in Term object
summerlunaa Jul 24, 2022
60e24ae
test(RecruitmentItem): create constructor for recruitmentItemData
summerlunaa Jul 24, 2022
6cb48de
test(Recruitment): add Recruitment id in Recruitment object
summerlunaa Jul 24, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor(Term): add administrator authorization
Co-authored-by: dongho108 <dongho108@naver.com>
summerlunaa and dongho108 committed Jul 24, 2022
commit b68f355fd7d5e6c3a9da6e722ab45789f44c2b08
17 changes: 12 additions & 5 deletions src/main/kotlin/apply/ui/api/TermRestController.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package apply.ui.api

import apply.application.TermResponse
import apply.application.TermData
import apply.application.TermResponse
import apply.application.TermService
import apply.domain.term.Term
import apply.domain.user.User
import apply.security.LoginUser
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.DeleteMapping
import org.springframework.web.bind.annotation.GetMapping
@@ -21,29 +23,34 @@ class TermRestController(
) {
@PostMapping
fun create(
@RequestBody termData: TermData
@RequestBody termData: TermData,
@LoginUser(administrator = true) user: User
): ResponseEntity<Unit> {
val savedId = termService.save(termData)
return ResponseEntity.created(URI.create("/api/terms/$savedId")).build()
}

@GetMapping("/{termId}")
fun getById(
@PathVariable termId: Long
@PathVariable termId: Long,
@LoginUser(administrator = true) user: User
): ResponseEntity<ApiResponse<Term>> {
val term = termService.getById(termId)
return ResponseEntity.ok(ApiResponse.success(term))
}

@GetMapping
fun findAll(): ResponseEntity<ApiResponse<List<TermResponse>>> {
fun findAll(
@LoginUser(administrator = true) user: User
): ResponseEntity<ApiResponse<List<TermResponse>>> {
val terms = termService.findAll()
return ResponseEntity.ok(ApiResponse.success(terms))
}

@DeleteMapping("/{termId}")
fun deleteById(
@PathVariable termId: Long
@PathVariable termId: Long,
@LoginUser(administrator = true) user: User
): ResponseEntity<Unit> {
termService.deleteById(termId)
return ResponseEntity.ok().build()
9 changes: 7 additions & 2 deletions src/test/kotlin/apply/ui/api/TermRestControllerTest.kt
Original file line number Diff line number Diff line change
@@ -44,6 +44,7 @@ internal class TermRestControllerTest : RestControllerTest() {
) {
content = objectMapper.writeValueAsString(TermData("3기"))
contentType = MediaType.APPLICATION_JSON
header(HttpHeaders.AUTHORIZATION, "Bearer valid_token")
}.andExpect {
status { isCreated }
header { string(HttpHeaders.LOCATION, "/api/terms/$termId") }
@@ -78,7 +79,9 @@ internal class TermRestControllerTest : RestControllerTest() {

mockMvc.get(
"/api/terms"
).andExpect {
) {
header(HttpHeaders.AUTHORIZATION, "Bearer valid_token")
}.andExpect {
status { isOk }
content { json(objectMapper.writeValueAsString(ApiResponse.success(terms))) }
}
@@ -91,7 +94,9 @@ internal class TermRestControllerTest : RestControllerTest() {

mockMvc.delete(
"/api/terms/{termId}", termId
).andExpect {
) {
header(HttpHeaders.AUTHORIZATION, "Bearer valid_token")
}.andExpect {
status { isOk }
}
}