From: David ‘Bombe’ Roden Date: Sat, 8 Apr 2017 15:37:58 +0000 (+0200) Subject: Add some tests for the edit image page X-Git-Tag: 0.9.7^2~257 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=d42da49d38b464416be5d74c167ef6b02bd1ccc7;p=Sone.git Add some tests for the edit image page --- diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/EditImagePageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/EditImagePageTest.kt index d36dec5..810e149 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/EditImagePageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/EditImagePageTest.kt @@ -7,10 +7,10 @@ import net.pterodactylus.sone.data.Sone import net.pterodactylus.sone.test.mock import net.pterodactylus.sone.test.mockBuilder import net.pterodactylus.sone.test.whenever -import net.pterodactylus.sone.web.pages.EditImagePage -import net.pterodactylus.sone.web.pages.WebPageTest import net.pterodactylus.util.web.Method.GET import net.pterodactylus.util.web.Method.POST +import org.hamcrest.MatcherAssert.assertThat +import org.hamcrest.Matchers.equalTo import org.junit.Before import org.junit.Test import org.mockito.Mockito.never @@ -41,6 +41,22 @@ class EditImagePageTest : WebPageTest() { } @Test + fun `page returns correct path`() { + assertThat(page.path, equalTo("editImage.html")) + } + + @Test + fun `page requires login`() { + assertThat(page.requiresLogin(), equalTo(true)) + } + + @Test + fun `page returns correct title`() { + whenever(l10n.getString("Page.EditImage.Title")).thenReturn("edit image page title") + assertThat(page.getPageTitle(freenetRequest), equalTo("edit image page title")) + } + + @Test fun `get request does not redirect`() { request("", GET) page.handleRequest(freenetRequest, templateContext)