/**
* Unit test for [DismissNotificationPage].
*/
-class DismissNotificationPageTest: WebPageTest() {
+class DismissNotificationPageTest: WebPageTest2(::DismissNotificationPage) {
- private val page = DismissNotificationPage(template, webInterface)
private val notification = mock<Notification>()
- override fun getPage() = page
-
@Test
fun `page returns correct path`() {
assertThat(page.path, equalTo("dismissNotification.html"))
import net.pterodactylus.sone.web.WebInterface
import net.pterodactylus.sone.web.page.FreenetRequest
import net.pterodactylus.sone.web.page.FreenetTemplatePage.RedirectException
+import net.pterodactylus.util.notify.Notification
import net.pterodactylus.util.template.Template
import net.pterodactylus.util.template.TemplateContext
import net.pterodactylus.util.web.Method
private val perPostReplies = mutableMapOf<String, PostReply>()
private val allAlbums = mutableMapOf<String, Album>()
private val allImages = mutableMapOf<String, Image>()
+ private val notifications = mutableMapOf<String, Notification>()
private val translations = mutableMapOf<String, String>()
init {
whenever(webInterface.getCurrentSoneCreatingSession(eq(toadletContext))).thenReturn(currentSone)
whenever(webInterface.getCurrentSone(eq(toadletContext), anyBoolean())).thenReturn(currentSone)
whenever(webInterface.getCurrentSoneWithoutCreatingSession(eq(toadletContext))).thenReturn(currentSone)
- whenever(webInterface.getNotifications(currentSone)).thenReturn(emptyList())
+ whenever(webInterface.getNotifications(currentSone)).then { notifications.values }
+ whenever(webInterface.getNotification(anyString())).then { notifications[it[0]].asOptional() }
}
private fun setupHttpRequest() {
translations[key] = value
}
+ fun addNotification(id: String, notification: Notification) {
+ notifications[id] = notification
+ }
+
fun addTemporaryImage(id: String, temporaryImage: TemporaryImage) {
whenever(core.getTemporaryImage(id)).thenReturn(temporaryImage)
}