1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-21 08:09:38 +01:00

fix unit tests

This commit is contained in:
Christian Schabesberger 2016-11-20 19:01:06 +01:00
parent 389959dd18
commit f575826394
7 changed files with 22 additions and 2 deletions

View File

@ -32,10 +32,15 @@ public class YoutubeChannelExtractorTest extends AndroidTestCase {
@Override
public void setUp() throws Exception {
super.setUp();
NewPipe.init(new Downloader());
extractor = NewPipe.getService("Youtube")
.getChannelExtractorInstance("https://www.youtube.com/channel/UCYJ61XIK64sp6ZFFS8sctxw", 0);
}
public void testGetDownloader() throws Exception {
assertNotNull(NewPipe.getDownloader());
}
public void testGetChannelName() throws Exception {
assertEquals(extractor.getChannelName(), "Gronkh");
}

View File

@ -2,6 +2,7 @@ package org.schabi.newpipe.extractor.youtube;
import android.test.AndroidTestCase;
import org.schabi.newpipe.Downloader;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.search.SearchEngine;
import org.schabi.newpipe.extractor.search.SearchResult;
@ -34,6 +35,7 @@ public class YoutubeSearchEngineTest extends AndroidTestCase {
@Override
public void setUp() throws Exception {
super.setUp();
NewPipe.init(new Downloader());
SearchEngine engine = NewPipe.getService("Youtube").getSearchEngineInstance();
result = engine.search("this is something boring", 0, "de").getSearchResult();

View File

@ -2,6 +2,8 @@ package org.schabi.newpipe.extractor.youtube;
import android.test.AndroidTestCase;
import org.schabi.newpipe.Downloader;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.search.SuggestionExtractor;
import org.schabi.newpipe.extractor.services.youtube.YoutubeSuggestionExtractor;
@ -35,6 +37,8 @@ public class YoutubeSearchResultTest extends AndroidTestCase {
@Override
public void setUp() throws Exception {
super.setUp();
NewPipe.init(new Downloader());
SuggestionExtractor engine = new YoutubeSuggestionExtractor(0);
suggestionReply = engine.suggestionList("hello", "de");
}

View File

@ -2,6 +2,7 @@ package org.schabi.newpipe.extractor.youtube;
import android.test.AndroidTestCase;
import org.schabi.newpipe.Downloader;
import org.schabi.newpipe.extractor.AbstractStreamInfo;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
@ -35,7 +36,9 @@ public class YoutubeStreamExtractorDefaultTest extends AndroidTestCase {
public static final String HTTPS = "https://";
private StreamExtractor extractor;
public void setUp() throws IOException, ExtractionException {
public void setUp() throws Exception {
super.setUp();
NewPipe.init(new Downloader());
extractor = NewPipe.getService("Youtube")
.getExtractorInstance("https://www.youtube.com/watch?v=YQHsXMglC9A");
}

View File

@ -39,6 +39,7 @@ public class YoutubeStreamExtractorGemaTest extends AndroidTestCase {
public void testGemaError() throws IOException, ExtractionException {
if(testActive) {
try {
NewPipe.init(new Downloader());
NewPipe.getService("Youtube")
.getExtractorInstance("https://www.youtube.com/watch?v=3O1_3zBUKM8");
} catch(YoutubeStreamExtractor.GemaException ge) {

View File

@ -37,6 +37,8 @@ public class YoutubeStreamExtractorLiveStreamTest extends AndroidTestCase {
public void setUp() throws IOException, ExtractionException {
//todo: make the extractor not throw over a livestream
/*
NewPipe.init(new Downloader());
extractor = NewPipe.getService("Youtube")
.getExtractorInstance("https://www.youtube.com/watch?v=J0s6NjqdjLE", new Downloader());
*/

View File

@ -2,6 +2,7 @@ package org.schabi.newpipe.extractor.youtube;
import android.test.AndroidTestCase;
import org.schabi.newpipe.Downloader;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
@ -14,7 +15,9 @@ public class YoutubeStreamExtractorRestrictedTest extends AndroidTestCase {
public static final String HTTPS = "https://";
private StreamExtractor extractor;
public void setUp() throws IOException, ExtractionException {
public void setUp() throws Exception {
super.setUp();
NewPipe.init(new Downloader());
extractor = NewPipe.getService("Youtube")
.getExtractorInstance("https://www.youtube.com/watch?v=i6JTvzrpBy0");
}