import net.pterodactylus.sone.data.Image
import net.pterodactylus.sone.data.Profile
+import net.pterodactylus.sone.test.getInstance
import net.pterodactylus.sone.test.mock
import net.pterodactylus.sone.test.whenever
+import net.pterodactylus.sone.web.baseInjector
import net.pterodactylus.util.web.Method.POST
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.contains
@Test
fun `page returns correct title`() {
whenever(l10n.getString("Page.EditProfile.Title")).thenReturn("edit profile page title")
- assertThat(page.getPageTitle(freenetRequest), equalTo("edit profile page title"))
+ assertThat(page.getPageTitle(soneRequest), equalTo("edit profile page title"))
}
@Test
addHttpRequestPart("save-profile", "true")
addHttpRequestPart(fieldName, newValue.toString())
verifyRedirect("editProfile.html") {
+ verify(currentSone).profile = profile
verify(core).touchConfiguration()
assertThat(fieldAccessor(), equalTo(expectedValue))
}
verifyRedirect("editProfileField.html?field=${firstField.id}")
}
+ @Test
+ fun `page can be created by dependency injection`() {
+ assertThat(baseInjector.getInstance<EditProfilePage>(), notNullValue())
+ }
+
}