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 org.hamcrest.MatcherAssert.assertThat
7 import org.hamcrest.Matchers.equalTo
11 * Unit test for [AboutPage].
13 class AboutPageTest: WebPageTest({ template, webInterface -> AboutPage(template, webInterface, PluginVersion(version), PluginYear(year), PluginHomepage(homepage)) }) {
16 private const val version = "0.1.2"
17 private const val year = 1234
18 private const val homepage = "home://page"
22 fun `page returns correct path`() {
23 assertThat(page.path, equalTo("about.html"))
27 fun `page does not require login`() {
28 assertThat(page.requiresLogin(), equalTo(false))
32 fun `page sets correct version in template context`() {
33 page.processTemplate(freenetRequest, templateContext)
34 assertThat(templateContext["version"], equalTo<Any>(version))
38 fun `page sets correct homepage in template context`() {
39 page.processTemplate(freenetRequest, templateContext)
40 assertThat(templateContext["homepage"], equalTo<Any>(homepage))
44 fun `page sets correct year in template context`() {
45 page.processTemplate(freenetRequest, templateContext)
46 assertThat(templateContext["year"], equalTo<Any>(year))