import net.pterodactylus.sone.test.mock
import net.pterodactylus.sone.test.whenever
import net.pterodactylus.sone.web.baseInjector
+import net.pterodactylus.sone.web.page.*
import net.pterodactylus.util.web.Method.POST
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.equalTo
fun `album is deleted and page redirects to album if parent album is not root album`() {
setMethod(POST)
whenever(parentAlbum.isRoot).thenReturn(false)
- whenever(sone.rootAlbum).thenReturn(mock<Album>())
+ whenever(sone.rootAlbum).thenReturn(mock())
addAlbum("album-id", album)
addHttpRequestPart("album", "album-id")
verifyRedirect("imageBrowser.html?album=parent-id") {
assertThat(baseInjector.getInstance<DeleteAlbumPage>(), notNullValue())
}
+ @Test
+ fun `page is annotated with correct template path`() {
+ assertThat(page.templatePath, equalTo("/templates/deleteAlbum.html"))
+ }
+
}