Restructring unit tests, removing cruft

This commit is contained in:
4pr0n 2015-02-06 12:01:39 -08:00
parent 7235cac91a
commit 9886ec0031
18 changed files with 158 additions and 325 deletions

View File

@ -0,0 +1,152 @@
package com.rarchives.ripme.tst.ripper.rippers;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import com.rarchives.ripme.ripper.rippers.DeviantartRipper;
import com.rarchives.ripme.ripper.rippers.EightmusesRipper;
import com.rarchives.ripme.ripper.rippers.FineboxRipper;
import com.rarchives.ripme.ripper.rippers.GonewildRipper;
import com.rarchives.ripme.ripper.rippers.MotherlessRipper;
import com.rarchives.ripme.ripper.rippers.RedditRipper;
import com.rarchives.ripme.ripper.rippers.SeeniveRipper;
import com.rarchives.ripme.ripper.rippers.TumblrRipper;
import com.rarchives.ripme.ripper.rippers.TwitterRipper;
import com.rarchives.ripme.ripper.rippers.VkRipper;
import com.rarchives.ripme.ripper.rippers.XhamsterRipper;
/**
* Simple test cases for various rippers.
* These tests only require a URL, no other special validation.
*/
public class BasicRippersTest extends RippersTest {
public void testMotherlessAlbums() throws IOException {
List<URL> contentURLs = new ArrayList<URL>();
// Image album
contentURLs.add(new URL("http://motherless.com/G4DAA18D"));
// Video album
// XXX: Commented out because test takes too long to download the file.
// contentURLs.add(new URL("http://motherless.com/GFD0F537"));
for (URL url : contentURLs) {
MotherlessRipper ripper = new MotherlessRipper(url);
testRipper(ripper);
}
}
public void testDeviantartAlbums() throws IOException {
List<URL> contentURLs = new ArrayList<URL>();
// Small gallery
contentURLs.add(new URL("http://airgee.deviantart.com/gallery/"));
// NSFW gallery
contentURLs.add(new URL("http://faterkcx.deviantart.com/gallery/"));
// Multi-page NSFW
contentURLs.add(new URL("http://geekysica.deviantart.com/gallery/35209412"));
for (URL url : contentURLs) {
DeviantartRipper ripper = new DeviantartRipper(url);
testRipper(ripper);
}
}
public void testEightmusesAlbums() throws IOException {
List<URL> contentURLs = new ArrayList<URL>();
contentURLs.add(new URL("http://www.8muses.com/index/category/jab-hotassneighbor7"));
for (URL url : contentURLs) {
EightmusesRipper ripper = new EightmusesRipper(url);
testRipper(ripper);
}
}
public void testVineboxAlbums() throws IOException {
Logger.getRootLogger().setLevel(Level.ALL);
List<URL> contentURLs = new ArrayList<URL>();
contentURLs.add(new URL("http://vinebox.co/u/wi57hMjc2Ka"));
contentURLs.add(new URL("http://finebox.co/u/wi57hMjc2Ka"));
for (URL url : contentURLs) {
FineboxRipper ripper = new FineboxRipper(url);
testRipper(ripper);
}
}
public void testXhamsterAlbums() throws IOException {
List<URL> contentURLs = new ArrayList<URL>();
contentURLs.add(new URL("http://xhamster.com/photos/gallery/1462237/alyssa_gadson.html"));
contentURLs.add(new URL("http://xhamster.com/photos/gallery/2941201/tableau_d_039_art_ii.html"));
for (URL url : contentURLs) {
XhamsterRipper ripper = new XhamsterRipper(url);
testRipper(ripper);
}
}
public void testGonewildAlbums() throws IOException {
List<URL> contentURLs = new ArrayList<URL>();
contentURLs.add(new URL("http://gonewild.com/user/amle69"));
for (URL url : contentURLs) {
GonewildRipper ripper = new GonewildRipper(url);
testRipper(ripper);
}
}
public void testRedditAlbums() throws IOException {
List<URL> contentURLs = new ArrayList<URL>();
contentURLs.add(new URL("http://www.reddit.com/r/nsfw_oc"));
contentURLs.add(new URL("http://www.reddit.com/r/nsfw_oc/top?t=all"));
contentURLs.add(new URL("http://www.reddit.com/r/UnrealGirls/comments/1ziuhl/in_class_veronique_popa/"));
for (URL url : contentURLs) {
RedditRipper ripper = new RedditRipper(url);
testRipper(ripper);
}
}
public void testSeeniveAlbums() throws IOException {
List<URL> contentURLs = new ArrayList<URL>();
contentURLs.add(new URL("http://seenive.com/u/946491170220040192"));
for (URL url : contentURLs) {
SeeniveRipper ripper = new SeeniveRipper(url);
testRipper(ripper);
}
}
public void testTumblrAlbums() throws IOException {
List<URL> contentURLs = new ArrayList<URL>();
contentURLs.add(new URL("http://wrouinr.tumblr.com/archive"));
contentURLs.add(new URL("http://topinstagirls.tumblr.com/tagged/berlinskaya"));
contentURLs.add(new URL("http://genekellyclarkson.tumblr.com/post/86100752527/lucyannebrooks-rachaelboden-friends-goodtimes-bed-boobs"));
for (URL url : contentURLs) {
TumblrRipper ripper = new TumblrRipper(url);
testRipper(ripper);
}
}
public void testTwitterAlbums() throws IOException {
List<URL> contentURLs = new ArrayList<URL>();
contentURLs.add(new URL("https://twitter.com/danngamber01/media"));
contentURLs.add(new URL("https://twitter.com/search?q=from%3Apurrbunny%20filter%3Aimages&src=typd"));
for (URL url : contentURLs) {
TwitterRipper ripper = new TwitterRipper(url);
testRipper(ripper);
}
}
public void testVkAlbum() throws IOException {
List<URL> contentURLs = new ArrayList<URL>();
contentURLs.add(new URL("https://vk.com/album45506334_172415053"));
contentURLs.add(new URL("https://vk.com/album45506334_0"));
contentURLs.add(new URL("https://vk.com/photos45506334"));
for (URL url : contentURLs) {
VkRipper ripper = new VkRipper(url);
testRipper(ripper);
}
}
}

View File

@ -45,9 +45,6 @@ public class ChanRipperTest extends RippersTest {
}
public void testChanRipper() throws IOException {
if (!DOWNLOAD_CONTENT) {
return;
}
List<URL> contentURLs = new ArrayList<URL>();
// URLs that should return more than 1 image
contentURLs.add(new URL("http://desuchan.net/v/res/7034.html"));

View File

@ -1,31 +0,0 @@
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.DeviantartRipper;
public class DeviantartRipperTest extends RippersTest {
public void testDeviantartAlbums() throws IOException {
if (!DOWNLOAD_CONTENT) {
return;
}
List<URL> contentURLs = new ArrayList<URL>();
// Small gallery
contentURLs.add(new URL("http://airgee.deviantart.com/gallery/"));
// NSFW gallery
contentURLs.add(new URL("http://faterkcx.deviantart.com/gallery/"));
// Multi-page NSFW
contentURLs.add(new URL("http://geekysica.deviantart.com/gallery/35209412"));
for (URL url : contentURLs) {
DeviantartRipper ripper = new DeviantartRipper(url);
testRipper(ripper);
}
}
}

View File

@ -1,26 +0,0 @@
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.EightmusesRipper;
public class EightmusesRipperTest extends RippersTest {
public void testEightmusesAlbums() throws IOException {
if (!DOWNLOAD_CONTENT) {
return;
}
List<URL> contentURLs = new ArrayList<URL>();
contentURLs.add(new URL("http://www.8muses.com/index/category/jab-hotassneighbor7"));
for (URL url : contentURLs) {
EightmusesRipper ripper = new EightmusesRipper(url);
testRipper(ripper);
}
}
}

View File

@ -1,29 +0,0 @@
package com.rarchives.ripme.tst.ripper.rippers;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import com.rarchives.ripme.ripper.rippers.FineboxRipper;
public class FineboxRipperTest extends RippersTest {
public void testVineboxAlbums() throws IOException {
if (!DOWNLOAD_CONTENT) {
return;
}
Logger.getRootLogger().setLevel(Level.ALL);
List<URL> contentURLs = new ArrayList<URL>();
contentURLs.add(new URL("http://vinebox.co/u/wi57hMjc2Ka"));
contentURLs.add(new URL("http://finebox.co/u/wi57hMjc2Ka"));
for (URL url : contentURLs) {
FineboxRipper ripper = new FineboxRipper(url);
testRipper(ripper);
}
}
}

View File

@ -1,24 +0,0 @@
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.GonewildRipper;
public class GonewildRipperTest extends RippersTest {
public void testInstagramAlbums() throws IOException {
if (!DOWNLOAD_CONTENT) {
return;
}
List<URL> contentURLs = new ArrayList<URL>();
contentURLs.add(new URL("http://gonewild.com/user/amle69"));
for (URL url : contentURLs) {
GonewildRipper ripper = new GonewildRipper(url);
testRipper(ripper);
}
}
}

View File

@ -10,9 +10,6 @@ import com.rarchives.ripme.ripper.rippers.ImagefapRipper;
public class ImagefapRipperTest extends RippersTest {
public void testImagefapAlbums() throws IOException {
if (!DOWNLOAD_CONTENT) {
return;
}
Map<URL, String> testURLs = new HashMap<URL, String>();
// Album with specific title
testURLs.put(new URL("http://www.imagefap.com/pictures/4649440/Frozen-%28Elsa-and-Anna%29?view=2"),

View File

@ -31,9 +31,6 @@ public class ImgurRipperTest extends RippersTest {
}
public void testImgurAlbums() throws IOException {
if (!DOWNLOAD_CONTENT) {
return;
}
List<URL> contentURLs = new ArrayList<URL>();
// URLs that should return more than 1 image
contentURLs.add(new URL("http://imgur.com/a/hqJIu")); // Vertical layout

View File

@ -26,9 +26,6 @@ public class InstagramRipperTest extends RippersTest {
}
public void testInstagramAlbums() throws IOException {
if (!DOWNLOAD_CONTENT) {
return;
}
List<URL> contentURLs = new ArrayList<URL>();
contentURLs.add(new URL("http://instagram.com/tayloralesia/"));
for (URL url : contentURLs) {

View File

@ -1,30 +0,0 @@
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.MotherlessRipper;
public class MotherlessRipperTest extends RippersTest {
public void testMotherlessAlbums() throws IOException {
if (!DOWNLOAD_CONTENT) {
return;
}
List<URL> contentURLs = new ArrayList<URL>();
// Image album
contentURLs.add(new URL("http://motherless.com/G4DAA18D"));
// Video album
// XXX: Commented out because test takes too long to download the file.
// contentURLs.add(new URL("http://motherless.com/GFD0F537"));
for (URL url : contentURLs) {
MotherlessRipper ripper = new MotherlessRipper(url);
testRipper(ripper);
}
}
}

View File

@ -1,26 +0,0 @@
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.RedditRipper;
public class RedditRipperTest extends RippersTest {
public void testRedditAlbums() throws IOException {
if (!DOWNLOAD_CONTENT) {
return;
}
List<URL> contentURLs = new ArrayList<URL>();
contentURLs.add(new URL("http://www.reddit.com/r/nsfw_oc"));
contentURLs.add(new URL("http://www.reddit.com/r/nsfw_oc/top?t=all"));
contentURLs.add(new URL("http://www.reddit.com/r/UnrealGirls/comments/1ziuhl/in_class_veronique_popa/"));
for (URL url : contentURLs) {
RedditRipper ripper = new RedditRipper(url);
testRipper(ripper);
}
}
}

View File

@ -15,9 +15,6 @@ import com.rarchives.ripme.utils.Utils;
*/
public class RippersTest extends TestCase {
// Flag for avoiding downloading content with every unit test
public final boolean DOWNLOAD_CONTENT = true;
public final Logger logger = Logger.getLogger(RippersTest.class);
/** Dummy test to make JUnit not complain */
@ -30,8 +27,6 @@ public class RippersTest extends TestCase {
Utils.setConfigInteger("page.timeout", 5 * 1000);
ripper.setup();
ripper.markAsTest();
System.err.println("Sleeping 1000ms");
Thread.sleep(1000);
ripper.rip();
for (File f : ripper.getWorkingDir().listFiles()) {
System.err.println(f.toString());

View File

@ -1,24 +0,0 @@
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.SeeniveRipper;
public class SeeniveRipperTest extends RippersTest {
public void testSeeniveAlbums() throws IOException {
if (!DOWNLOAD_CONTENT) {
return;
}
List<URL> contentURLs = new ArrayList<URL>();
contentURLs.add(new URL("http://seenive.com/u/946491170220040192"));
for (URL url : contentURLs) {
SeeniveRipper ripper = new SeeniveRipper(url);
testRipper(ripper);
}
}
}

View File

@ -1,26 +0,0 @@
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.TumblrRipper;
public class TumblrRipperTest extends RippersTest {
public void testTumblrAlbums() throws IOException {
if (!DOWNLOAD_CONTENT) {
return;
}
List<URL> contentURLs = new ArrayList<URL>();
contentURLs.add(new URL("http://wrouinr.tumblr.com/archive"));
contentURLs.add(new URL("http://topinstagirls.tumblr.com/tagged/berlinskaya"));
contentURLs.add(new URL("http://genekellyclarkson.tumblr.com/post/86100752527/lucyannebrooks-rachaelboden-friends-goodtimes-bed-boobs"));
for (URL url : contentURLs) {
TumblrRipper ripper = new TumblrRipper(url);
testRipper(ripper);
}
}
}

View File

@ -1,24 +0,0 @@
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.TwitterRipper;
public class TwitterRipperTest extends RippersTest {
public void testTwitterAlbums() throws IOException {
if (!DOWNLOAD_CONTENT) {
return;
}
List<URL> contentURLs = new ArrayList<URL>();
contentURLs.add(new URL("https://twitter.com/danngamber01/media"));
contentURLs.add(new URL("https://twitter.com/search?q=from%3Apurrbunny%20filter%3Aimages&src=typd"));
for (URL url : contentURLs) {
TwitterRipper ripper = new TwitterRipper(url);
testRipper(ripper);
}
}
}

View File

@ -14,6 +14,10 @@ import com.rarchives.ripme.ripper.rippers.video.YoupornRipper;
public class VideoRippersTest extends RippersTest {
/**
* Helper method for testing a video ripper
* @param ripper The video ripper
*/
private void videoTestHelper(VideoRipper ripper) {
URL oldURL = ripper.getURL();
try {
@ -21,8 +25,8 @@ public class VideoRippersTest extends RippersTest {
ripper.markAsTest();
ripper.rip();
// Video ripper testing is... weird.
// If we find the URL to download the video, and it's a test,
// then the ripper sets it as the ripper's URL.
// If the ripper finds the URL to download the video, and it's a test,
// then the ripper sets the download URL as the ripper's URL.
assertFalse("Failed to find download url for " + oldURL, oldURL.equals(ripper.getURL()));
} catch (Exception e) {
fail("Error while ripping " + ripper.getURL() + " : " + e);
@ -33,9 +37,6 @@ public class VideoRippersTest extends RippersTest {
}
public void testXvideosRipper() throws IOException {
if (!DOWNLOAD_CONTENT) {
return;
}
List<URL> contentURLs = new ArrayList<URL>();
contentURLs.add(new URL("http://www.xvideos.com/video1428195/stephanie_first_time_anal"));
contentURLs.add(new URL("http://www.xvideos.com/video7136868/vid-20140205-wa0011"));
@ -46,9 +47,6 @@ public class VideoRippersTest extends RippersTest {
}
public void testPornhubRipper() throws IOException {
if (!DOWNLOAD_CONTENT) {
return;
}
List<URL> contentURLs = new ArrayList<URL>();
contentURLs.add(new URL("http://www.pornhub.com/view_video.php?viewkey=993166542"));
for (URL url : contentURLs) {
@ -58,9 +56,6 @@ public class VideoRippersTest extends RippersTest {
}
public void testVineRipper() throws IOException {
if (!DOWNLOAD_CONTENT) {
return;
}
List<URL> contentURLs = new ArrayList<URL>();
contentURLs.add(new URL("https://vine.co/v/hiqQrP0eUZx"));
for (URL url : contentURLs) {
@ -70,9 +65,6 @@ public class VideoRippersTest extends RippersTest {
}
public void testYoupornRipper() throws IOException {
if (!DOWNLOAD_CONTENT) {
return;
}
List<URL> contentURLs = new ArrayList<URL>();
contentURLs.add(new URL("http://www.youporn.com/watch/7669155/mrs-li-amateur-69-orgasm/?from=categ"));
for (URL url : contentURLs) {
@ -82,9 +74,6 @@ public class VideoRippersTest extends RippersTest {
}
public void testBeegRipper() throws IOException {
if (!DOWNLOAD_CONTENT) {
return;
}
List<URL> contentURLs = new ArrayList<URL>();
contentURLs.add(new URL("http://beeg.com/4554321"));
for (URL url : contentURLs) {

View File

@ -1,26 +0,0 @@
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.VkRipper;
public class VkRipperTest extends RippersTest {
public void testVkAlbum() throws IOException {
if (!DOWNLOAD_CONTENT) {
return;
}
List<URL> contentURLs = new ArrayList<URL>();
contentURLs.add(new URL("https://vk.com/album45506334_172415053"));
contentURLs.add(new URL("https://vk.com/album45506334_0"));
contentURLs.add(new URL("https://vk.com/photos45506334"));
for (URL url : contentURLs) {
VkRipper ripper = new VkRipper(url);
testRipper(ripper);
}
}
}

View File

@ -1,25 +0,0 @@
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.XhamsterRipper;
public class XhamsterRipperTest extends RippersTest {
public void testXhamsterAlbums() throws IOException {
if (!DOWNLOAD_CONTENT) {
return;
}
List<URL> contentURLs = new ArrayList<URL>();
contentURLs.add(new URL("http://xhamster.com/photos/gallery/1462237/alyssa_gadson.html"));
contentURLs.add(new URL("http://xhamster.com/photos/gallery/2941201/tableau_d_039_art_ii.html"));
for (URL url : contentURLs) {
XhamsterRipper ripper = new XhamsterRipper(url);
testRipper(ripper);
}
}
}