2017-08-08 08:42:28 +02:00
|
|
|
package org.schabi.newpipe.extractor.services.soundcloud;
|
|
|
|
|
2017-12-07 02:09:46 +01:00
|
|
|
import org.junit.BeforeClass;
|
2017-08-08 08:42:28 +02:00
|
|
|
import org.junit.Test;
|
2018-03-04 21:26:13 +01:00
|
|
|
import org.junit.experimental.runners.Enclosed;
|
|
|
|
import org.junit.runner.RunWith;
|
2017-08-08 08:42:28 +02:00
|
|
|
import org.schabi.newpipe.Downloader;
|
|
|
|
import org.schabi.newpipe.extractor.NewPipe;
|
2017-08-11 03:23:09 +02:00
|
|
|
import org.schabi.newpipe.extractor.channel.ChannelExtractor;
|
2018-03-04 21:26:13 +01:00
|
|
|
import org.schabi.newpipe.extractor.services.BaseChannelExtractorTest;
|
|
|
|
import org.schabi.newpipe.extractor.services.BaseListExtractorTest;
|
2017-08-08 08:42:28 +02:00
|
|
|
|
2017-08-08 17:01:50 +02:00
|
|
|
import static org.junit.Assert.*;
|
2018-03-04 21:26:13 +01:00
|
|
|
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertEmpty;
|
2018-01-04 17:21:03 +01:00
|
|
|
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertIsSecureUrl;
|
2017-08-08 17:01:50 +02:00
|
|
|
import static org.schabi.newpipe.extractor.ServiceList.SoundCloud;
|
|
|
|
|
2017-08-08 08:42:28 +02:00
|
|
|
/**
|
2018-03-04 21:26:13 +01:00
|
|
|
* Test for {@link SoundcloudChannelExtractor}
|
2017-08-08 08:42:28 +02:00
|
|
|
*/
|
2018-03-04 21:26:13 +01:00
|
|
|
@RunWith(Enclosed.class)
|
2017-08-11 03:23:09 +02:00
|
|
|
public class SoundcloudChannelExtractorTest {
|
2018-03-04 21:26:13 +01:00
|
|
|
public static class LilUzi implements BaseChannelExtractorTest {
|
|
|
|
private static SoundcloudChannelExtractor extractor;
|
|
|
|
|
|
|
|
@BeforeClass
|
|
|
|
public static void setUp() throws Exception {
|
|
|
|
NewPipe.init(Downloader.getInstance());
|
|
|
|
extractor = (SoundcloudChannelExtractor) SoundCloud
|
|
|
|
.getChannelExtractor("http://soundcloud.com/liluzivert/sets");
|
|
|
|
extractor.fetchPage();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Extractor
|
|
|
|
//////////////////////////////////////////////////////////////////////////*/
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testServiceId() {
|
|
|
|
assertEquals(SoundCloud.getServiceId(), extractor.getServiceId());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testName() {
|
|
|
|
assertEquals("LIL UZI VERT", extractor.getName());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testId() {
|
|
|
|
assertEquals("10494998", extractor.getId());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testCleanUrl() {
|
|
|
|
assertEquals("https://soundcloud.com/liluzivert", extractor.getCleanUrl());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testOriginalUrl() {
|
|
|
|
assertEquals("http://soundcloud.com/liluzivert/sets", extractor.getOriginalUrl());
|
|
|
|
}
|
|
|
|
|
|
|
|
/*//////////////////////////////////////////////////////////////////////////
|
|
|
|
// ListExtractor
|
|
|
|
//////////////////////////////////////////////////////////////////////////*/
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testRelatedItems() throws Exception {
|
|
|
|
BaseListExtractorTest.defaultTestRelatedItems(extractor, SoundCloud.getServiceId());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testMoreRelatedItems() throws Exception {
|
|
|
|
BaseListExtractorTest.defaultTestMoreItems(extractor, SoundCloud.getServiceId());
|
|
|
|
}
|
|
|
|
|
|
|
|
/*//////////////////////////////////////////////////////////////////////////
|
|
|
|
// ChannelExtractor
|
|
|
|
//////////////////////////////////////////////////////////////////////////*/
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testDescription() {
|
|
|
|
assertNotNull(extractor.getDescription());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testAvatarUrl() {
|
|
|
|
assertIsSecureUrl(extractor.getAvatarUrl());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testBannerUrl() {
|
|
|
|
assertIsSecureUrl(extractor.getBannerUrl());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testFeedUrl() {
|
|
|
|
assertEmpty(extractor.getFeedUrl());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testSubscriberCount() {
|
|
|
|
assertTrue("Wrong subscriber count", extractor.getSubscriberCount() >= 1e6);
|
|
|
|
}
|
2017-08-08 08:42:28 +02:00
|
|
|
}
|
|
|
|
|
2018-03-04 21:26:13 +01:00
|
|
|
public static class DubMatix implements BaseChannelExtractorTest {
|
|
|
|
private static SoundcloudChannelExtractor extractor;
|
|
|
|
|
|
|
|
@BeforeClass
|
|
|
|
public static void setUp() throws Exception {
|
|
|
|
NewPipe.init(Downloader.getInstance());
|
|
|
|
extractor = (SoundcloudChannelExtractor) SoundCloud
|
|
|
|
.getChannelExtractor("https://soundcloud.com/dubmatix");
|
|
|
|
extractor.fetchPage();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Additional Testing
|
|
|
|
//////////////////////////////////////////////////////////////////////////*/
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testGetPageInNewExtractor() throws Exception {
|
|
|
|
final ChannelExtractor newExtractor = SoundCloud.getChannelExtractor(extractor.getCleanUrl());
|
|
|
|
BaseListExtractorTest.defaultTestGetPageInNewExtractor(extractor, newExtractor, SoundCloud.getServiceId());
|
|
|
|
}
|
|
|
|
|
|
|
|
/*//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Extractor
|
|
|
|
//////////////////////////////////////////////////////////////////////////*/
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testServiceId() {
|
|
|
|
assertEquals(SoundCloud.getServiceId(), extractor.getServiceId());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testName() {
|
|
|
|
assertEquals("dubmatix", extractor.getName());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testId() {
|
|
|
|
assertEquals("542134", extractor.getId());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testCleanUrl() {
|
|
|
|
assertEquals("https://soundcloud.com/dubmatix", extractor.getCleanUrl());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testOriginalUrl() {
|
|
|
|
assertEquals("https://soundcloud.com/dubmatix", extractor.getOriginalUrl());
|
|
|
|
}
|
|
|
|
|
|
|
|
/*//////////////////////////////////////////////////////////////////////////
|
|
|
|
// ListExtractor
|
|
|
|
//////////////////////////////////////////////////////////////////////////*/
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testRelatedItems() throws Exception {
|
|
|
|
BaseListExtractorTest.defaultTestRelatedItems(extractor, SoundCloud.getServiceId());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testMoreRelatedItems() throws Exception {
|
|
|
|
BaseListExtractorTest.defaultTestMoreItems(extractor, SoundCloud.getServiceId());
|
|
|
|
}
|
|
|
|
|
|
|
|
/*//////////////////////////////////////////////////////////////////////////
|
|
|
|
// ChannelExtractor
|
|
|
|
//////////////////////////////////////////////////////////////////////////*/
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testDescription() {
|
|
|
|
assertNotNull(extractor.getDescription());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testAvatarUrl() {
|
|
|
|
assertIsSecureUrl(extractor.getAvatarUrl());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testBannerUrl() {
|
|
|
|
assertIsSecureUrl(extractor.getBannerUrl());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testFeedUrl() {
|
|
|
|
assertEmpty(extractor.getFeedUrl());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testSubscriberCount() {
|
|
|
|
assertTrue("Wrong subscriber count", extractor.getSubscriberCount() >= 2e6);
|
|
|
|
}
|
2017-08-08 08:42:28 +02:00
|
|
|
}
|
|
|
|
}
|