X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FOptionsPageTest.kt;h=d2929d9175b7936b3031018eef8f143d9060e30a;hp=853b4fb1b0df53d1157e0b5dab320112f697e028;hb=faf66247a34f64946990a985d2ea3003465969cb;hpb=a76956e389fcfe6282ad4ca7156bbf76327bb0c0 diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/OptionsPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/OptionsPageTest.kt index 853b4fb..d2929d9 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/OptionsPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/OptionsPageTest.kt @@ -15,7 +15,7 @@ import org.junit.* /** * Unit test for [OptionsPage]. */ -class OptionsPageTest: WebPageTest(::OptionsPage) { +class OptionsPageTest : WebPageTest(::OptionsPage) { @Before fun setupPreferences() { @@ -25,11 +25,8 @@ class OptionsPageTest: WebPageTest(::OptionsPage) { core.preferences.newImagesPerPage = 4 core.preferences.newFcpInterfaceActive = true core.preferences.newRequireFullAccess = true - core.preferences.newNegativeTrust = 7 - core.preferences.newPositiveTrust = 8 core.preferences.newPostCutOffLength = 51 core.preferences.newPostsPerPage = 10 - core.preferences.newTrustComment = "11" } @Before @@ -77,11 +74,8 @@ class OptionsPageTest: WebPageTest(::OptionsPage) { assertThat(templateContext["images-per-page"], equalTo(4)) assertThat(templateContext["fcp-interface-active"], equalTo(true)) assertThat(templateContext["require-full-access"], equalTo(true)) - assertThat(templateContext["negative-trust"], equalTo(7)) - assertThat(templateContext["positive-trust"], equalTo(8)) assertThat(templateContext["post-cut-off-length"], equalTo(51)) assertThat(templateContext["posts-per-page"], equalTo(10)) - assertThat(templateContext["trust-comment"], equalTo("11")) } } @@ -284,56 +278,6 @@ class OptionsPageTest: WebPageTest(::OptionsPage) { } @Test - fun `negative trust can not be set to -101`() { - verifyThatWrongValueForPreferenceIsDetected("negative-trust", "-101") - } - - @Test - fun `negative trust can be set to -100`() { - verifyThatPreferencesCanBeSet("negative-trust", "-100", -100) { core.preferences.negativeTrust } - } - - @Test - fun `negative trust can be set to 100`() { - verifyThatPreferencesCanBeSet("negative-trust", "100", 100) { core.preferences.negativeTrust } - } - - @Test - fun `negative trust can not be set to 101`() { - verifyThatWrongValueForPreferenceIsDetected("negative-trust", "101") - } - - @Test - fun `negative trust is set to default on invalid value`() { - verifyThatPreferencesCanBeSet("negative-trust", "invalid", -25) { core.preferences.negativeTrust } - } - - @Test - fun `positive trust can not be set to -1`() { - verifyThatWrongValueForPreferenceIsDetected("positive-trust", "-1") - } - - @Test - fun `positive trust can be set to 0`() { - verifyThatPreferencesCanBeSet("positive-trust", "0", 0) { core.preferences.positiveTrust } - } - - @Test - fun `positive trust can be set to 100`() { - verifyThatPreferencesCanBeSet("positive-trust", "100", 100) { core.preferences.positiveTrust } - } - - @Test - fun `positive trust can not be set to 101`() { - verifyThatWrongValueForPreferenceIsDetected("positive-trust", "101") - } - - @Test - fun `positive trust is set to default on invalid value`() { - verifyThatPreferencesCanBeSet("positive-trust", "invalid", 75) { core.preferences.positiveTrust } - } - - @Test fun `post cut off length can not be set to -49`() { verifyThatWrongValueForPreferenceIsDetected("post-cut-off-length", "-49") } @@ -364,28 +308,18 @@ class OptionsPageTest: WebPageTest(::OptionsPage) { } @Test - fun `trust comment can be set`() { - verifyThatPreferencesCanBeSet("trust-comment", "trust", "trust") { core.preferences.trustComment } - } - - @Test - fun `trust comment is set to default when set to empty value`() { - verifyThatPreferencesCanBeSet("trust-comment", "", "Set from Sone Web Interface") { core.preferences.trustComment } - } - - @Test fun `page can be created by dependency injection`() { - assertThat(baseInjector.getInstance(), notNullValue()) + assertThat(baseInjector.getInstance(), notNullValue()) } @Test fun `page is annotated with correct menuname`() { - assertThat(page.menuName, equalTo("Options")) + assertThat(page.menuName, equalTo("Options")) } @Test fun `page is annotated with correct template path`() { - assertThat(page.templatePath, equalTo("/templates/options.html")) + assertThat(page.templatePath, equalTo("/templates/options.html")) } }