From f9792cf3a9fa4072a2acb5db084acc726ba9207a Mon Sep 17 00:00:00 2001 From: AudricV <74829229+AudricV@users.noreply.github.com> Date: Wed, 10 Apr 2024 21:13:04 +0200 Subject: [PATCH] [YouTube] Fix InteractiveTabbedHeader.testTabs test YouTube now returns a Shorts tab for InteractiveTabbedHeader gaming channels, which contains Shorts about the game of the topic channel but are not uploaded on the game topic channel. As this tab is already supported by the extractor, fetching a gaming topic channel now returns a tab instead of none. Channel name and channel URL of these Shorts needs to be set to null in a separate commit, as Shorts on this tab do not have the topic channel as their uploader. --- .../services/youtube/YoutubeChannelExtractorTest.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractorTest.java index 13c0a9f46..24c88f3fc 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractorTest.java @@ -25,6 +25,7 @@ import org.schabi.newpipe.extractor.channel.tabs.ChannelTabs; import org.schabi.newpipe.extractor.exceptions.AccountTerminatedException; import org.schabi.newpipe.extractor.exceptions.ContentNotAvailableException; import org.schabi.newpipe.extractor.exceptions.ParsingException; +import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler; import org.schabi.newpipe.extractor.linkhandler.ReadyChannelTabListLinkHandler; import org.schabi.newpipe.extractor.services.BaseChannelExtractorTest; import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeChannelExtractor; @@ -916,8 +917,14 @@ public class YoutubeChannelExtractorTest { @Test @Override public void testTabs() throws Exception { - // Gaming topic channels tabs are not yet supported, so an empty list should be returned - assertTrue(extractor.getTabs().isEmpty()); + // Gaming topic channels tabs are not yet supported + // However, a Shorts tab like on other channel types is returned, so it is supported + // Check that it is returned + final List channelTabs = extractor.getTabs(); + assertEquals(1, channelTabs.size()); + final List contentFilters = channelTabs.get(0).getContentFilters(); + assertEquals(1, contentFilters.size()); + assertEquals(ChannelTabs.SHORTS, contentFilters.get(0)); } @Test