ERGONOMIC_CODE Telegram 441
Эргономичный код
Привет! Я в Project Mariotte сделал страшное - перешёл на MockMvc. Изначальная мотивация была в том, чтобы сэкономить секунду на запуске Tomcat. Потом выяснилось, что инициализация RestAssured занимает ещё секунду, которую тоже можно сэкономить Но последним…
После Project Mariotte я перенёс подход с MockMVC на другой (закрытый) проект и словил там проблему - по дефолту настройки секьюрити не подтянутся.

Для того чтобы их прикрутить надо:
1. Не забыть добавить зависимость testImplementation("org.springframework.security:spring-security-test")
2. Донастроить webTestClient:
         client = MockMvcWebTestClient
.bindToApplicationContext(applicationContext)
.apply(springSecurity(FilterChainProxy(securityFilterChain)))
.configureClient()
.defaultHeader("Content-Type", "application/json")
.build()


Возможно там где-то дальше ещё какие-то грабли есть, но меня утешает мысль, что вернуться к тестам через HTTP можно будет лёгким движением руки

#ergo_testing@ergonomic_code #tdd@ergonomic_code #mockmvc@ergonomic_code #springsecurity@ergonomic_code #webtestclient@ergonomic_code
👍4



tgoop.com/ergonomic_code/441
Create:
Last Update:

После Project Mariotte я перенёс подход с MockMVC на другой (закрытый) проект и словил там проблему - по дефолту настройки секьюрити не подтянутся.

Для того чтобы их прикрутить надо:
1. Не забыть добавить зависимость testImplementation("org.springframework.security:spring-security-test")
2. Донастроить webTestClient:

         client = MockMvcWebTestClient
.bindToApplicationContext(applicationContext)
.apply(springSecurity(FilterChainProxy(securityFilterChain)))
.configureClient()
.defaultHeader("Content-Type", "application/json")
.build()


Возможно там где-то дальше ещё какие-то грабли есть, но меня утешает мысль, что вернуться к тестам через HTTP можно будет лёгким движением руки

#ergo_testing@ergonomic_code #tdd@ergonomic_code #mockmvc@ergonomic_code #springsecurity@ergonomic_code #webtestclient@ergonomic_code

BY Эргономичный код


Share with your friend now:
tgoop.com/ergonomic_code/441

View MORE
Open in Telegram


Telegram News

Date: |

Developing social channels based on exchanging a single message isn’t exactly new, of course. Back in 2014, the “Yo” app was launched with the sole purpose of enabling users to send each other the greeting “Yo.” The SUCK Channel on Telegram, with a message saying some content has been removed by the police. Photo: Telegram screenshot. Telegram Android app: Open the chats list, click the menu icon and select “New Channel.” Joined by Telegram's representative in Brazil, Alan Campos, Perekopsky noted the platform was unable to cater to some of the TSE requests due to the company's operational setup. But Perekopsky added that these requests could be studied for future implementation. 3How to create a Telegram channel?
from us


Telegram Эргономичный код
FROM American