Merge branch 'master' into dev
This commit is contained in:
@@ -17,13 +17,15 @@ public class SoundcloudParsingHelperTest {
|
||||
@Test
|
||||
public void assertThatHardcodedClientIdIsValid() throws Exception {
|
||||
assertTrue("Hardcoded client id is not valid anymore",
|
||||
SoundcloudParsingHelper.checkIfHardcodedClientIdIsValid(DownloaderTestImpl.getInstance()));
|
||||
SoundcloudParsingHelper.checkIfHardcodedClientIdIsValid());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveUrlWithEmbedPlayerTest() throws Exception {
|
||||
Assert.assertEquals("https://soundcloud.com/trapcity", SoundcloudParsingHelper.resolveUrlWithEmbedPlayer("https://api.soundcloud.com/users/26057743"));
|
||||
Assert.assertEquals("https://soundcloud.com/nocopyrightsounds", SoundcloudParsingHelper.resolveUrlWithEmbedPlayer("https://api.soundcloud.com/users/16069159"));
|
||||
Assert.assertEquals("https://soundcloud.com/trapcity", SoundcloudParsingHelper.resolveUrlWithEmbedPlayer("https://api-v2.soundcloud.com/users/26057743"));
|
||||
Assert.assertEquals("https://soundcloud.com/nocopyrightsounds", SoundcloudParsingHelper.resolveUrlWithEmbedPlayer("https://api-v2.soundcloud.com/users/16069159"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package org.schabi.newpipe.extractor.services.soundcloud;
|
||||
|
||||
import org.hamcrest.CoreMatchers;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.schabi.newpipe.DownloaderTestImpl;
|
||||
import org.schabi.newpipe.extractor.ListExtractor;
|
||||
@@ -11,6 +9,7 @@ import org.schabi.newpipe.extractor.playlist.PlaylistExtractor;
|
||||
import org.schabi.newpipe.extractor.services.BasePlaylistExtractorTest;
|
||||
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertIsSecureUrl;
|
||||
import static org.schabi.newpipe.extractor.ServiceList.SoundCloud;
|
||||
@@ -70,14 +69,8 @@ public class SoundcloudPlaylistExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMoreRelatedItems() {
|
||||
try {
|
||||
defaultTestMoreItems(extractor);
|
||||
} catch (Throwable ignored) {
|
||||
return;
|
||||
}
|
||||
|
||||
fail("This playlist doesn't have more items, it should throw an error");
|
||||
public void testMoreRelatedItems() throws Exception {
|
||||
defaultTestMoreItems(extractor);
|
||||
}
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////
|
||||
@@ -89,17 +82,17 @@ public class SoundcloudPlaylistExtractorTest {
|
||||
assertIsSecureUrl(extractor.getThumbnailUrl());
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void testBannerUrl() {
|
||||
assertIsSecureUrl(extractor.getBannerUrl());
|
||||
// SoundCloud playlists do not have a banner
|
||||
assertNull(extractor.getBannerUrl());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUploaderUrl() {
|
||||
final String uploaderUrl = extractor.getUploaderUrl();
|
||||
assertIsSecureUrl(uploaderUrl);
|
||||
assertTrue(uploaderUrl, uploaderUrl.contains("liluzivert"));
|
||||
assertThat(uploaderUrl, containsString("liluzivert"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -114,7 +107,7 @@ public class SoundcloudPlaylistExtractorTest {
|
||||
|
||||
@Test
|
||||
public void testStreamCount() {
|
||||
assertTrue("Error in the streams count", extractor.getStreamCount() >= 10);
|
||||
assertTrue("Stream count does not fit: " + extractor.getStreamCount(), extractor.getStreamCount() >= 10);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,17 +174,17 @@ public class SoundcloudPlaylistExtractorTest {
|
||||
assertIsSecureUrl(extractor.getThumbnailUrl());
|
||||
}
|
||||
|
||||
@Ignore("not implemented")
|
||||
@Test
|
||||
public void testBannerUrl() {
|
||||
assertIsSecureUrl(extractor.getBannerUrl());
|
||||
// SoundCloud playlists do not have a banner
|
||||
assertNull(extractor.getBannerUrl());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUploaderUrl() {
|
||||
final String uploaderUrl = extractor.getUploaderUrl();
|
||||
assertIsSecureUrl(uploaderUrl);
|
||||
assertThat(uploaderUrl, CoreMatchers.containsString("micky96"));
|
||||
assertThat(uploaderUrl, containsString("micky96"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -206,7 +199,7 @@ public class SoundcloudPlaylistExtractorTest {
|
||||
|
||||
@Test
|
||||
public void testStreamCount() {
|
||||
assertTrue("Error in the streams count", extractor.getStreamCount() >= 10);
|
||||
assertTrue("Stream count does not fit: " + extractor.getStreamCount(), extractor.getStreamCount() >= 10);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,7 +220,7 @@ public class SoundcloudPlaylistExtractorTest {
|
||||
|
||||
@Test
|
||||
public void testGetPageInNewExtractor() throws Exception {
|
||||
final PlaylistExtractor newExtractor = SoundCloud.getPlaylistExtractor(extractor.getUrl());
|
||||
PlaylistExtractor newExtractor = SoundCloud.getPlaylistExtractor(extractor.getUrl());
|
||||
defaultTestGetPageInNewExtractor(extractor, newExtractor);
|
||||
}
|
||||
|
||||
@@ -264,14 +257,11 @@ public class SoundcloudPlaylistExtractorTest {
|
||||
// ListExtractor
|
||||
//////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void testRelatedItems() throws Exception {
|
||||
defaultTestRelatedItems(extractor);
|
||||
}
|
||||
|
||||
//TODO: FUCK THIS: This triggers a 500 at sever
|
||||
@Ignore
|
||||
@Test
|
||||
public void testMoreRelatedItems() throws Exception {
|
||||
ListExtractor.InfoItemsPage<StreamInfoItem> currentPage = defaultTestMoreItems(extractor);
|
||||
@@ -286,16 +276,15 @@ public class SoundcloudPlaylistExtractorTest {
|
||||
// PlaylistExtractor
|
||||
//////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void testThumbnailUrl() {
|
||||
assertIsSecureUrl(extractor.getThumbnailUrl());
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void testBannerUrl() {
|
||||
assertIsSecureUrl(extractor.getBannerUrl());
|
||||
// SoundCloud playlists do not have a banner
|
||||
assertNull(extractor.getBannerUrl());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -317,7 +306,105 @@ public class SoundcloudPlaylistExtractorTest {
|
||||
|
||||
@Test
|
||||
public void testStreamCount() {
|
||||
assertTrue("Error in the streams count", extractor.getStreamCount() >= 3900);
|
||||
assertTrue("Stream count does not fit: " + extractor.getStreamCount(), extractor.getStreamCount() >= 370);
|
||||
}
|
||||
}
|
||||
|
||||
public static class SmallPlaylist implements BasePlaylistExtractorTest {
|
||||
private static SoundcloudPlaylistExtractor extractor;
|
||||
|
||||
@BeforeClass
|
||||
public static void setUp() throws Exception {
|
||||
NewPipe.init(DownloaderTestImpl.getInstance());
|
||||
extractor = (SoundcloudPlaylistExtractor) SoundCloud
|
||||
.getPlaylistExtractor("https://soundcloud.com/breezy-123/sets/empty-playlist?test=123");
|
||||
extractor.fetchPage();
|
||||
}
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////
|
||||
// Extractor
|
||||
//////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
@Test
|
||||
public void testServiceId() {
|
||||
assertEquals(SoundCloud.getServiceId(), extractor.getServiceId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testName() {
|
||||
assertEquals("EMPTY PLAYLIST", extractor.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testId() {
|
||||
assertEquals("23483459", extractor.getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUrl() throws Exception {
|
||||
assertEquals("https://soundcloud.com/breezy-123/sets/empty-playlist", extractor.getUrl());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOriginalUrl() throws Exception {
|
||||
assertEquals("https://soundcloud.com/breezy-123/sets/empty-playlist?test=123", extractor.getOriginalUrl());
|
||||
}
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////
|
||||
// ListExtractor
|
||||
//////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
@Test
|
||||
public void testRelatedItems() throws Exception {
|
||||
defaultTestRelatedItems(extractor);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMoreRelatedItems() throws Exception {
|
||||
try {
|
||||
defaultTestMoreItems(extractor);
|
||||
} catch (Throwable ignored) {
|
||||
return;
|
||||
}
|
||||
|
||||
fail("This playlist doesn't have more items, it should throw an error");
|
||||
}
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////
|
||||
// PlaylistExtractor
|
||||
//////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
@Test
|
||||
public void testThumbnailUrl() {
|
||||
assertIsSecureUrl(extractor.getThumbnailUrl());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBannerUrl() {
|
||||
// SoundCloud playlists do not have a banner
|
||||
assertNull(extractor.getBannerUrl());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUploaderUrl() {
|
||||
final String uploaderUrl = extractor.getUploaderUrl();
|
||||
assertIsSecureUrl(uploaderUrl);
|
||||
assertThat(uploaderUrl, containsString("breezy-123"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUploaderName() {
|
||||
assertEquals("breezy-123", extractor.getUploaderName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUploaderAvatarUrl() {
|
||||
assertIsSecureUrl(extractor.getUploaderAvatarUrl());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStreamCount() {
|
||||
assertEquals(2, extractor.getStreamCount());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public class SoundcloudStreamExtractorDefaultTest {
|
||||
|
||||
@Test
|
||||
public void testGetTextualUploadDate() throws ParsingException {
|
||||
Assert.assertEquals("2016/07/31 18:18:07 +0000", extractor.getTextualUploadDate());
|
||||
Assert.assertEquals("2016-07-31 18:18:07", extractor.getTextualUploadDate());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user