Skip to content

Commit 7ba0483

Browse files
committed
Add tests for ratings in yt stream extractor tests
1 parent 1bb6cde commit 7ba0483

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorDefaultTest.java

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,18 @@ public void testGetSubtitlesList() throws IOException, ExtractionException {
187187
// Video (/view?v=YQHsXMglC9A) set in the setUp() method has no captions => null
188188
assertTrue(extractor.getSubtitles(MediaFormat.TTML).isEmpty());
189189
}
190+
191+
@Test
192+
public void testGetLikeCount() throws ParsingException {
193+
long likeCount = extractor.getLikeCount();
194+
assertTrue("" + likeCount, likeCount >= 15000000);
195+
}
196+
197+
@Test
198+
public void testGetDislikeCount() throws ParsingException {
199+
long dislikeCount = extractor.getDislikeCount();
200+
assertTrue("" + dislikeCount, dislikeCount >= 818000);
201+
}
190202
}
191203

192204
public static class DescriptionTestPewdiepie {
@@ -249,6 +261,29 @@ public void testGetFullLinksInDescription() throws ParsingException {
249261
}
250262
}
251263

264+
public static class RatingsDisabledTest {
265+
private static YoutubeStreamExtractor extractor;
266+
267+
@BeforeClass
268+
public static void setUp() throws Exception {
269+
NewPipe.init(DownloaderTestImpl.getInstance());
270+
extractor = (YoutubeStreamExtractor) YouTube
271+
.getStreamExtractor("https://www.youtube.com/watch?v=HRKu0cvrr_o");
272+
extractor.fetchPage();
273+
}
274+
275+
@Test
276+
public void testGetLikeCount() throws ParsingException {
277+
assertEquals(-1, extractor.getLikeCount());
278+
}
279+
280+
@Test
281+
public void testGetDislikeCount() throws ParsingException {
282+
assertEquals(-1, extractor.getDislikeCount());
283+
}
284+
285+
}
286+
252287
public static class FramesTest {
253288
private static YoutubeStreamExtractor extractor;
254289

0 commit comments

Comments
 (0)