1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-08-23 22:14:06 +02:00

Add tests to BooruRipper

This commit is contained in:
Irvin Lara
2021-12-19 19:11:08 -07:00
parent 9496962cd0
commit edc7fa4cfa

View File

@@ -2,6 +2,8 @@ package com.rarchives.ripme.tst.ripper.rippers;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import com.rarchives.ripme.ripper.rippers.BooruRipper; import com.rarchives.ripme.ripper.rippers.BooruRipper;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
@@ -10,14 +12,49 @@ import org.junit.jupiter.api.Test;
public class BooruRipperTest extends RippersTest { public class BooruRipperTest extends RippersTest {
@Test @Test
public void testRip() throws IOException { public void testRip() throws IOException {
BooruRipper ripper = new BooruRipper(new URL("http://xbooru.com/index.php?page=post&s=list&tags=furry")); List<URL> passURLs = new ArrayList<>();
passURLs.add(new URL("https://xbooru.com/index.php?page=post&s=list&tags=furry"));
passURLs.add(new URL("https://gelbooru.com/index.php?page=post&s=list&tags=animal_ears"));
for (URL url : passURLs) {
BooruRipper ripper = new BooruRipper(url);
testRipper(ripper); testRipper(ripper);
} }
}
@Test @Test
public void testGetGID() throws IOException { public void testGetGID() throws IOException {
URL url = new URL("http://xbooru.com/index.php?page=post&s=list&tags=furry"); URL xbooruUrl = new URL("https://xbooru.com/index.php?page=post&s=list&tags=furry");
BooruRipper ripper = new BooruRipper(url); URL gelbooruUrl = new URL("https://gelbooru.com/index.php?page=post&s=list&tags=animal_ears");
Assertions.assertEquals("furry", ripper.getGID(url));
BooruRipper xbooruRipper = new BooruRipper(xbooruUrl);
BooruRipper gelbooruRipper = new BooruRipper(gelbooruUrl);
Assertions.assertEquals("furry", xbooruRipper.getGID(xbooruUrl));
Assertions.assertEquals("animal_ears", gelbooruRipper.getGID(gelbooruUrl));
}
@Test
public void testGetDomain() throws IOException {
URL xbooruUrl = new URL("https://xbooru.com/index.php?page=post&s=list&tags=furry");
URL gelbooruUrl = new URL("https://gelbooru.com/index.php?page=post&s=list&tags=animal_ears");
BooruRipper xbooruRipper = new BooruRipper(xbooruUrl);
BooruRipper gelbooruRipper = new BooruRipper(gelbooruUrl);
Assertions.assertEquals("xbooru.com", xbooruRipper.getDomain());
Assertions.assertEquals("gelbooru.com", gelbooruRipper.getDomain());
}
@Test
public void testGetHost() throws IOException {
URL xbooruUrl = new URL("https://xbooru.com/index.php?page=post&s=list&tags=furry");
URL gelbooruUrl = new URL("https://gelbooru.com/index.php?page=post&s=list&tags=animal_ears");
BooruRipper xbooruRipper = new BooruRipper(xbooruUrl);
BooruRipper gelbooruRipper = new BooruRipper(gelbooruUrl);
Assertions.assertEquals("xbooru", xbooruRipper.getHost());
Assertions.assertEquals("gelbooru", gelbooruRipper.getHost());
} }
} }