Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@
* Test for {@link PeertubeAccountExtractor}
*/
public class PeertubeAccountExtractorTest {
public static class KDE implements BaseChannelExtractorTest {

public static class Framasoft implements BaseChannelExtractorTest {
private static PeertubeAccountExtractor extractor;

@BeforeClass
public static void setUp() throws Exception {
NewPipe.init(DownloaderTestImpl.getInstance());
// setting instance might break test when running in parallel
PeerTube.setInstance(new PeertubeInstance("https://peertube.mastodon.host", "PeerTube on Mastodon.host"));
PeerTube.setInstance(new PeertubeInstance("https://framatube.org", "Framatube"));
extractor = (PeertubeAccountExtractor) PeerTube
.getChannelExtractor("https://peertube.mastodon.host/accounts/kde");
.getChannelExtractor("https://framatube.org/accounts/framasoft");
extractor.fetchPage();
}

Expand All @@ -43,22 +44,22 @@ public void testServiceId() {

@Test
public void testName() throws ParsingException {
assertEquals("The KDE Community", extractor.getName());
assertEquals("Framasoft", extractor.getName());
}

@Test
public void testId() throws ParsingException {
assertEquals("accounts/kde", extractor.getId());
assertEquals("accounts/framasoft", extractor.getId());
}

@Test
public void testUrl() throws ParsingException {
assertEquals("https://peertube.mastodon.host/accounts/kde", extractor.getUrl());
assertEquals("https://framatube.org/accounts/framasoft", extractor.getUrl());
}

@Test
public void testOriginalUrl() throws ParsingException {
assertEquals("https://peertube.mastodon.host/accounts/kde", extractor.getOriginalUrl());
assertEquals("https://framatube.org/accounts/framasoft", extractor.getOriginalUrl());
}

/*//////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -96,25 +97,25 @@ public void testBannerUrl() {

@Test
public void testFeedUrl() throws ParsingException {
assertEquals("https://peertube.mastodon.host/feeds/videos.xml?accountId=32465", extractor.getFeedUrl());
assertEquals("https://framatube.org/feeds/videos.xml?accountId=3", extractor.getFeedUrl());
}

@Test
public void testSubscriberCount() throws ParsingException {
assertTrue("Wrong subscriber count", extractor.getSubscriberCount() >= 5);
assertTrue("Wrong subscriber count", extractor.getSubscriberCount() >= 500);
}
}

public static class Booteille implements BaseChannelExtractorTest {
public static class FreeSoftwareFoundation implements BaseChannelExtractorTest {
private static PeertubeAccountExtractor extractor;

@BeforeClass
public static void setUp() throws Exception {
NewPipe.init(DownloaderTestImpl.getInstance());
// setting instance might break test when running in parallel
PeerTube.setInstance(new PeertubeInstance("https://peertube.mastodon.host", "PeerTube on Mastodon.host"));
PeerTube.setInstance(new PeertubeInstance("https://framatube.org", "Framatube"));
extractor = (PeertubeAccountExtractor) PeerTube
.getChannelExtractor("https://peertube.mastodon.host/api/v1/accounts/booteille");
.getChannelExtractor("https://framatube.org/api/v1/accounts/fsf");
extractor.fetchPage();
}

Expand All @@ -139,22 +140,22 @@ public void testServiceId() {

@Test
public void testName() throws ParsingException {
assertEquals("booteille", extractor.getName());
assertEquals("Free Software Foundation", extractor.getName());
}

@Test
public void testId() throws ParsingException {
assertEquals("accounts/booteille", extractor.getId());
assertEquals("accounts/fsf", extractor.getId());
}

@Test
public void testUrl() throws ParsingException {
assertEquals("https://peertube.mastodon.host/accounts/booteille", extractor.getUrl());
assertEquals("https://framatube.org/accounts/fsf", extractor.getUrl());
}

@Test
public void testOriginalUrl() throws ParsingException {
assertEquals("https://peertube.mastodon.host/api/v1/accounts/booteille", extractor.getOriginalUrl());
assertEquals("https://framatube.org/api/v1/accounts/fsf", extractor.getOriginalUrl());
}

/*//////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -185,20 +186,19 @@ public void testAvatarUrl() throws ParsingException {
assertIsSecureUrl(extractor.getAvatarUrl());
}

@Ignore
@Test
public void testBannerUrl() throws ParsingException {
assertIsSecureUrl(extractor.getBannerUrl());
assertNull(extractor.getBannerUrl());
}

@Test
public void testFeedUrl() throws ParsingException {
assertEquals("https://peertube.mastodon.host/feeds/videos.xml?accountId=1753", extractor.getFeedUrl());
assertEquals("https://framatube.org/feeds/videos.xml?accountId=8178", extractor.getFeedUrl());
}

@Test
public void testSubscriberCount() throws ParsingException {
assertTrue("Wrong subscriber count", extractor.getSubscriberCount() >= 1);
assertTrue("Wrong subscriber count", extractor.getSubscriberCount() >= 100);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@
* Test for {@link PeertubeChannelExtractor}
*/
public class PeertubeChannelExtractorTest {
public static class DanDAugeTutoriels implements BaseChannelExtractorTest {

public static class LaQuadratureDuNet implements BaseChannelExtractorTest {
private static PeertubeChannelExtractor extractor;

@BeforeClass
public static void setUp() throws Exception {
NewPipe.init(DownloaderTestImpl.getInstance());
// setting instance might break test when running in parallel
PeerTube.setInstance(new PeertubeInstance("https://peertube.mastodon.host", "PeerTube on Mastodon.host"));
PeerTube.setInstance(new PeertubeInstance("https://framatube.org", "Framatube"));
extractor = (PeertubeChannelExtractor) PeerTube
.getChannelExtractor("https://peertube.mastodon.host/video-channels/7682d9f2-07be-4622-862e-93ec812e2ffa");
.getChannelExtractor("https://framatube.org/video-channels/[email protected]/videos");
extractor.fetchPage();
}

Expand All @@ -43,22 +44,22 @@ public void testServiceId() {

@Test
public void testName() throws ParsingException {
assertEquals("Dan d'Auge tutoriels", extractor.getName());
assertEquals("La Quadrature du Net", extractor.getName());
}

@Test
public void testId() throws ParsingException {
assertEquals("video-channels/7682d9f2-07be-4622-862e-93ec812e2ffa", extractor.getId());
assertEquals("video-channels/[email protected]", extractor.getId());
}

@Test
public void testUrl() throws ParsingException {
assertEquals("https://peertube.mastodon.host/video-channels/7682d9f2-07be-4622-862e-93ec812e2ffa", extractor.getUrl());
assertEquals("https://framatube.org/video-channels/[email protected]", extractor.getUrl());
}

@Test
public void testOriginalUrl() throws ParsingException {
assertEquals("https://peertube.mastodon.host/video-channels/7682d9f2-07be-4622-862e-93ec812e2ffa", extractor.getOriginalUrl());
assertEquals("https://framatube.org/video-channels/[email protected]/videos", extractor.getOriginalUrl());
}

/*//////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -86,12 +87,12 @@ public void testDescription() throws ParsingException {

@Test
public void testParentChannelName() throws ParsingException {
assertEquals("libux", extractor.getParentChannelName());
assertEquals("lqdn", extractor.getParentChannelName());
}

@Test
public void testParentChannelUrl() throws ParsingException {
assertEquals("https://peertube.mastodon.host/accounts/libux", extractor.getParentChannelUrl());
assertEquals("https://video.lqdn.fr/accounts/lqdn", extractor.getParentChannelUrl());
}

@Test
Expand All @@ -111,25 +112,26 @@ public void testBannerUrl() throws ParsingException {

@Test
public void testFeedUrl() throws ParsingException {
assertEquals("https://peertube.mastodon.host/feeds/videos.xml?videoChannelId=1361", extractor.getFeedUrl());
assertEquals("https://framatube.org/feeds/videos.xml?videoChannelId=1126", extractor.getFeedUrl());
}

@Test
public void testSubscriberCount() throws ParsingException {
assertTrue("Wrong subscriber count", extractor.getSubscriberCount() >= 4);
assertTrue("Wrong subscriber count", extractor.getSubscriberCount() >= 230);
}
}

public static class Divers implements BaseChannelExtractorTest {
public static class ChatSceptique implements BaseChannelExtractorTest {

private static PeertubeChannelExtractor extractor;

@BeforeClass
public static void setUp() throws Exception {
NewPipe.init(DownloaderTestImpl.getInstance());
// setting instance might break test when running in parallel
PeerTube.setInstance(new PeertubeInstance("https://peertube.mastodon.host", "PeerTube on Mastodon.host"));
PeerTube.setInstance(new PeertubeInstance("https://framatube.org", "Framatube"));
extractor = (PeertubeChannelExtractor) PeerTube
.getChannelExtractor("https://peertube.mastodon.host/api/v1/video-channels/35080089-79b6-45fc-96ac-37e4d46a4457");
.getChannelExtractor("https://framatube.org/api/v1/video-channels/[email protected]");
extractor.fetchPage();
}

Expand All @@ -154,22 +156,22 @@ public void testServiceId() {

@Test
public void testName() throws ParsingException {
assertEquals("Divers", extractor.getName());
assertEquals("Chat Sceptique", extractor.getName());
}

@Test
public void testId() throws ParsingException {
assertEquals("video-channels/35080089-79b6-45fc-96ac-37e4d46a4457", extractor.getId());
assertEquals("video-channels/[email protected]", extractor.getId());
}

@Test
public void testUrl() throws ParsingException {
assertEquals("https://peertube.mastodon.host/video-channels/35080089-79b6-45fc-96ac-37e4d46a4457", extractor.getUrl());
assertEquals("https://framatube.org/video-channels/[email protected]", extractor.getUrl());
}

@Test
public void testOriginalUrl() throws ParsingException {
assertEquals("https://peertube.mastodon.host/api/v1/video-channels/35080089-79b6-45fc-96ac-37e4d46a4457", extractor.getOriginalUrl());
assertEquals("https://framatube.org/api/v1/video-channels/[email protected]", extractor.getOriginalUrl());
}

/*//////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -197,12 +199,12 @@ public void testDescription() throws ParsingException {

@Test
public void testParentChannelName() throws ParsingException {
assertEquals("booteille", extractor.getParentChannelName());
assertEquals("nathan", extractor.getParentChannelName());
}

@Test
public void testParentChannelUrl() throws ParsingException {
assertEquals("https://peertube.mastodon.host/accounts/booteille", extractor.getParentChannelUrl());
assertEquals("https://skeptikon.fr/accounts/nathan", extractor.getParentChannelUrl());
}

@Test
Expand All @@ -215,20 +217,19 @@ public void testAvatarUrl() throws ParsingException {
assertIsSecureUrl(extractor.getAvatarUrl());
}

@Ignore
@Test
public void testBannerUrl() throws ParsingException {
assertIsSecureUrl(extractor.getBannerUrl());
assertNull(extractor.getBannerUrl());
}

@Test
public void testFeedUrl() throws ParsingException {
assertEquals("https://peertube.mastodon.host/feeds/videos.xml?videoChannelId=1227", extractor.getFeedUrl());
assertEquals("https://framatube.org/feeds/videos.xml?videoChannelId=137", extractor.getFeedUrl());
}

@Test
public void testSubscriberCount() throws ParsingException {
assertTrue("Wrong subscriber count", extractor.getSubscriberCount() >= 2);
assertTrue("Wrong subscriber count", extractor.getSubscriberCount() >= 700);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
import static org.schabi.newpipe.extractor.services.DefaultTests.*;

public class PeertubeTrendingExtractorTest {

public static class Trending implements BaseListExtractorTest {
private static PeertubeTrendingExtractor extractor;

@BeforeClass
public static void setUp() throws Exception {
NewPipe.init(DownloaderTestImpl.getInstance());
// setting instance might break test when running in parallel
PeerTube.setInstance(new PeertubeInstance("https://peertube.mastodon.host", "PeerTube on Mastodon.host"));
PeerTube.setInstance(new PeertubeInstance("https://framatube.org", "Framatube"));
extractor = (PeertubeTrendingExtractor) PeerTube.getKioskList()
.getExtractorById("Trending", null);
extractor.fetchPage();
Expand All @@ -47,12 +48,12 @@ public void testId() throws Exception {

@Test
public void testUrl() throws ParsingException {
assertEquals("https://peertube.mastodon.host/api/v1/videos?sort=-trending", extractor.getUrl());
assertEquals("https://framatube.org/api/v1/videos?sort=-trending", extractor.getUrl());
}

@Test
public void testOriginalUrl() throws ParsingException {
assertEquals("https://peertube.mastodon.host/api/v1/videos?sort=-trending", extractor.getOriginalUrl());
assertEquals("https://framatube.org/api/v1/videos?sort=-trending", extractor.getOriginalUrl());
}

/*//////////////////////////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ public class PeertubeSearchExtractorTest {

public static class All extends DefaultSearchExtractorTest {
private static SearchExtractor extractor;
private static final String QUERY = "kde";
private static final String QUERY = "fsf";

@BeforeClass
public static void setUp() throws Exception {
NewPipe.init(DownloaderTestImpl.getInstance());
// setting instance might break test when running in parallel
PeerTube.setInstance(new PeertubeInstance("https://peertube.mastodon.host", "PeerTube on Mastodon.host"));
PeerTube.setInstance(new PeertubeInstance("https://framatube.org", "Framatube"));
extractor = PeerTube.getSearchExtractor(QUERY);
extractor.fetchPage();
}
Expand All @@ -52,7 +52,7 @@ public static class SepiaSearch extends DefaultSearchExtractorTest {
public static void setUp() throws Exception {
NewPipe.init(DownloaderTestImpl.getInstance());
// setting instance might break test when running in parallel
PeerTube.setInstance(new PeertubeInstance("https://peertube.mastodon.host", "PeerTube on Mastodon.host"));
PeerTube.setInstance(new PeertubeInstance("https://framatube.org", "Framatube"));
extractor = PeerTube.getSearchExtractor(QUERY, singletonList(PeertubeSearchQueryHandlerFactory.SEPIA_VIDEOS), "");
extractor.fetchPage();
}
Expand Down