Skip to content

Commit

Permalink
test: Add Get Howto [#345]
Browse files Browse the repository at this point in the history
  • Loading branch information
lowgiant committed Feb 13, 2022
1 parent 39e4e8f commit 53bf1fd
Showing 1 changed file with 44 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.bancow.bancowback.domain.sub.howto.controller;

import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.*;
import static org.springframework.restdocs.payload.PayloadDocumentation.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import com.bancow.bancowback.TestSupport;
import com.bancow.bancowback.domain.common.util.token.entity.Token;
import com.bancow.bancowback.domain.common.util.token.repository.TokenRepository;
import com.bancow.bancowback.domain.manager.entity.Manager;

class HowtoControllerTest extends TestSupport {
@Autowired
private TokenRepository tokenRepository;

@Test
@Transactional
void getHowto() throws Exception {
Manager manager = adminManagerLogin();
Token token = tokenRepository.findByManager(manager).get();
mockMvc.perform(
get("/api/howto")

)
.andExpect(status().isOk())
.andDo(
restDocs.document(

responseFields(
fieldWithPath("data").description("결과 데이터"),
fieldWithPath("data[0].id").description("결과 데이터"),
fieldWithPath("data[0].movie_name").description("영상 이름"),
fieldWithPath("data[0].movie_url").description("영상 url"),
fieldWithPath("status").description("HTTP Status")
)
)
)
;
}
}

0 comments on commit 53bf1fd

Please sign in to comment.