Skip to content

Commit fc45941

Browse files
committed
[YouTube] Fix YoutubeChannelExtractorTest tests
- Change CarouselHeader test channel to Sports system one, as the Coachella one doesn't return this channel header anymore; - Fix InteractiveTabbedHeader test by checking whether the test's channel description is not empty instead of containing some words, as it is changing frequently.
1 parent 0bcb241 commit fc45941

1 file changed

Lines changed: 15 additions & 20 deletions

File tree

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

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
import static org.junit.jupiter.api.Assertions.assertEquals;
44
import static org.junit.jupiter.api.Assertions.assertFalse;
5+
import static org.junit.jupiter.api.Assertions.assertNull;
56
import static org.junit.jupiter.api.Assertions.assertThrows;
67
import static org.junit.jupiter.api.Assertions.assertTrue;
78
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertContains;
89
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertEmpty;
9-
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertNotBlank;
10+
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertNotEmpty;
1011
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertTabsContain;
1112
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
1213
import static org.schabi.newpipe.extractor.services.DefaultTests.defaultTestGetPageInNewExtractor;
@@ -654,7 +655,7 @@ public static void setUp() throws Exception {
654655
YoutubeTestsUtils.ensureStateless();
655656
NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "carouselHeader"));
656657
extractor = (YoutubeChannelExtractor) YouTube
657-
.getChannelExtractor("https://www.youtube.com/channel/UCHF66aWLOxBW4l6VkSrS3cQ");
658+
.getChannelExtractor("https://www.youtube.com/channel/UCEgdi0XIXXZ-qJOFPf4JSKw");
658659
extractor.fetchPage();
659660
}
660661

@@ -669,22 +670,22 @@ public void testServiceId() {
669670

670671
@Test
671672
public void testName() throws Exception {
672-
assertEquals("Coachella", extractor.getName());
673+
assertEquals("Sports", extractor.getName());
673674
}
674675

675676
@Test
676677
public void testId() throws Exception {
677-
assertEquals("UCHF66aWLOxBW4l6VkSrS3cQ", extractor.getId());
678+
assertEquals("UCEgdi0XIXXZ-qJOFPf4JSKw", extractor.getId());
678679
}
679680

680681
@Test
681682
public void testUrl() throws ParsingException {
682-
assertEquals("https://www.youtube.com/channel/UCHF66aWLOxBW4l6VkSrS3cQ", extractor.getUrl());
683+
assertEquals("https://www.youtube.com/channel/UCEgdi0XIXXZ-qJOFPf4JSKw", extractor.getUrl());
683684
}
684685

685686
@Test
686687
public void testOriginalUrl() throws ParsingException {
687-
assertEquals("https://www.youtube.com/channel/UCHF66aWLOxBW4l6VkSrS3cQ", extractor.getOriginalUrl());
688+
assertEquals("https://www.youtube.com/channel/UCEgdi0XIXXZ-qJOFPf4JSKw", extractor.getOriginalUrl());
688689
}
689690

690691
/*//////////////////////////////////////////////////////////////////////////
@@ -694,7 +695,7 @@ public void testOriginalUrl() throws ParsingException {
694695
@Test
695696
@Override
696697
public void testDescription() throws ParsingException {
697-
assertNotBlank(extractor.getDescription());
698+
assertNull(extractor.getDescription());
698699
}
699700

700701
@Test
@@ -710,12 +711,12 @@ public void testBanners() {
710711

711712
@Test
712713
public void testFeedUrl() throws Exception {
713-
assertEquals("https://www.youtube.com/feeds/videos.xml?channel_id=UCHF66aWLOxBW4l6VkSrS3cQ", extractor.getFeedUrl());
714+
assertEquals("https://www.youtube.com/feeds/videos.xml?channel_id=UCEgdi0XIXXZ-qJOFPf4JSKw", extractor.getFeedUrl());
714715
}
715716

716717
@Test
717718
public void testSubscriberCount() throws Exception {
718-
ExtractorAsserts.assertGreaterOrEqual(2_900_000, extractor.getSubscriberCount());
719+
ExtractorAsserts.assertGreaterOrEqual(75_000_000, extractor.getSubscriberCount());
719720
}
720721

721722
@Test
@@ -726,18 +727,13 @@ public void testVerified() throws Exception {
726727
@Test
727728
@Override
728729
public void testTabs() throws Exception {
729-
assertTabsContain(extractor.getTabs(), ChannelTabs.VIDEOS, ChannelTabs.SHORTS,
730-
ChannelTabs.LIVESTREAMS, ChannelTabs.PLAYLISTS, ChannelTabs.CHANNELS);
731-
assertTrue(extractor.getTabs().stream()
732-
.filter(it -> ChannelTabs.VIDEOS.equals(it.getContentFilters().get(0)))
733-
.allMatch(ReadyChannelTabListLinkHandler.class::isInstance));
730+
assertEmpty(extractor.getTabs());
734731
}
735732

736733
@Test
737734
@Override
738735
public void testTags() throws Exception {
739-
assertTrue(extractor.getTags().containsAll(List.of("coachella", "music", "california",
740-
"festival", "arts")));
736+
assertEmpty(extractor.getTags());
741737
}
742738
}
743739

@@ -881,10 +877,9 @@ static void setUp() throws Exception {
881877
@Test
882878
@Override
883879
public void testDescription() throws Exception {
884-
final String description = extractor.getDescription();
885-
assertContains("Minecraft", description);
886-
assertContains("game", description);
887-
assertContains("Mojang", description);
880+
// The description changes frequently and there is no significant common word, so only
881+
// check if it is not empty
882+
assertNotEmpty(extractor.getDescription());
888883
}
889884

890885
@Test

0 commit comments

Comments
 (0)