|
12 | 12 | import com.rarchives.ripme.ripper.rippers.EromeRipper; |
13 | 13 |
|
14 | 14 | public class EromeRipperTest extends RippersTest { |
| 15 | + // Note: this album has been deleted, but the GID can still be extracted |
| 16 | + public static final String DELETED_ALBUM_GID_TEST = "https://www.erome.com/a/KbDAM1XT"; |
| 17 | + |
| 18 | + // User page with 2 video album posts |
| 19 | + public static final String USER_PAGE_JAY_JENNA = "https://www.erome.com/Jay-Jenna"; |
| 20 | + |
| 21 | + // 35 photos, no videos |
| 22 | + public static final String SHOKO_TAKAHASHI_PHOTO_ALBUM = "https://www.erome.com/a/Tak8F2h6"; |
| 23 | + |
| 24 | + // no photos, 1 video |
| 25 | + public static final String VIDEO_ALBUM_SINGLE_VIDEO_RIDING = "https://www.erome.com/a/P0x5Ambn"; |
| 26 | + |
| 27 | + // no photos, 2 videos |
| 28 | + public static final String VIDEO_ALBUM_MULTI_VIDEO_FUN_AT_SEA = "https://www.erome.com/a/jEUFu6pi"; |
| 29 | + |
| 30 | + // 2 photos, 1 video, video is the last item |
| 31 | + public static final String VIDEO_PHOTO_ALBUM_VIDEO_LAST_THICK_ASIAN = "https://www.erome.com/a/4EqqN5LR"; |
| 32 | + |
| 33 | + // 1 video, 1 photo, video is the first item |
| 34 | + public static final String VIDEO_PHOTO_ALBUM_VIDEO_FIRST_ARGENTINA = "https://www.erome.com/a/Stjsocxo"; |
| 35 | + |
15 | 36 | @Test |
16 | | - public void testGetGIDProfilePage() throws IOException, URISyntaxException { |
17 | | - URL url = new URI("https://www.erome.com/Jay-Jenna").toURL(); |
| 37 | + public void testGetGIDAlbum() throws IOException, URISyntaxException { |
| 38 | + // Note: this album has been deleted, but the GID can still be extracted |
| 39 | + URL url = new URI(DELETED_ALBUM_GID_TEST).toURL(); |
18 | 40 | EromeRipper ripper = new EromeRipper(url); |
19 | | - Assertions.assertEquals("Jay-Jenna", ripper.getGID(url)); |
| 41 | + Assertions.assertEquals("KbDAM1XT", ripper.getGID(url)); |
20 | 42 | } |
21 | 43 |
|
22 | 44 | @Test |
23 | | - public void testGetGIDAlbum() throws IOException, URISyntaxException { |
24 | | - URL url = new URI("https://www.erome.com/a/KbDAM1XT").toURL(); |
| 45 | + public void testGetGIDProfilePage() throws IOException, URISyntaxException { |
| 46 | + URL url = new URI(USER_PAGE_JAY_JENNA).toURL(); |
25 | 47 | EromeRipper ripper = new EromeRipper(url); |
26 | | - Assertions.assertEquals("KbDAM1XT", ripper.getGID(url)); |
| 48 | + Assertions.assertEquals("Jay-Jenna", ripper.getGID(url)); |
27 | 49 | } |
28 | 50 |
|
29 | 51 | @Test |
30 | 52 | public void testGetAlbumsToQueue() throws IOException, URISyntaxException { |
31 | | - URL url = new URI("https://www.erome.com/Jay-Jenna").toURL(); |
| 53 | + // User page with 2 video album posts |
| 54 | + URL url = new URI(USER_PAGE_JAY_JENNA).toURL(); |
32 | 55 | EromeRipper ripper = new EromeRipper(url); |
33 | 56 | assert (2 >= ripper.getAlbumsToQueue(ripper.getFirstPage()).size()); |
34 | 57 | } |
35 | 58 |
|
36 | 59 | @Test |
37 | 60 | public void testPageContainsAlbums() throws IOException, URISyntaxException { |
38 | | - URL url = new URI("https://www.erome.com/Jay-Jenna").toURL(); |
| 61 | + URL url = new URI(USER_PAGE_JAY_JENNA).toURL(); |
39 | 62 | EromeRipper ripper = new EromeRipper(url); |
40 | 63 | assert (ripper.pageContainsAlbums(url)); |
41 | | - assert (!ripper.pageContainsAlbums(new URI("https://www.erome.com/a/KbDAM1XT").toURL())); |
42 | 64 | } |
43 | 65 |
|
44 | 66 | @Test |
45 | | - public void testRip() throws IOException, URISyntaxException { |
46 | | - URL url = new URI("https://www.erome.com/a/Tak8F2h6").toURL(); |
| 67 | + public void testEmptyPageDoesNotContainAlbums() throws IOException, URISyntaxException { |
| 68 | + URL url = new URI(DELETED_ALBUM_GID_TEST).toURL(); |
| 69 | + EromeRipper ripper = new EromeRipper(url); |
| 70 | + assert (!ripper.pageContainsAlbums(url)); |
| 71 | + } |
| 72 | + |
| 73 | + @Test |
| 74 | + public void testGetURLsFromPhotoAlbumPage() throws IOException, URISyntaxException { |
| 75 | + // 35 photos, no videos |
| 76 | + URL url = new URI(SHOKO_TAKAHASHI_PHOTO_ALBUM).toURL(); |
| 77 | + EromeRipper ripper = new EromeRipper(url); |
| 78 | + assert (35 == ripper.getURLsFromPage(ripper.getFirstPage()).size()); |
| 79 | + } |
| 80 | + |
| 81 | + @Test |
| 82 | + public void testPhotoAlbumRip() throws IOException, URISyntaxException { |
| 83 | + // 35 photos, no videos |
| 84 | + URL url = new URI(SHOKO_TAKAHASHI_PHOTO_ALBUM).toURL(); |
47 | 85 | EromeRipper ripper = new EromeRipper(url); |
48 | 86 | testRipper(ripper); |
49 | 87 | } |
50 | 88 |
|
51 | 89 | @Test |
52 | 90 | @Tag("slow") |
53 | | - public void testVideoAlbumRip() throws IOException, URISyntaxException { |
54 | | - URL url = new URI("https://www.erome.com/a/jEUFu6pi").toURL(); |
| 91 | + public void testVideoAlbumWithSingleItemRip() throws IOException, URISyntaxException { |
| 92 | + // no photos, 1 video |
| 93 | + URL url = new URI(VIDEO_ALBUM_SINGLE_VIDEO_RIDING).toURL(); |
55 | 94 | EromeRipper ripper = new EromeRipper(url); |
56 | 95 | testRipper(ripper); |
57 | 96 | } |
58 | 97 |
|
59 | 98 | @Test |
60 | | - public void testGetURLsFromPage() throws IOException, URISyntaxException { |
61 | | - URL url = new URI("https://www.erome.com/a/Tak8F2h6").toURL(); |
| 99 | + @Tag("slow") |
| 100 | + public void testVideoAlbumWithMultipleItemsRip() throws IOException, URISyntaxException { |
| 101 | + // no photos, 2 videos |
| 102 | + URL url = new URI(VIDEO_ALBUM_MULTI_VIDEO_FUN_AT_SEA).toURL(); |
62 | 103 | EromeRipper ripper = new EromeRipper(url); |
63 | | - assert (35 == ripper.getURLsFromPage(ripper.getFirstPage()).size()); |
| 104 | + testRipper(ripper); |
| 105 | + } |
| 106 | + |
| 107 | + @Test |
| 108 | + @Tag("slow") |
| 109 | + public void testAlbumWithBothVideoLastRip() throws IOException, URISyntaxException { |
| 110 | + // 2 photos, 1 video, video is the last item |
| 111 | + URL url = new URI(VIDEO_PHOTO_ALBUM_VIDEO_LAST_THICK_ASIAN).toURL(); |
| 112 | + EromeRipper ripper = new EromeRipper(url); |
| 113 | + testRipper(ripper); |
| 114 | + } |
| 115 | + |
| 116 | + @Test |
| 117 | + @Tag("slow") |
| 118 | + public void testAlbumWithBothVideoFirstRip() throws IOException, URISyntaxException { |
| 119 | + // 2 photos, 1 video |
| 120 | + URL url = new URI(VIDEO_PHOTO_ALBUM_VIDEO_FIRST_ARGENTINA).toURL(); |
| 121 | + EromeRipper ripper = new EromeRipper(url); |
| 122 | + testRipper(ripper); |
64 | 123 | } |
65 | 124 | } |
0 commit comments