[SoundCloud] Implement link handlers and channels tabs and tags changes on tests
Co-authored-by: ThetaDev <t.testboy@gmail.com>
This commit is contained in:
parent
0ee2072de5
commit
eaf2600ce0
|
@ -4,7 +4,7 @@ import org.junit.jupiter.api.BeforeAll;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.schabi.newpipe.downloader.DownloaderTestImpl;
|
import org.schabi.newpipe.downloader.DownloaderTestImpl;
|
||||||
import org.schabi.newpipe.extractor.NewPipe;
|
import org.schabi.newpipe.extractor.NewPipe;
|
||||||
import org.schabi.newpipe.extractor.channel.ChannelExtractor;
|
import org.schabi.newpipe.extractor.channel.tabs.ChannelTabs;
|
||||||
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
||||||
import org.schabi.newpipe.extractor.services.BaseChannelExtractorTest;
|
import org.schabi.newpipe.extractor.services.BaseChannelExtractorTest;
|
||||||
import org.schabi.newpipe.extractor.services.soundcloud.extractors.SoundcloudChannelExtractor;
|
import org.schabi.newpipe.extractor.services.soundcloud.extractors.SoundcloudChannelExtractor;
|
||||||
|
@ -12,8 +12,8 @@ import org.schabi.newpipe.extractor.services.soundcloud.extractors.SoundcloudCha
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertEmpty;
|
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertEmpty;
|
||||||
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertIsSecureUrl;
|
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertIsSecureUrl;
|
||||||
|
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertTabsContained;
|
||||||
import static org.schabi.newpipe.extractor.ServiceList.SoundCloud;
|
import static org.schabi.newpipe.extractor.ServiceList.SoundCloud;
|
||||||
import static org.schabi.newpipe.extractor.services.DefaultTests.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for {@link SoundcloudChannelExtractor}
|
* Test for {@link SoundcloudChannelExtractor}
|
||||||
|
@ -59,20 +59,6 @@ public class SoundcloudChannelExtractorTest {
|
||||||
assertEquals("http://soundcloud.com/liluzivert/sets", extractor.getOriginalUrl());
|
assertEquals("http://soundcloud.com/liluzivert/sets", extractor.getOriginalUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*//////////////////////////////////////////////////////////////////////////
|
|
||||||
// ListExtractor
|
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testRelatedItems() throws Exception {
|
|
||||||
defaultTestRelatedItems(extractor);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testMoreRelatedItems() throws Exception {
|
|
||||||
defaultTestMoreItems(extractor);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*//////////////////////////////////////////////////////////////////////////
|
/*//////////////////////////////////////////////////////////////////////////
|
||||||
// ChannelExtractor
|
// ChannelExtractor
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
@ -106,6 +92,19 @@ public class SoundcloudChannelExtractorTest {
|
||||||
public void testVerified() throws Exception {
|
public void testVerified() throws Exception {
|
||||||
assertTrue(extractor.isVerified());
|
assertTrue(extractor.isVerified());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Override
|
||||||
|
public void testTabs() throws Exception {
|
||||||
|
assertTabsContained(extractor.getTabs(), ChannelTabs.TRACKS, ChannelTabs.PLAYLISTS,
|
||||||
|
ChannelTabs.ALBUMS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Override
|
||||||
|
public void testTags() throws Exception {
|
||||||
|
assertTrue(extractor.getTags().isEmpty());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class DubMatix implements BaseChannelExtractorTest {
|
public static class DubMatix implements BaseChannelExtractorTest {
|
||||||
|
@ -119,16 +118,6 @@ public class SoundcloudChannelExtractorTest {
|
||||||
extractor.fetchPage();
|
extractor.fetchPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*//////////////////////////////////////////////////////////////////////////
|
|
||||||
// Additional Testing
|
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testGetPageInNewExtractor() throws Exception {
|
|
||||||
final ChannelExtractor newExtractor = SoundCloud.getChannelExtractor(extractor.getUrl());
|
|
||||||
defaultTestGetPageInNewExtractor(extractor, newExtractor);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*//////////////////////////////////////////////////////////////////////////
|
/*//////////////////////////////////////////////////////////////////////////
|
||||||
// Extractor
|
// Extractor
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
@ -158,20 +147,6 @@ public class SoundcloudChannelExtractorTest {
|
||||||
assertEquals("https://soundcloud.com/dubmatix", extractor.getOriginalUrl());
|
assertEquals("https://soundcloud.com/dubmatix", extractor.getOriginalUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*//////////////////////////////////////////////////////////////////////////
|
|
||||||
// ListExtractor
|
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testRelatedItems() throws Exception {
|
|
||||||
defaultTestRelatedItems(extractor);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testMoreRelatedItems() throws Exception {
|
|
||||||
defaultTestMoreItems(extractor);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*//////////////////////////////////////////////////////////////////////////
|
/*//////////////////////////////////////////////////////////////////////////
|
||||||
// ChannelExtractor
|
// ChannelExtractor
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
@ -205,5 +180,18 @@ public class SoundcloudChannelExtractorTest {
|
||||||
public void testVerified() throws Exception {
|
public void testVerified() throws Exception {
|
||||||
assertTrue(extractor.isVerified());
|
assertTrue(extractor.isVerified());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Override
|
||||||
|
public void testTabs() throws Exception {
|
||||||
|
assertTabsContained(extractor.getTabs(), ChannelTabs.TRACKS, ChannelTabs.PLAYLISTS,
|
||||||
|
ChannelTabs.ALBUMS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Override
|
||||||
|
public void testTags() throws Exception {
|
||||||
|
assertTrue(extractor.getTags().isEmpty());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,196 @@
|
||||||
|
package org.schabi.newpipe.extractor.services.soundcloud;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.schabi.newpipe.downloader.DownloaderTestImpl;
|
||||||
|
import org.schabi.newpipe.extractor.NewPipe;
|
||||||
|
import org.schabi.newpipe.extractor.channel.tabs.ChannelTabExtractor;
|
||||||
|
import org.schabi.newpipe.extractor.channel.tabs.ChannelTabs;
|
||||||
|
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
||||||
|
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
||||||
|
import org.schabi.newpipe.extractor.services.BaseListExtractorTest;
|
||||||
|
import org.schabi.newpipe.extractor.services.soundcloud.extractors.SoundcloudChannelTabExtractor;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.schabi.newpipe.extractor.ServiceList.SoundCloud;
|
||||||
|
import static org.schabi.newpipe.extractor.services.DefaultTests.defaultTestGetPageInNewExtractor;
|
||||||
|
import static org.schabi.newpipe.extractor.services.DefaultTests.defaultTestMoreItems;
|
||||||
|
import static org.schabi.newpipe.extractor.services.DefaultTests.defaultTestRelatedItems;
|
||||||
|
|
||||||
|
class SoundcloudChannelTabExtractorTest {
|
||||||
|
|
||||||
|
static class Tracks implements BaseListExtractorTest {
|
||||||
|
private static SoundcloudChannelTabExtractor extractor;
|
||||||
|
|
||||||
|
@BeforeAll
|
||||||
|
static void setUp() throws IOException, ExtractionException {
|
||||||
|
NewPipe.init(DownloaderTestImpl.getInstance());
|
||||||
|
extractor = (SoundcloudChannelTabExtractor) SoundCloud
|
||||||
|
.getChannelTabExtractorFromId("10494998", ChannelTabs.TRACKS);
|
||||||
|
extractor.fetchPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Override
|
||||||
|
public void testServiceId() throws Exception {
|
||||||
|
assertEquals(SoundCloud.getServiceId(), extractor.getServiceId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Override
|
||||||
|
public void testName() throws Exception {
|
||||||
|
assertEquals(ChannelTabs.TRACKS, extractor.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Override
|
||||||
|
public void testId() throws Exception {
|
||||||
|
assertEquals("10494998", extractor.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Override
|
||||||
|
public void testUrl() throws Exception {
|
||||||
|
assertEquals("https://soundcloud.com/liluzivert/tracks", extractor.getUrl());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Override
|
||||||
|
public void testOriginalUrl() throws Exception {
|
||||||
|
assertEquals("https://soundcloud.com/liluzivert/tracks", extractor.getOriginalUrl());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Override
|
||||||
|
public void testRelatedItems() throws Exception {
|
||||||
|
defaultTestRelatedItems(extractor);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Override
|
||||||
|
public void testMoreRelatedItems() throws Exception {
|
||||||
|
defaultTestMoreItems(extractor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*//////////////////////////////////////////////////////////////////////////
|
||||||
|
// Additional Testing
|
||||||
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testGetPageInNewExtractor() throws Exception {
|
||||||
|
final ChannelTabExtractor newTabExtractor =
|
||||||
|
SoundCloud.getChannelTabExtractorFromId("10494998", ChannelTabs.TRACKS);
|
||||||
|
defaultTestGetPageInNewExtractor(extractor, newTabExtractor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static class Playlists implements BaseListExtractorTest {
|
||||||
|
private static SoundcloudChannelTabExtractor extractor;
|
||||||
|
|
||||||
|
@BeforeAll
|
||||||
|
static void setUp() throws IOException, ExtractionException {
|
||||||
|
NewPipe.init(DownloaderTestImpl.getInstance());
|
||||||
|
extractor = (SoundcloudChannelTabExtractor) SoundCloud
|
||||||
|
.getChannelTabExtractorFromId("323371733", ChannelTabs.PLAYLISTS);
|
||||||
|
extractor.fetchPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Override
|
||||||
|
public void testServiceId() {
|
||||||
|
assertEquals(SoundCloud.getServiceId(), extractor.getServiceId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Override
|
||||||
|
public void testName() throws Exception {
|
||||||
|
assertEquals(ChannelTabs.PLAYLISTS, extractor.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Override
|
||||||
|
public void testId() throws ParsingException {
|
||||||
|
assertEquals("323371733", extractor.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Override
|
||||||
|
public void testUrl() throws ParsingException {
|
||||||
|
assertEquals("https://soundcloud.com/trackaholic/sets", extractor.getUrl());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Override
|
||||||
|
public void testOriginalUrl() throws Exception {
|
||||||
|
assertEquals("https://soundcloud.com/trackaholic/sets", extractor.getOriginalUrl());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Override
|
||||||
|
public void testRelatedItems() throws Exception {
|
||||||
|
defaultTestRelatedItems(extractor);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Override
|
||||||
|
public void testMoreRelatedItems() throws Exception {
|
||||||
|
defaultTestMoreItems(extractor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static class Albums implements BaseListExtractorTest {
|
||||||
|
private static SoundcloudChannelTabExtractor extractor;
|
||||||
|
|
||||||
|
@BeforeAll
|
||||||
|
static void setUp() throws IOException, ExtractionException {
|
||||||
|
NewPipe.init(DownloaderTestImpl.getInstance());
|
||||||
|
extractor = (SoundcloudChannelTabExtractor) SoundCloud
|
||||||
|
.getChannelTabExtractorFromId("4803918", ChannelTabs.ALBUMS);
|
||||||
|
extractor.fetchPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Override
|
||||||
|
public void testServiceId() {
|
||||||
|
assertEquals(SoundCloud.getServiceId(), extractor.getServiceId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Override
|
||||||
|
public void testName() throws Exception {
|
||||||
|
assertEquals(ChannelTabs.ALBUMS, extractor.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Override
|
||||||
|
public void testId() throws ParsingException {
|
||||||
|
assertEquals("4803918", extractor.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Override
|
||||||
|
public void testUrl() throws ParsingException {
|
||||||
|
assertEquals("https://soundcloud.com/bigsean-1/albums", extractor.getUrl());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Override
|
||||||
|
public void testOriginalUrl() throws Exception {
|
||||||
|
assertEquals("https://soundcloud.com/bigsean-1/albums", extractor.getOriginalUrl());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Override
|
||||||
|
public void testRelatedItems() throws Exception {
|
||||||
|
defaultTestRelatedItems(extractor);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Override
|
||||||
|
public void testMoreRelatedItems() throws Exception {
|
||||||
|
defaultTestMoreItems(extractor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,7 +19,7 @@ public class SoundcloudChartsLinkHandlerFactoryTest {
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public static void setUp() {
|
public static void setUp() {
|
||||||
linkHandler = new SoundcloudChartsLinkHandlerFactory();
|
linkHandler = SoundcloudChartsLinkHandlerFactory.getInstance();
|
||||||
NewPipe.init(DownloaderTestImpl.getInstance());
|
NewPipe.init(DownloaderTestImpl.getInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue