X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FCreateReplyAjaxPageTest.kt;h=b192f8491b3450d34627dc47b131a130f3342c44;hb=90098a7e334d7af6a709bfac3e5ee8bf963c793a;hp=9d9008bb7b2cc9dbc6d0f75cfccc03d82e850166;hpb=ec7a80c007d6d759823d6d922e6c680c04d334cd;p=Sone.git diff --git a/src/test/kotlin/net/pterodactylus/sone/web/ajax/CreateReplyAjaxPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/ajax/CreateReplyAjaxPageTest.kt index 9d9008b..b192f84 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/ajax/CreateReplyAjaxPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/ajax/CreateReplyAjaxPageTest.kt @@ -12,22 +12,7 @@ import org.junit.Test /** * Unit test for [CreateReplyAjaxPage]. */ -class CreateReplyAjaxPageTest : JsonPageTest(::CreateReplyAjaxPage) { - - @Test - fun `page returns correct path`() { - assertThat(page.path, equalTo("createReply.ajax")) - } - - @Test - fun `page needs form password`() { - assertThat(page.needsFormPassword(), equalTo(true)) - } - - @Test - fun `page requires login`() { - assertThat(page.requiresLogin(), equalTo(true)) - } +class CreateReplyAjaxPageTest : JsonPageTest("createReply.ajax", pageSupplier = ::CreateReplyAjaxPage) { @Test fun `invalid post ID results in error message`() { @@ -38,7 +23,7 @@ class CreateReplyAjaxPageTest : JsonPageTest(::CreateReplyAjaxPage) { @Test fun `valid post ID results in created reply`() { val post = mock() - addPost("post-id", post) + addPost(post, "post-id") val reply = mock().apply { whenever(id).thenReturn("reply-id") } whenever(core.createReply(currentSone, post, "")).thenReturn(reply) addRequestParameter("post", "post-id") @@ -50,7 +35,7 @@ class CreateReplyAjaxPageTest : JsonPageTest(::CreateReplyAjaxPage) { @Test fun `text is filtered when creating reply`() { val post = mock() - addPost("post-id", post) + addPost(post, "post-id") val reply = mock().apply { whenever(id).thenReturn("reply-id") } whenever(core.createReply(currentSone, post, "Text with KSK@foo.bar link")).thenReturn(reply) addRequestParameter("post", "post-id") @@ -64,9 +49,9 @@ class CreateReplyAjaxPageTest : JsonPageTest(::CreateReplyAjaxPage) { @Test fun `sender can be chosen from local sones`() { val sone = mock().apply { whenever(id).thenReturn("local-sone") } - addLocalSone("local-sone", sone) + addLocalSone(sone) val post = mock() - addPost("post-id", post) + addPost(post, "post-id") val reply = mock().apply { whenever(id).thenReturn("reply-id") } whenever(core.createReply(sone, post, "Text")).thenReturn(reply) addRequestParameter("post", "post-id")