Fix SoundCloud tests

This commit is contained in:
Stypox 2019-08-12 17:15:21 +02:00
parent b09e402d4f
commit d14c45c948
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
1 changed files with 10 additions and 9 deletions

View File

@ -1,5 +1,6 @@
package org.schabi.newpipe.extractor.services.soundcloud; package org.schabi.newpipe.extractor.services.soundcloud;
import org.hamcrest.CoreMatchers;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
@ -119,14 +120,14 @@ public class SoundcloudPlaylistExtractorTest {
} }
} }
public static class RandomHouseDanceMusic implements BasePlaylistExtractorTest { public static class RandomHouseMusic implements BasePlaylistExtractorTest {
private static SoundcloudPlaylistExtractor extractor; private static SoundcloudPlaylistExtractor extractor;
@BeforeClass @BeforeClass
public static void setUp() throws Exception { public static void setUp() throws Exception {
NewPipe.init(Downloader.getInstance(), new Localization("GB", "en")); NewPipe.init(Downloader.getInstance(), new Localization("GB", "en"));
extractor = (SoundcloudPlaylistExtractor) SoundCloud extractor = (SoundcloudPlaylistExtractor) SoundCloud
.getPlaylistExtractor("https://soundcloud.com/hunter-leader/sets/house-electro-dance-music-2"); .getPlaylistExtractor("https://soundcloud.com/micky96/sets/house");
extractor.fetchPage(); extractor.fetchPage();
} }
@ -141,22 +142,22 @@ public class SoundcloudPlaylistExtractorTest {
@Test @Test
public void testName() { public void testName() {
assertEquals("House, Electro , Dance Music 2", extractor.getName()); assertEquals("House", extractor.getName());
} }
@Test @Test
public void testId() { public void testId() {
assertEquals("310980722", extractor.getId()); assertEquals("123062856", extractor.getId());
} }
@Test @Test
public void testUrl() throws Exception { public void testUrl() throws Exception {
assertEquals("https://soundcloud.com/hunter-leader/sets/house-electro-dance-music-2", extractor.getUrl()); assertEquals("https://soundcloud.com/micky96/sets/house", extractor.getUrl());
} }
@Test @Test
public void testOriginalUrl() throws Exception { public void testOriginalUrl() throws Exception {
assertEquals("https://soundcloud.com/hunter-leader/sets/house-electro-dance-music-2", extractor.getOriginalUrl()); assertEquals("https://soundcloud.com/micky96/sets/house", extractor.getOriginalUrl());
} }
/*////////////////////////////////////////////////////////////////////////// /*//////////////////////////////////////////////////////////////////////////
@ -182,7 +183,7 @@ public class SoundcloudPlaylistExtractorTest {
assertIsSecureUrl(extractor.getThumbnailUrl()); assertIsSecureUrl(extractor.getThumbnailUrl());
} }
@Ignore @Ignore("not implemented")
@Test @Test
public void testBannerUrl() { public void testBannerUrl() {
assertIsSecureUrl(extractor.getBannerUrl()); assertIsSecureUrl(extractor.getBannerUrl());
@ -192,12 +193,12 @@ public class SoundcloudPlaylistExtractorTest {
public void testUploaderUrl() { public void testUploaderUrl() {
final String uploaderUrl = extractor.getUploaderUrl(); final String uploaderUrl = extractor.getUploaderUrl();
assertIsSecureUrl(uploaderUrl); assertIsSecureUrl(uploaderUrl);
assertTrue(uploaderUrl, uploaderUrl.contains("hunter-leader")); assertThat(uploaderUrl, CoreMatchers.containsString("micky96"));
} }
@Test @Test
public void testUploaderName() { public void testUploaderName() {
assertEquals("Gosu", extractor.getUploaderName()); assertEquals("_mickyyy", extractor.getUploaderName());
} }
@Test @Test