From 5440e1b1ca634293d9950cae98f956f5fa15e559 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sun, 4 Jun 2017 12:19:36 +0200 Subject: [PATCH] Add more tests for untrust page --- .../pterodactylus/sone/web/pages/UntrustPageTest.kt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/UntrustPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/UntrustPageTest.kt index 5848c49..19cfef3 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/UntrustPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/UntrustPageTest.kt @@ -3,6 +3,8 @@ package net.pterodactylus.sone.web.pages import net.pterodactylus.sone.data.Sone import net.pterodactylus.sone.test.mock import net.pterodactylus.util.web.Method.POST +import org.hamcrest.MatcherAssert.assertThat +import org.hamcrest.Matchers.equalTo import org.junit.Test import org.mockito.ArgumentMatchers.any import org.mockito.ArgumentMatchers.eq @@ -19,6 +21,22 @@ class UntrustPageTest : WebPageTest() { override fun getPage() = page @Test + fun `page returns correct path`() { + assertThat(page.path, equalTo("untrust.html")) + } + + @Test + fun `page requires login`() { + assertThat(page.requiresLogin(), equalTo(true)) + } + + @Test + fun `page returns correct title`() { + addTranslation("Page.Untrust.Title", "untrust page title") + assertThat(page.getPageTitle(freenetRequest), equalTo("untrust page title")) + } + + @Test fun `get request does not redirect`() { verifyNoRedirect { verify(core, never()).untrustSone(eq(currentSone), any()) -- 2.7.4