package net.pterodactylus.sone.web.ajax import net.pterodactylus.sone.data.* import net.pterodactylus.sone.test.* import net.pterodactylus.sone.web.* import org.hamcrest.MatcherAssert.* import org.hamcrest.Matchers.* import org.junit.* import org.mockito.Mockito.* /** * Unit test for [LockSoneAjaxPage]. */ class LockSoneAjaxPageTest : JsonPageTest("lockSone.ajax", requiresLogin = false, pageSupplier = ::LockSoneAjaxPage) { @Test fun `request without valid sone results in invalid-sone-id`() { assertThatJsonFailed("invalid-sone-id") } @Test fun `request with valid sone id results in locked sone`() { val sone = mock() addLocalSone(sone, "sone-id") addRequestParameter("sone", "sone-id") assertThatJsonIsSuccessful() verify(core).lockSone(sone) } @Test fun `page can be created by dependency injection`() { assertThat(baseInjector.getInstance(), notNullValue()) } }