X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FGetStatusAjaxPageTest.kt;h=0d8cb543639a1487a86f309a5e27224f9cd9a259;hb=90098a7e334d7af6a709bfac3e5ee8bf963c793a;hp=2be420d77d012041f437c01aa3839b14b4195e30;hpb=40998dc856efb0df91f669c6dff1b829d573a54a;p=Sone.git diff --git a/src/test/kotlin/net/pterodactylus/sone/web/ajax/GetStatusAjaxPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/ajax/GetStatusAjaxPageTest.kt index 2be420d..0d8cb54 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/ajax/GetStatusAjaxPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/ajax/GetStatusAjaxPageTest.kt @@ -28,7 +28,7 @@ import java.util.TimeZone /** * Unit test for [GetStatusAjaxPage]. */ -class GetStatusAjaxPageTest: JsonPageTest() { +class GetStatusAjaxPageTest: JsonPageTest("getStatus.ajax", requiresLogin = false, needsFormPassword = false) { private val timeTextConverter = mock() private val l10nFilter = mock() @@ -41,21 +41,6 @@ class GetStatusAjaxPageTest: JsonPageTest() { } @Test - fun `page returns correct path`() { - assertThat(page.path, equalTo("getStatus.ajax")) - } - - @Test - fun `page does not require form password`() { - assertThat(page.needsFormPassword(), equalTo(false)) - } - - @Test - fun `page does not require login`() { - assertThat(page.requiresLogin(), equalTo(false)) - } - - @Test fun `page returns correct attribute “loggedIn” if sone is logged in`() { assertThat(json.get("loggedIn").asText(), equalTo("true")) } @@ -69,9 +54,9 @@ class GetStatusAjaxPageTest: JsonPageTest() { @Test fun `page returns options for sone if sone is logged in`() { assertThat(json.get("options").toMap(), allOf( - hasEntry("ShowNotification/NewSones", "false"), - hasEntry("ShowNotification/NewPosts", "false"), - hasEntry("ShowNotification/NewReplies", "false") + hasEntry("ShowNotification/NewSones", "true"), + hasEntry("ShowNotification/NewPosts", "true"), + hasEntry("ShowNotification/NewReplies", "true") )) } @@ -112,7 +97,7 @@ class GetStatusAjaxPageTest: JsonPageTest() { mock().apply { whenever(this.createdTime).thenReturn(2000) }, mock().apply { whenever(this.createdTime).thenReturn(1000) } ) - addNotification(*notifications.toTypedArray()) + notifications.forEachIndexed { index, notification -> addNotification(notification, "notification$index")} assertThat(json.get("notificationHash").asInt(), equalTo(notifications.sortedBy { it.createdTime }.hashCode())) }