Skip to content

Commit d660c04

Browse files
committed
[YouTube] Also test playlist type in playlist tests
1 parent 401082a commit d660c04

2 files changed

Lines changed: 38 additions & 2 deletions

File tree

extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeMixPlaylistExtractorTest.java

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import com.grack.nanojson.JsonWriter;
44
import org.junit.jupiter.api.BeforeAll;
5-
import org.junit.jupiter.api.Disabled;
65
import org.junit.jupiter.api.Test;
76
import org.schabi.newpipe.downloader.DownloaderFactory;
87
import org.schabi.newpipe.extractor.ExtractorAsserts;
@@ -11,6 +10,8 @@
1110
import org.schabi.newpipe.extractor.NewPipe;
1211
import org.schabi.newpipe.extractor.Page;
1312
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
13+
import org.schabi.newpipe.extractor.exceptions.ParsingException;
14+
import org.schabi.newpipe.extractor.playlist.PlaylistInfo;
1415
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeMixPlaylistExtractor;
1516
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
1617

@@ -118,6 +119,11 @@ void getContinuations() throws Exception {
118119
void getStreamCount() {
119120
assertEquals(ListExtractor.ITEM_COUNT_INFINITE, extractor.getStreamCount());
120121
}
122+
123+
@Test
124+
void getPlaylistType() throws ParsingException {
125+
assertEquals(PlaylistInfo.PlaylistType.MIX_STREAM, extractor.getPlaylistType());
126+
}
121127
}
122128

123129
public static class MixWithIndex {
@@ -203,6 +209,11 @@ void getContinuations() throws Exception {
203209
void getStreamCount() {
204210
assertEquals(ListExtractor.ITEM_COUNT_INFINITE, extractor.getStreamCount());
205211
}
212+
213+
@Test
214+
void getPlaylistType() throws ParsingException {
215+
assertEquals(PlaylistInfo.PlaylistType.MIX_STREAM, extractor.getPlaylistType());
216+
}
206217
}
207218

208219
public static class MyMix {
@@ -287,6 +298,11 @@ void getContinuations() throws Exception {
287298
void getStreamCount() {
288299
assertEquals(ListExtractor.ITEM_COUNT_INFINITE, extractor.getStreamCount());
289300
}
301+
302+
@Test
303+
void getPlaylistType() throws ParsingException {
304+
assertEquals(PlaylistInfo.PlaylistType.MIX_STREAM, extractor.getPlaylistType());
305+
}
290306
}
291307

292308
public static class Invalid {
@@ -381,5 +397,10 @@ void getPage() throws Exception {
381397
void getStreamCount() {
382398
assertEquals(ListExtractor.ITEM_COUNT_INFINITE, extractor.getStreamCount());
383399
}
400+
401+
@Test
402+
void getPlaylistType() throws ParsingException {
403+
assertEquals(PlaylistInfo.PlaylistType.MIX_CHANNEL, extractor.getPlaylistType());
404+
}
384405
}
385406
}

extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistExtractorTest.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
import org.schabi.newpipe.extractor.ListExtractor;
99
import org.schabi.newpipe.extractor.NewPipe;
1010
import org.schabi.newpipe.extractor.exceptions.ContentNotAvailableException;
11-
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
1211
import org.schabi.newpipe.extractor.exceptions.ParsingException;
1312
import org.schabi.newpipe.extractor.playlist.PlaylistExtractor;
13+
import org.schabi.newpipe.extractor.playlist.PlaylistInfo;
1414
import org.schabi.newpipe.extractor.services.BasePlaylistExtractorTest;
1515
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubePlaylistExtractor;
1616
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
@@ -162,6 +162,11 @@ public void testStreamCount() throws Exception {
162162
public void testUploaderVerified() throws Exception {
163163
assertFalse(extractor.isUploaderVerified());
164164
}
165+
166+
@Test
167+
void getPlaylistType() throws ParsingException {
168+
assertEquals(PlaylistInfo.PlaylistType.NORMAL, extractor.getPlaylistType());
169+
}
165170
}
166171

167172
public static class HugePlaylist implements BasePlaylistExtractorTest {
@@ -281,6 +286,11 @@ public void testStreamCount() throws Exception {
281286
public void testUploaderVerified() throws Exception {
282287
assertTrue(extractor.isUploaderVerified());
283288
}
289+
290+
@Test
291+
void getPlaylistType() throws ParsingException {
292+
assertEquals(PlaylistInfo.PlaylistType.NORMAL, extractor.getPlaylistType());
293+
}
284294
}
285295

286296
public static class LearningPlaylist implements BasePlaylistExtractorTest {
@@ -386,6 +396,11 @@ public void testStreamCount() throws Exception {
386396
public void testUploaderVerified() throws Exception {
387397
assertTrue(extractor.isUploaderVerified());
388398
}
399+
400+
@Test
401+
void getPlaylistType() throws ParsingException {
402+
assertEquals(PlaylistInfo.PlaylistType.NORMAL, extractor.getPlaylistType());
403+
}
389404
}
390405

391406
public static class ContinuationsTests {

0 commit comments

Comments
 (0)