Add tests for youtube channel urls

They have to be in the form "https://www.youtube.com/channel/ID"
This commit is contained in:
Stypox 2019-08-12 11:58:50 +02:00
parent 6aa69a2df8
commit b8bc57c53f
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
2 changed files with 14 additions and 1 deletions

View File

@ -111,7 +111,7 @@ public class YoutubeStreamExtractorDefaultTest {
@Test
public void testGetUploaderUrl() throws ParsingException {
assertTrue(extractor.getUploaderUrl().length() > 0);
assertEquals("https://www.youtube.com/channel/UCsRM0YB_dabtEPGPTKo-gcw", extractor.getUploaderUrl());
}
@Test

View File

@ -1,5 +1,6 @@
package org.schabi.newpipe.extractor.services.youtube.search;
import org.hamcrest.CoreMatchers;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
@ -63,4 +64,16 @@ public class YoutubeSearchExtractorChannelOnlyTest extends YoutubeSearchExtracto
}
}
}
@Test
public void testChannelUrl() {
for(InfoItem item : itemsPage.getItems()) {
if (item.getName().contains("PewDiePie")) {
assertEquals("https://www.youtube.com/channel/UC-lHJZR3Gqxm24_Vd_AJ5Yw", item.getUrl());
break;
} else {
assertThat(item.getUrl(), CoreMatchers.startsWith("https://www.youtube.com/channel/"));
}
}
}
}