Replace Sone template page with Kotlin version
[Sone.git] / src / test / kotlin / net / pterodactylus / sone / web / pages / SoneTemplatePageTest.kt
index 10dfb6e..3993cda 100644 (file)
@@ -16,33 +16,11 @@ import org.hamcrest.Matchers.containsInAnyOrder
 import org.hamcrest.Matchers.equalTo
 import org.hamcrest.Matchers.nullValue
 import org.junit.Test
 import org.hamcrest.Matchers.equalTo
 import org.hamcrest.Matchers.nullValue
 import org.junit.Test
-import org.mockito.Mockito.verify
 
 /**
  * Unit test for [SoneTemplatePage].
  */
 
 /**
  * Unit test for [SoneTemplatePage].
  */
-class SoneTemplatePageTest: WebPageTest({ template, webInterface -> object : SoneTemplatePage("path.html", template, webInterface, true) {}}) {
-
-       @Test
-       fun `current sone is retrieved from web interface`() {
-               assertThat(page.getCurrentSone(toadletContext), equalTo(currentSone))
-       }
-
-       @Test
-       fun `retrieving current sone without creation is forwarded to web interface`() {
-               mock<Sone>().let {
-                       whenever(webInterface.getCurrentSone(toadletContext, false)).thenReturn(it)
-                       assertThat(page.getCurrentSone(toadletContext, false), equalTo(it))
-               }
-       }
-
-       @Test
-       fun `setting the current sone is forwarded to web interface`() {
-               mock<Sone>().let {
-                       page.setCurrentSone(toadletContext, it)
-                       verify(webInterface).setCurrentSone(toadletContext, it)
-               }
-       }
+class SoneTemplatePageTest : WebPageTest({ template, webInterface -> object : SoneTemplatePage("path.html", template, webInterface, true) {} }) {
 
        @Test
        fun `page title is empty string if no page title key was given`() {
 
        @Test
        fun `page title is empty string if no page title key was given`() {
@@ -80,20 +58,6 @@ class SoneTemplatePageTest: WebPageTest({ template, webInterface -> object : Son
                assertThat(page.shortcutIcon, equalTo("images/icon.png"))
        }
 
                assertThat(page.shortcutIcon, equalTo("images/icon.png"))
        }
 
-       @Test
-       fun `page requires login if require login was specified in the constructor`() {
-               SoneTemplatePage("path.html", template, webInterface, true).let { page ->
-                       assertThat(page.requiresLogin(), equalTo(true))
-               }
-       }
-
-       @Test
-       fun `page does not require login if require login was not specified in the constructor`() {
-               SoneTemplatePage("path.html", template, webInterface, false).let { page ->
-                       assertThat(page.requiresLogin(), equalTo(false))
-               }
-       }
-
        private fun verifyVariableIsSet(name: String, value: Any) = verifyVariableMatches(name, equalTo<Any>(value))
 
        private fun <T> verifyVariableMatches(name: String, matcher: Matcher<T>) {
        private fun verifyVariableIsSet(name: String, value: Any) = verifyVariableMatches(name, equalTo<Any>(value))
 
        private fun <T> verifyVariableMatches(name: String, matcher: Matcher<T>) {
@@ -220,17 +184,6 @@ class SoneTemplatePageTest: WebPageTest({ template, webInterface -> object : Son
        }
 
        @Test
        }
 
        @Test
-       fun `full access requirement is correctly forwarded from the preferences if false`() {
-               assertThat(page.isFullAccessOnly, equalTo(false))
-       }
-
-       @Test
-       fun `full access requirement is correctly forwarded from the preferences if true`() {
-               core.preferences.isRequireFullAccess = true
-               assertThat(page.isFullAccessOnly, equalTo(true))
-       }
-
-       @Test
        fun `page is disabled if full access is required but request does not have full access`() {
                core.preferences.isRequireFullAccess = true
                assertThat(page.isEnabled(toadletContext), equalTo(false))
        fun `page is disabled if full access is required but request does not have full access`() {
                core.preferences.isRequireFullAccess = true
                assertThat(page.isEnabled(toadletContext), equalTo(false))