50 lines
2.2 KiB
Java
50 lines
2.2 KiB
Java
package org.schabi.newpipe.extractor.services.soundcloud;
|
|
|
|
import org.junit.Assert;
|
|
import org.junit.BeforeClass;
|
|
import org.junit.Test;
|
|
import org.schabi.newpipe.downloader.DownloaderTestImpl;
|
|
import org.schabi.newpipe.extractor.NewPipe;
|
|
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
|
|
|
import static org.junit.Assert.assertEquals;
|
|
import static org.junit.Assert.assertTrue;
|
|
|
|
import java.io.IOException;
|
|
|
|
public class SoundcloudParsingHelperTest {
|
|
@BeforeClass
|
|
public static void setUp() {
|
|
NewPipe.init(DownloaderTestImpl.getInstance());
|
|
}
|
|
|
|
@Test
|
|
public void assertThatHardcodedClientIdIsValid() throws Exception {
|
|
assertTrue("Hardcoded client id is not valid anymore",
|
|
SoundcloudParsingHelper.checkIfHardcodedClientIdIsValid());
|
|
}
|
|
|
|
@Test
|
|
public void assertHardCodedClientIdMatchesCurrentClientId() throws IOException, ExtractionException {
|
|
assertEquals(
|
|
"Hardcoded client doesn't match extracted clientId",
|
|
SoundcloudParsingHelper.HARDCODED_CLIENT_ID,
|
|
SoundcloudParsingHelper.clientId());
|
|
}
|
|
|
|
@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
|
|
public void resolveIdWithWidgetApiTest() throws Exception {
|
|
Assert.assertEquals("26057743", SoundcloudParsingHelper.resolveIdWithWidgetApi("https://soundcloud.com/trapcity"));
|
|
Assert.assertEquals("16069159", SoundcloudParsingHelper.resolveIdWithWidgetApi("https://soundcloud.com/nocopyrightsounds"));
|
|
|
|
}
|
|
|
|
} |