Skip to content

Commit

Permalink
поправил тесты
Browse files Browse the repository at this point in the history
  • Loading branch information
maxcom committed Nov 26, 2024
1 parent 2802d17 commit 80c8fa5
Showing 1 changed file with 1 addition and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class AddTopicControllerWebTest extends Specification {
"post news without auth" in {
val response = basicRequest
.body(Map(
"user" -> TestUser,
"nick" -> TestUser,
"password" -> TestPassword,
"h-captcha-response" -> "10000000-aaaa-bbbb-cccc-000000000001",
"section" -> Section.SECTION_NEWS.toString,
Expand All @@ -118,30 +118,5 @@ class AddTopicControllerWebTest extends Specification {

finalDoc.text must be contain "Вы поместили сообщение в защищенный раздел."
}

"post news by anonymous" in {
val response = basicRequest
.body(Map(
"user" -> "anonymous",
"password" -> "",
"h-captcha-response" -> "10000000-aaaa-bbbb-cccc-000000000001",
"section" -> Section.SECTION_NEWS.toString,
"group" -> AddTopicControllerWebTest.TestGroupNews.toString,
"csrf" -> "csrf",
"title" -> "Тестовая анонимная новость"))
.cookie(CSRFProtectionService.CSRF_COOKIE, "csrf")
.post(WebHelper.MainUrl.addPath("add.jsp"))
.send(WebHelper.backend)

val doc = Jsoup.parse(response.body.merge, response.request.uri.toString())

doc.select("#messageForm").asScala must be empty

response.code must be equalTo StatusCode.Ok

val finalDoc = Jsoup.parse(response.body.merge, response.request.uri.toString())

finalDoc.text must be contain "Вы поместили сообщение в защищенный раздел."
}
}
}

0 comments on commit 80c8fa5

Please sign in to comment.