From: David ‘Bombe’ Roden Date: Sun, 4 Jun 2017 10:19:36 +0000 (+0200) Subject: Add more tests for untrust page X-Git-Tag: 0.9.7^2~173 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=5440e1b1ca634293d9950cae98f956f5fa15e559;p=Sone.git Add more tests for untrust page --- 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())