1 package net.pterodactylus.sone.web.pages
3 import net.pterodactylus.sone.main.SonePlugin.PluginHomepage
4 import net.pterodactylus.sone.main.SonePlugin.PluginVersion
5 import net.pterodactylus.sone.main.SonePlugin.PluginYear
6 import net.pterodactylus.sone.web.pages.WebPageTest
7 import net.pterodactylus.sone.web.pages.AboutPage
8 import org.hamcrest.MatcherAssert.assertThat
9 import org.hamcrest.Matchers.equalTo
13 * Unit test for [AboutPage].
15 class AboutPageTest: WebPageTest() {
17 private val version = "0.1.2"
18 private val year = 1234
19 private val homepage = "home://page"
20 private val page = AboutPage(template, webInterface, PluginVersion(version), PluginYear(year), PluginHomepage(homepage))
23 fun `page returns correct path`() {
24 assertThat(page.path, equalTo("about.html"))
28 fun `page does not require login`() {
29 assertThat(page.requiresLogin(), equalTo(false))
33 fun `page sets correct version in template context`() {
34 page.processTemplate(freenetRequest, templateContext)
35 assertThat(templateContext["version"], equalTo<Any>(version))
39 fun `page sets correct homepage in template context`() {
40 page.processTemplate(freenetRequest, templateContext)
41 assertThat(templateContext["homepage"], equalTo<Any>(homepage))
45 fun `page sets correct year in template context`() {
46 page.processTemplate(freenetRequest, templateContext)
47 assertThat(templateContext["year"], equalTo<Any>(year))