From: David ‘Bombe’ Roden Date: Tue, 5 Nov 2019 18:47:04 +0000 (+0100) Subject: ✨ Start fetch skipping a version when requested X-Git-Tag: v81^2~53 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=6de1ddee725ce440b1a91880a45edae195c2d593;p=Sone.git ✨ Start fetch skipping a version when requested --- diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/RescuePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/RescuePage.kt index b93d09a..1cbc725 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/RescuePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/RescuePage.kt @@ -23,6 +23,8 @@ class RescuePage @Inject constructor(webInterface: WebInterface, loaders: Loader if (soneRequest.isPOST) { if (soneRequest.parameters["fetch", 8] == "true") { soneRescuer.startNextFetch() + } else if (soneRequest.parameters["fetchSkip"] == "true") { + soneRescuer.startNextFetchWithSkip() } redirectTo("rescue.html") } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/RescuePageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/RescuePageTest.kt index 85e1f6b..e653bbe 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/RescuePageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/RescuePageTest.kt @@ -63,6 +63,15 @@ class RescuePageTest : WebPageTest(::RescuePage) { } @Test + fun `post request with skipping fetch starts next skipping fetch`() { + setMethod(POST) + addHttpRequestPart("fetchSkip", "true") + verifyRedirect("rescue.html") { + verify(soneRescuer).startNextFetchWithSkip() + } + } + + @Test fun `page can be created by dependency injection`() { assertThat(baseInjector.getInstance(), notNullValue()) }