mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-22 21:43:06 +02:00
Add tests to BooruRipper
This commit is contained in:
@@ -2,6 +2,8 @@ package com.rarchives.ripme.tst.ripper.rippers;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.rarchives.ripme.ripper.rippers.BooruRipper;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
@@ -10,14 +12,49 @@ import org.junit.jupiter.api.Test;
|
||||
public class BooruRipperTest extends RippersTest {
|
||||
@Test
|
||||
public void testRip() throws IOException {
|
||||
BooruRipper ripper = new BooruRipper(new URL("http://xbooru.com/index.php?page=post&s=list&tags=furry"));
|
||||
testRipper(ripper);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetGID() throws IOException {
|
||||
URL url = new URL("http://xbooru.com/index.php?page=post&s=list&tags=furry");
|
||||
BooruRipper ripper = new BooruRipper(url);
|
||||
Assertions.assertEquals("furry", ripper.getGID(url));
|
||||
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("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());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user