Fix failing tests.
This commit is contained in:
parent
ff5f223d3f
commit
416089146e
2 changed files with 24 additions and 22 deletions
|
@ -2,10 +2,18 @@
|
|||
|
||||
package org.schabi.newpipe.extractor.services.bandcamp;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.schabi.newpipe.extractor.ServiceList.Bandcamp;
|
||||
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.schabi.newpipe.downloader.DownloaderTestImpl;
|
||||
import org.schabi.newpipe.extractor.*;
|
||||
import org.schabi.newpipe.extractor.InfoItem;
|
||||
import org.schabi.newpipe.extractor.ListExtractor;
|
||||
import org.schabi.newpipe.extractor.NewPipe;
|
||||
import org.schabi.newpipe.extractor.Page;
|
||||
import org.schabi.newpipe.extractor.StreamingService;
|
||||
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
||||
import org.schabi.newpipe.extractor.playlist.PlaylistInfoItem;
|
||||
import org.schabi.newpipe.extractor.search.SearchExtractor;
|
||||
|
@ -13,12 +21,9 @@ import org.schabi.newpipe.extractor.services.DefaultSearchExtractorTest;
|
|||
import org.schabi.newpipe.extractor.services.bandcamp.extractors.BandcampSearchExtractor;
|
||||
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.schabi.newpipe.extractor.ServiceList.Bandcamp;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Test for {@link BandcampSearchExtractor}
|
||||
|
@ -73,20 +78,17 @@ public class BandcampSearchExtractorTest {
|
|||
@Test
|
||||
void testAlbumSearch() throws ExtractionException, IOException {
|
||||
final SearchExtractor extractor = Bandcamp.getSearchExtractor("minecraft volume alpha");
|
||||
InfoItem minecraft = extractor.getInitialPage()
|
||||
.getItems().get(0);
|
||||
final InfoItem minecraft = extractor.getInitialPage().getItems().get(0);
|
||||
|
||||
// Minecraft volume alpha should be the first result, no?
|
||||
assertEquals("Minecraft: Volume Alpha (cover)", minecraft.getName());
|
||||
assertEquals("Minecraft - Volume Alpha", minecraft.getName());
|
||||
assertTrue(minecraft.getThumbnailUrl().endsWith(".jpg"));
|
||||
assertTrue(minecraft.getThumbnailUrl().contains("f4.bcbits.com/img/"));
|
||||
assertEquals(
|
||||
"https://chromacat248.bandcamp.com/album/minecraft-volume-alpha-cover",
|
||||
assertEquals("https://c418.bandcamp.com/album/minecraft-volume-alpha",
|
||||
minecraft.getUrl());
|
||||
|
||||
// Verify that playlist tracks counts get extracted correctly
|
||||
assertEquals(3, ((PlaylistInfoItem) minecraft).getStreamCount());
|
||||
|
||||
assertEquals(24, ((PlaylistInfoItem) minecraft).getStreamCount());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package org.schabi.newpipe.extractor.services.peertube;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.schabi.newpipe.extractor.ServiceList.PeerTube;
|
||||
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@ -9,9 +12,6 @@ import org.schabi.newpipe.extractor.NewPipe;
|
|||
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
||||
import org.schabi.newpipe.extractor.services.peertube.extractors.PeertubePlaylistExtractor;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.schabi.newpipe.extractor.ServiceList.PeerTube;
|
||||
|
||||
public class PeertubePlaylistExtractorTest {
|
||||
|
||||
public static class Shocking {
|
||||
|
@ -39,41 +39,41 @@ public class PeertubePlaylistExtractorTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
void testGetUploaderUrl() throws ParsingException {
|
||||
void testGetUploaderUrl() {
|
||||
assertEquals("https://skeptikon.fr/accounts/metadechoc", extractor.getUploaderUrl());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGetUploaderAvatarUrl() throws ParsingException {
|
||||
assertEquals(
|
||||
"https://framatube.org/lazy-static/avatars/cd0f781d-0287-4be2-94f1-24cd732337b2.jpg",
|
||||
"https://framatube.org/lazy-static/avatars/c6801ff9-cb49-42e6-b2db-3db623248115.jpg",
|
||||
extractor.getUploaderAvatarUrl());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGetUploaderName() throws ParsingException {
|
||||
void testGetUploaderName() {
|
||||
assertEquals("Méta de Choc", extractor.getUploaderName());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGetStreamCount() throws ParsingException {
|
||||
void testGetStreamCount() {
|
||||
ExtractorAsserts.assertGreaterOrEqual(39, extractor.getStreamCount());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGetSubChannelUrl() throws ParsingException {
|
||||
void testGetSubChannelUrl() {
|
||||
assertEquals("https://skeptikon.fr/video-channels/metadechoc_channel", extractor.getSubChannelUrl());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGetSubChannelName() throws ParsingException {
|
||||
void testGetSubChannelName() {
|
||||
assertEquals("SHOCKING !", extractor.getSubChannelName());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGetSubChannelAvatarUrl() throws ParsingException {
|
||||
assertEquals(
|
||||
"https://framatube.org/lazy-static/avatars/637753af-fcf2-4b61-88f9-b9857c953457.png",
|
||||
"https://framatube.org/lazy-static/avatars/e801ccce-8694-4309-b0ab-e6f0e552ef77.png",
|
||||
extractor.getSubChannelAvatarUrl());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue