Fix YouTube and SoundCloud playlists tests

This commit is contained in:
TiA4f8R 2022-03-12 19:11:53 +01:00
parent 8b3f90eb7e
commit 35e082248e
No known key found for this signature in database
GPG Key ID: E6D3E7F5949450DD
2 changed files with 16 additions and 12 deletions

View File

@ -7,12 +7,14 @@ import org.schabi.newpipe.downloader.DownloaderTestImpl;
import org.schabi.newpipe.extractor.ExtractorAsserts;
import org.schabi.newpipe.extractor.ListExtractor;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.playlist.PlaylistExtractor;
import org.schabi.newpipe.extractor.services.BasePlaylistExtractorTest;
import org.schabi.newpipe.extractor.services.soundcloud.extractors.SoundcloudPlaylistExtractor;
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
import static org.junit.jupiter.api.Assertions.*;
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertEmpty;
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertIsSecureUrl;
import static org.schabi.newpipe.extractor.ServiceList.SoundCloud;
import static org.schabi.newpipe.extractor.services.DefaultTests.*;
@ -85,9 +87,9 @@ public class SoundcloudPlaylistExtractorTest {
}
@Test
public void testBannerUrl() {
public void testBannerUrl() throws ParsingException {
// SoundCloud playlists do not have a banner
assertNull(extractor.getBannerUrl());
assertEmpty(extractor.getBannerUrl());
}
@Test
@ -182,9 +184,9 @@ public class SoundcloudPlaylistExtractorTest {
}
@Test
public void testBannerUrl() {
public void testBannerUrl() throws ParsingException {
// SoundCloud playlists do not have a banner
assertNull(extractor.getBannerUrl());
assertEmpty(extractor.getBannerUrl());
}
@Test
@ -294,9 +296,9 @@ public class SoundcloudPlaylistExtractorTest {
}
@Test
public void testBannerUrl() {
public void testBannerUrl() throws ParsingException {
// SoundCloud playlists do not have a banner
assertNull(extractor.getBannerUrl());
assertEmpty(extractor.getBannerUrl());
}
@Test
@ -398,9 +400,9 @@ public class SoundcloudPlaylistExtractorTest {
}
@Test
public void testBannerUrl() {
public void testBannerUrl() throws ParsingException {
// SoundCloud playlists do not have a banner
assertNull(extractor.getBannerUrl());
assertEmpty(extractor.getBannerUrl());
}
@Test

View File

@ -23,6 +23,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertIsSecureUrl;
import static org.schabi.newpipe.extractor.ListExtractor.ITEM_COUNT_UNKNOWN;
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
import static org.schabi.newpipe.extractor.services.DefaultTests.assertNoMoreItems;
import static org.schabi.newpipe.extractor.services.DefaultTests.defaultTestGetPageInNewExtractor;
@ -129,7 +130,7 @@ public class YoutubePlaylistExtractorTest {
@Disabled
@Test
public void testBannerUrl() {
public void testBannerUrl() throws ParsingException {
final String bannerUrl = extractor.getBannerUrl();
assertIsSecureUrl(bannerUrl);
ExtractorAsserts.assertContains("yt", bannerUrl);
@ -249,7 +250,7 @@ public class YoutubePlaylistExtractorTest {
@Disabled
@Test
public void testBannerUrl() {
public void testBannerUrl() throws ParsingException {
final String bannerUrl = extractor.getBannerUrl();
assertIsSecureUrl(bannerUrl);
ExtractorAsserts.assertContains("yt", bannerUrl);
@ -352,7 +353,7 @@ public class YoutubePlaylistExtractorTest {
@Disabled
@Test
public void testBannerUrl() {
public void testBannerUrl() throws ParsingException {
final String bannerUrl = extractor.getBannerUrl();
assertIsSecureUrl(bannerUrl);
ExtractorAsserts.assertContains("yt", bannerUrl);
@ -377,7 +378,8 @@ public class YoutubePlaylistExtractorTest {
@Test
public void testStreamCount() throws Exception {
ExtractorAsserts.assertGreater(40, extractor.getStreamCount());
// We are not able to extract the stream count of YouTube learning playlists
assertEquals(ITEM_COUNT_UNKNOWN, extractor.getStreamCount());
}
@Override