1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-08-12 08:54:11 +02:00

new URI instead of new URL in tests, 8.

This commit is contained in:
soloturn
2023-06-13 07:00:21 +02:00
parent 78e6e7d51e
commit 3c8b677926
8 changed files with 53 additions and 46 deletions

View File

@@ -1,7 +1,8 @@
package com.rarchives.ripme.tst.ripper.rippers;
import java.io.IOException;
import java.net.URL;
import java.net.URI;
import java.net.URISyntaxException;
import com.rarchives.ripme.ripper.rippers.EightmusesRipper;
import org.junit.jupiter.api.Assertions;
@@ -11,25 +12,25 @@ import org.junit.jupiter.api.Test;
public class EightmusesRipperTest extends RippersTest {
@Test
@Tag("flaky")
public void testEightmusesAlbum() throws IOException {
public void testEightmusesAlbum() throws IOException, URISyntaxException {
// A simple image album
EightmusesRipper ripper = new EightmusesRipper(new URL("https://www.8muses.com/comix/album/Affect3D-Comics/TheDude3DX/Lust-Unleashed-The-Urge-To-Explore"));
EightmusesRipper ripper = new EightmusesRipper(new URI("https://www.8muses.com/comix/album/Affect3D-Comics/TheDude3DX/Lust-Unleashed-The-Urge-To-Explore").toURL());
testRipper(ripper);
// Test the new url format
ripper = new EightmusesRipper(new URL("https://www.8muses.com/comics/album/Affect3D-Comics/TheDude3DX/Lust-Unleashed-The-Urge-To-Explore"));
ripper = new EightmusesRipper(new URI("https://www.8muses.com/comics/album/Affect3D-Comics/TheDude3DX/Lust-Unleashed-The-Urge-To-Explore").toURL());
testRipper(ripper);
// Test pages with subalbums
ripper = new EightmusesRipper(new URL("https://www.8muses.com/comix/album/Blacknwhitecomics_com-Comix/BlacknWhiteComics/The-Mayor"));
ripper = new EightmusesRipper(new URI("https://www.8muses.com/comix/album/Blacknwhitecomics_com-Comix/BlacknWhiteComics/The-Mayor").toURL());
testRipper(ripper);
}
@Test
public void testGID() throws IOException {
EightmusesRipper ripper = new EightmusesRipper(new URL("https://www.8muses.com/comix/album/Affect3D-Comics/TheDude3DX/Lust-Unleashed-The-Urge-To-Explore"));
Assertions.assertEquals("Affect3D-Comics", ripper.getGID(new URL("https://www.8muses.com/comics/album/Affect3D-Comics/TheDude3DX/Lust-Unleashed-The-Urge-To-Explore")));
public void testGID() throws IOException, URISyntaxException {
EightmusesRipper ripper = new EightmusesRipper(new URI("https://www.8muses.com/comix/album/Affect3D-Comics/TheDude3DX/Lust-Unleashed-The-Urge-To-Explore").toURL());
Assertions.assertEquals("Affect3D-Comics", ripper.getGID(new URI("https://www.8muses.com/comics/album/Affect3D-Comics/TheDude3DX/Lust-Unleashed-The-Urge-To-Explore").toURL()));
}
@Test
public void testGetSubdir() throws IOException {
EightmusesRipper ripper = new EightmusesRipper(new URL("https://www.8muses.com/comix/album/Affect3D-Comics/TheDude3DX/Lust-Unleashed-The-Urge-To-Explore"));
public void testGetSubdir() throws IOException, URISyntaxException {
EightmusesRipper ripper = new EightmusesRipper(new URI("https://www.8muses.com/comix/album/Affect3D-Comics/TheDude3DX/Lust-Unleashed-The-Urge-To-Explore").toURL());
Assertions.assertEquals("After-Party-Issue-1", ripper.getSubdir("After Party - Issue 1"));
}
}

View File

@@ -3,7 +3,6 @@ package com.rarchives.ripme.tst.ripper.rippers;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import com.rarchives.ripme.ripper.rippers.EroShareRipper;
import com.rarchives.ripme.ripper.rippers.RedditRipper;

View File

@@ -1,7 +1,8 @@
package com.rarchives.ripme.tst.ripper.rippers;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import com.rarchives.ripme.ripper.rippers.EromeRipper;
@@ -10,39 +11,39 @@ import org.junit.jupiter.api.Test;
public class EromeRipperTest extends RippersTest {
@Test
public void testGetGIDProfilePage() throws IOException {
URL url = new URL("https://www.erome.com/Jay-Jenna");
public void testGetGIDProfilePage() throws IOException, URISyntaxException {
URL url = new URI("https://www.erome.com/Jay-Jenna").toURL();
EromeRipper ripper = new EromeRipper(url);
Assertions.assertEquals("Jay-Jenna", ripper.getGID(url));
}
@Test
public void testGetGIDAlbum() throws IOException {
URL url = new URL("https://www.erome.com/a/KbDAM1XT");
public void testGetGIDAlbum() throws IOException, URISyntaxException {
URL url = new URI("https://www.erome.com/a/KbDAM1XT").toURL();
EromeRipper ripper = new EromeRipper(url);
Assertions.assertEquals("KbDAM1XT", ripper.getGID(url));
}
@Test
public void testGetAlbumsToQueue() throws IOException {
URL url = new URL("https://www.erome.com/Jay-Jenna");
public void testGetAlbumsToQueue() throws IOException, URISyntaxException {
URL url = new URI("https://www.erome.com/Jay-Jenna").toURL();
EromeRipper ripper = new EromeRipper(url);
assert (2 >= ripper.getAlbumsToQueue(ripper.getFirstPage()).size());
}
@Test
public void testPageContainsAlbums() throws IOException {
URL url = new URL("https://www.erome.com/Jay-Jenna");
public void testPageContainsAlbums() throws IOException, URISyntaxException {
URL url = new URI("https://www.erome.com/Jay-Jenna").toURL();
EromeRipper ripper = new EromeRipper(url);
assert (ripper.pageContainsAlbums(url));
assert (!ripper.pageContainsAlbums(new URL("https://www.erome.com/a/KbDAM1XT")));
assert (!ripper.pageContainsAlbums(new URI("https://www.erome.com/a/KbDAM1XT").toURL()));
}
public void testRip() throws IOException {
URL url = new URL("https://www.erome.com/a/vlefBdsg");
public void testRip() throws IOException, URISyntaxException {
URL url = new URI("https://www.erome.com/a/vlefBdsg").toURL();
EromeRipper ripper = new EromeRipper(url);
testRipper(ripper);
}
@Test
public void testGetURLsFromPage() throws IOException {
URL url = new URL("https://www.erome.com/a/Tak8F2h6");
public void testGetURLsFromPage() throws IOException, URISyntaxException {
URL url = new URI("https://www.erome.com/a/Tak8F2h6").toURL();
EromeRipper ripper = new EromeRipper(url);
assert (35 == ripper.getURLsFromPage(ripper.getFirstPage()).size());
}

View File

@@ -1,6 +1,8 @@
package com.rarchives.ripme.tst.ripper.rippers;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import com.rarchives.ripme.ripper.rippers.ImagevenueRipper;
@@ -12,15 +14,15 @@ import org.junit.jupiter.api.Test;
public class ImagevenueRipperTest extends RippersTest {
@Test
@Disabled("See https://github.com/RipMeApp/ripme/issues/1202")
public void testImagevenueRip() throws IOException {
public void testImagevenueRip() throws IOException, URISyntaxException {
ImagevenueRipper ripper = new ImagevenueRipper(
new URL("http://img120.imagevenue.com/galshow.php?gal=gallery_1373818527696_191lo"));
new URI("http://img120.imagevenue.com/galshow.php?gal=gallery_1373818527696_191lo").toURL());
testRipper(ripper);
}
@Test
public void testGetGID() throws IOException {
URL url = new URL("http://img120.imagevenue.com/galshow.php?gal=gallery_1373818527696_191lo");
public void testGetGID() throws IOException, URISyntaxException {
URL url = new URI("http://img120.imagevenue.com/galshow.php?gal=gallery_1373818527696_191lo").toURL();
ImagevenueRipper ripper = new ImagevenueRipper(url);
Assertions.assertEquals("gallery_1373818527696_191lo", ripper.getGID(url));
}

View File

@@ -1,7 +1,8 @@
package com.rarchives.ripme.tst.ripper.rippers;
import java.io.IOException;
import java.net.URL;
import java.net.URI;
import java.net.URISyntaxException;
import com.rarchives.ripme.ripper.rippers.MastodonRipper;
import org.junit.jupiter.api.Tag;
@@ -10,8 +11,8 @@ import org.junit.jupiter.api.Test;
public class MastodonRipperTest extends RippersTest {
@Test
@Tag("flaky")
public void testRip() throws IOException {
MastodonRipper ripper = new MastodonRipper(new URL("https://mastodon.social/@pythonhub/media"));
public void testRip() throws IOException, URISyntaxException {
MastodonRipper ripper = new MastodonRipper(new URI("https://mastodon.social/@pythonhub/media").toURL());
testRipper(ripper);
}
}

View File

@@ -1,7 +1,8 @@
package com.rarchives.ripme.tst.ripper.rippers;
import java.io.IOException;
import java.net.URL;
import java.net.URI;
import java.net.URISyntaxException;
import com.rarchives.ripme.ripper.rippers.MastodonXyzRipper;
import org.junit.jupiter.api.Tag;
@@ -10,8 +11,8 @@ import org.junit.jupiter.api.Test;
public class MastodonXyzRipperTest extends RippersTest {
@Test
@Tag("flaky")
public void testRip() throws IOException {
MastodonXyzRipper ripper = new MastodonXyzRipper(new URL("https://mastodon.xyz/@artwo/media"));
public void testRip() throws IOException, URISyntaxException {
MastodonXyzRipper ripper = new MastodonXyzRipper(new URI("https://mastodon.xyz/@artwo/media").toURL());
testRipper(ripper);
}
}

View File

@@ -1,26 +1,27 @@
package com.rarchives.ripme.tst.ripper.rippers;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import com.rarchives.ripme.ripper.rippers.MeituriRipper;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
public class MeituriRipperTest extends RippersTest {
@Test
@Tag("flaky")
public void testMeituriRip() throws IOException {
MeituriRipper ripper = new MeituriRipper(new URL("https://www.tujigu.com/a/14449/"));
public void testMeituriRip() throws IOException, URISyntaxException {
MeituriRipper ripper = new MeituriRipper(new URI("https://www.tujigu.com/a/14449/").toURL());
testRipper(ripper);
}
@Test
public void testGetGID() throws IOException {
URL url = new URL("https://www.tujigu.com/a/14449/");
public void testGetGID() throws IOException, URISyntaxException {
URL url = new URI("https://www.tujigu.com/a/14449/").toURL();
MeituriRipper ripper = new MeituriRipper(url);
Assertions.assertEquals("14449", ripper.getGID(url));
}

View File

@@ -1,7 +1,8 @@
package com.rarchives.ripme.tst.ripper.rippers;
import java.io.IOException;
import java.net.URL;
import java.net.URI;
import java.net.URISyntaxException;
import com.rarchives.ripme.ripper.rippers.ModelmayhemRipper;
@@ -13,16 +14,16 @@ public class ModelmayhemRipperTest extends RippersTest {
@Test
@Disabled("Broken ripper")
public void testModelmayhemRip() throws IOException {
public void testModelmayhemRip() throws IOException, URISyntaxException {
ModelmayhemRipper ripper = new ModelmayhemRipper(
new URL("https://www.modelmayhem.com/portfolio/520206/viewall"));
new URI("https://www.modelmayhem.com/portfolio/520206/viewall").toURL());
testRipper(ripper);
}
@Test
public void testGetGID() throws IOException {
public void testGetGID() throws IOException, URISyntaxException {
ModelmayhemRipper ripper = new ModelmayhemRipper(
new URL("https://www.modelmayhem.com/portfolio/520206/viewall"));
Assertions.assertEquals("520206", ripper.getGID(new URL("https://www.modelmayhem.com/portfolio/520206/viewall")));
new URI("https://www.modelmayhem.com/portfolio/520206/viewall").toURL());
Assertions.assertEquals("520206", ripper.getGID(new URI("https://www.modelmayhem.com/portfolio/520206/viewall").toURL()));
}
}