mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-01-16 20:28:15 +01:00
Format, organize imports, clean up warnings - ChanRipperTest.java
This commit is contained in:
parent
a1ea085906
commit
ada09b74ee
@ -7,19 +7,16 @@ import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import com.rarchives.ripme.ripper.rippers.ChanRipper;
|
||||
import com.rarchives.ripme.ripper.rippers.ripperhelpers.ChanSite;
|
||||
import com.rarchives.ripme.utils.Http;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.rarchives.ripme.ripper.rippers.ChanRipper;
|
||||
import com.rarchives.ripme.ripper.rippers.ripperhelpers.ChanSite;
|
||||
import com.rarchives.ripme.utils.Http;
|
||||
|
||||
public class ChanRipperTest extends RippersTest {
|
||||
@Test
|
||||
@Tag("flaky")
|
||||
@ -28,18 +25,19 @@ public class ChanRipperTest extends RippersTest {
|
||||
// URLs that should work
|
||||
passURLs.add(new URI("http://desuchan.net/v/res/7034.html").toURL());
|
||||
passURLs.add(new URI("https://boards.4chan.org/hr/thread/3015701").toURL());
|
||||
// passURLs.add(new URI("https://boards.420chan.org/420/res/232066.php").toURL()); - Dead link
|
||||
passURLs.add(new URI("http://7chan.org/gif/res/25873.html").toURL());
|
||||
passURLs.add(new URI("https://rbt.asia/g/thread/70643087/").toURL()); //must work with TLDs with len of 4
|
||||
passURLs.add(new URI("https://rbt.asia/g/thread/70643087/").toURL()); // must work with TLDs with len of 4
|
||||
for (URL url : passURLs) {
|
||||
ChanRipper ripper = new ChanRipper(url);
|
||||
// Use CompletableFuture to run setup() asynchronously
|
||||
ripper.setup();
|
||||
assert (ripper.canRip(url));
|
||||
Assertions.assertNotNull(ripper.getWorkingDir(), "Ripper for " + url + " did not have a valid working directory.");
|
||||
Assertions.assertNotNull(ripper.getWorkingDir(),
|
||||
"Ripper for " + url + " did not have a valid working directory.");
|
||||
deleteDir(ripper.getWorkingDir());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChanStringParsing() throws IOException, URISyntaxException {
|
||||
List<String> site1 = Arrays.asList("site1.com");
|
||||
@ -47,8 +45,7 @@ public class ChanRipperTest extends RippersTest {
|
||||
|
||||
List<String> site2 = Arrays.asList("site2.co.uk");
|
||||
List<String> site2Cdns = Arrays.asList("cdn.site2.co.uk");
|
||||
ChanRipper ripper = new ChanRipper(new URI("http://desuchan.net/v/res/7034.html").toURL());
|
||||
List<ChanSite> chansFromConfig = ripper
|
||||
List<ChanSite> chansFromConfig = ChanRipper
|
||||
.getChansFromConfig("site1.com[cnd1.site1.com|cdn2.site2.biz],site2.co.uk[cdn.site2.co.uk]");
|
||||
Assertions.assertEquals(chansFromConfig.get(0).getDomains(), site1);
|
||||
Assertions.assertEquals(chansFromConfig.get(0).getCdns(), site1Cdns);
|
||||
@ -56,6 +53,7 @@ public class ChanRipperTest extends RippersTest {
|
||||
Assertions.assertEquals(chansFromConfig.get(1).getDomains(), site2);
|
||||
Assertions.assertEquals(chansFromConfig.get(1).getCdns(), site2Cdns);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChanRipper() throws IOException, URISyntaxException {
|
||||
List<URL> contentURLs = new ArrayList<>();
|
||||
|
Loading…
x
Reference in New Issue
Block a user