2019-12-22 02:55:54 +01:00
|
|
|
// Created by Fynn Godau 2019, licensed GNU GPL version 3 or later
|
|
|
|
|
2019-12-22 00:42:26 +01:00
|
|
|
package org.schabi.newpipe.extractor.services.bandcamp;
|
|
|
|
|
|
|
|
import org.junit.BeforeClass;
|
|
|
|
import org.junit.Test;
|
|
|
|
import org.schabi.newpipe.DownloaderTestImpl;
|
|
|
|
import org.schabi.newpipe.extractor.NewPipe;
|
2020-04-20 22:06:48 +02:00
|
|
|
import org.schabi.newpipe.extractor.channel.ChannelExtractor;
|
2019-12-22 01:38:48 +01:00
|
|
|
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
2020-05-25 20:22:23 +02:00
|
|
|
import org.schabi.newpipe.extractor.services.BaseChannelExtractorTest;
|
2019-12-22 00:42:26 +01:00
|
|
|
|
2020-05-25 20:22:23 +02:00
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
import static org.junit.Assert.*;
|
2020-04-20 21:55:35 +02:00
|
|
|
import static org.schabi.newpipe.extractor.ServiceList.Bandcamp;
|
2019-12-22 00:42:26 +01:00
|
|
|
|
2020-05-25 20:22:23 +02:00
|
|
|
public class BandcampChannelExtractorTest implements BaseChannelExtractorTest {
|
2019-12-22 00:42:26 +01:00
|
|
|
|
2020-05-25 20:22:23 +02:00
|
|
|
private static ChannelExtractor extractor;
|
2019-12-22 00:42:26 +01:00
|
|
|
|
|
|
|
@BeforeClass
|
|
|
|
public static void setUp() throws Exception {
|
|
|
|
NewPipe.init(DownloaderTestImpl.getInstance());
|
2020-05-25 20:22:23 +02:00
|
|
|
extractor = Bandcamp.getChannelExtractor("https://npet.bandcamp.com/releases");
|
2020-04-20 22:06:48 +02:00
|
|
|
extractor.fetchPage();
|
2019-12-22 00:42:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
2020-05-25 20:22:23 +02:00
|
|
|
public void testLength() throws ExtractionException, IOException {
|
|
|
|
assertTrue(extractor.getInitialPage().getItems().size() >= 1);
|
2019-12-22 00:42:26 +01:00
|
|
|
}
|
|
|
|
|
2020-05-25 20:22:23 +02:00
|
|
|
@Override
|
2019-12-22 00:42:26 +01:00
|
|
|
@Test
|
2020-05-25 20:22:23 +02:00
|
|
|
public void testDescription() throws Exception {
|
|
|
|
assertEquals("This string will be tested for in NewPipeExtractor tests.", extractor.getDescription());
|
2019-12-22 00:42:26 +01:00
|
|
|
}
|
2019-12-22 01:05:34 +01:00
|
|
|
|
2020-05-25 20:22:23 +02:00
|
|
|
@Override
|
|
|
|
public void testAvatarUrl() throws Exception {
|
|
|
|
// Has no avatar
|
|
|
|
assertEquals("", extractor.getAvatarUrl());
|
2019-12-22 01:05:34 +01:00
|
|
|
}
|
2019-12-22 01:38:48 +01:00
|
|
|
|
2020-05-25 20:22:23 +02:00
|
|
|
@Override
|
|
|
|
public void testBannerUrl() throws Exception {
|
|
|
|
// Has no banner
|
|
|
|
assertEquals("", extractor.getBannerUrl());
|
2019-12-22 01:38:48 +01:00
|
|
|
}
|
|
|
|
|
2020-05-25 20:22:23 +02:00
|
|
|
@Override
|
|
|
|
public void testFeedUrl() throws Exception {
|
|
|
|
assertNull(extractor.getFeedUrl());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void testSubscriberCount() throws Exception {
|
|
|
|
assertEquals(-1, extractor.getSubscriberCount());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void testRelatedItems() throws Exception {
|
|
|
|
// not implemented
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void testMoreRelatedItems() throws Exception {
|
|
|
|
// not implemented
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2020-11-19 22:33:52 +01:00
|
|
|
public void testServiceId() {
|
|
|
|
assertEquals(Bandcamp.getServiceId(), extractor.getServiceId());
|
2020-05-25 20:22:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void testName() throws Exception {
|
|
|
|
assertEquals("NewPipeExtractorTest", extractor.getName());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void testId() throws Exception {
|
|
|
|
assertEquals("https://npet.bandcamp.com/", extractor.getId());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void testUrl() throws Exception {
|
|
|
|
assertEquals("https://npet.bandcamp.com/releases", extractor.getUrl());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void testOriginalUrl() throws Exception {
|
|
|
|
assertEquals("https://npet.bandcamp.com/releases", extractor.getUrl());
|
2019-12-22 01:38:48 +01:00
|
|
|
}
|
2019-12-22 00:42:26 +01:00
|
|
|
}
|