[YouTube] Also test playlist type in playlist tests

This commit is contained in:
Stypox 2022-02-17 18:01:30 +01:00
parent 401082abe4
commit d660c04838
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
2 changed files with 38 additions and 2 deletions

View File

@ -2,7 +2,6 @@ package org.schabi.newpipe.extractor.services.youtube;
import com.grack.nanojson.JsonWriter;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.schabi.newpipe.downloader.DownloaderFactory;
import org.schabi.newpipe.extractor.ExtractorAsserts;
@ -11,6 +10,8 @@ import org.schabi.newpipe.extractor.ListExtractor.InfoItemsPage;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.Page;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.playlist.PlaylistInfo;
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeMixPlaylistExtractor;
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
@ -118,6 +119,11 @@ public class YoutubeMixPlaylistExtractorTest {
void getStreamCount() {
assertEquals(ListExtractor.ITEM_COUNT_INFINITE, extractor.getStreamCount());
}
@Test
void getPlaylistType() throws ParsingException {
assertEquals(PlaylistInfo.PlaylistType.MIX_STREAM, extractor.getPlaylistType());
}
}
public static class MixWithIndex {
@ -203,6 +209,11 @@ public class YoutubeMixPlaylistExtractorTest {
void getStreamCount() {
assertEquals(ListExtractor.ITEM_COUNT_INFINITE, extractor.getStreamCount());
}
@Test
void getPlaylistType() throws ParsingException {
assertEquals(PlaylistInfo.PlaylistType.MIX_STREAM, extractor.getPlaylistType());
}
}
public static class MyMix {
@ -287,6 +298,11 @@ public class YoutubeMixPlaylistExtractorTest {
void getStreamCount() {
assertEquals(ListExtractor.ITEM_COUNT_INFINITE, extractor.getStreamCount());
}
@Test
void getPlaylistType() throws ParsingException {
assertEquals(PlaylistInfo.PlaylistType.MIX_STREAM, extractor.getPlaylistType());
}
}
public static class Invalid {
@ -381,5 +397,10 @@ public class YoutubeMixPlaylistExtractorTest {
void getStreamCount() {
assertEquals(ListExtractor.ITEM_COUNT_INFINITE, extractor.getStreamCount());
}
@Test
void getPlaylistType() throws ParsingException {
assertEquals(PlaylistInfo.PlaylistType.MIX_CHANNEL, extractor.getPlaylistType());
}
}
}

View File

@ -8,9 +8,9 @@ import org.schabi.newpipe.extractor.ExtractorAsserts;
import org.schabi.newpipe.extractor.ListExtractor;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.exceptions.ContentNotAvailableException;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.playlist.PlaylistExtractor;
import org.schabi.newpipe.extractor.playlist.PlaylistInfo;
import org.schabi.newpipe.extractor.services.BasePlaylistExtractorTest;
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubePlaylistExtractor;
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
@ -162,6 +162,11 @@ public class YoutubePlaylistExtractorTest {
public void testUploaderVerified() throws Exception {
assertFalse(extractor.isUploaderVerified());
}
@Test
void getPlaylistType() throws ParsingException {
assertEquals(PlaylistInfo.PlaylistType.NORMAL, extractor.getPlaylistType());
}
}
public static class HugePlaylist implements BasePlaylistExtractorTest {
@ -281,6 +286,11 @@ public class YoutubePlaylistExtractorTest {
public void testUploaderVerified() throws Exception {
assertTrue(extractor.isUploaderVerified());
}
@Test
void getPlaylistType() throws ParsingException {
assertEquals(PlaylistInfo.PlaylistType.NORMAL, extractor.getPlaylistType());
}
}
public static class LearningPlaylist implements BasePlaylistExtractorTest {
@ -386,6 +396,11 @@ public class YoutubePlaylistExtractorTest {
public void testUploaderVerified() throws Exception {
assertTrue(extractor.isUploaderVerified());
}
@Test
void getPlaylistType() throws ParsingException {
assertEquals(PlaylistInfo.PlaylistType.NORMAL, extractor.getPlaylistType());
}
}
public static class ContinuationsTests {