✨ Start fetch skipping a version when requested
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 5 Nov 2019 18:47:04 +0000 (19:47 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 5 Nov 2019 18:47:04 +0000 (19:47 +0100)
src/main/kotlin/net/pterodactylus/sone/web/pages/RescuePage.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/RescuePageTest.kt

index b93d09a..1cbc725 100644 (file)
@@ -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")
                }
index 85e1f6b..e653bbe 100644 (file)
@@ -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<RescuePage>(), notNullValue())
        }