mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-24 09:00:31 +00:00
fix unit tests
This commit is contained in:
parent
389959dd18
commit
f575826394
@ -32,10 +32,15 @@ public class YoutubeChannelExtractorTest extends AndroidTestCase {
|
|||||||
@Override
|
@Override
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
NewPipe.init(new Downloader());
|
||||||
extractor = NewPipe.getService("Youtube")
|
extractor = NewPipe.getService("Youtube")
|
||||||
.getChannelExtractorInstance("https://www.youtube.com/channel/UCYJ61XIK64sp6ZFFS8sctxw", 0);
|
.getChannelExtractorInstance("https://www.youtube.com/channel/UCYJ61XIK64sp6ZFFS8sctxw", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testGetDownloader() throws Exception {
|
||||||
|
assertNotNull(NewPipe.getDownloader());
|
||||||
|
}
|
||||||
|
|
||||||
public void testGetChannelName() throws Exception {
|
public void testGetChannelName() throws Exception {
|
||||||
assertEquals(extractor.getChannelName(), "Gronkh");
|
assertEquals(extractor.getChannelName(), "Gronkh");
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package org.schabi.newpipe.extractor.youtube;
|
|||||||
|
|
||||||
import android.test.AndroidTestCase;
|
import android.test.AndroidTestCase;
|
||||||
|
|
||||||
|
import org.schabi.newpipe.Downloader;
|
||||||
import org.schabi.newpipe.extractor.NewPipe;
|
import org.schabi.newpipe.extractor.NewPipe;
|
||||||
import org.schabi.newpipe.extractor.search.SearchEngine;
|
import org.schabi.newpipe.extractor.search.SearchEngine;
|
||||||
import org.schabi.newpipe.extractor.search.SearchResult;
|
import org.schabi.newpipe.extractor.search.SearchResult;
|
||||||
@ -34,6 +35,7 @@ public class YoutubeSearchEngineTest extends AndroidTestCase {
|
|||||||
@Override
|
@Override
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
NewPipe.init(new Downloader());
|
||||||
SearchEngine engine = NewPipe.getService("Youtube").getSearchEngineInstance();
|
SearchEngine engine = NewPipe.getService("Youtube").getSearchEngineInstance();
|
||||||
|
|
||||||
result = engine.search("this is something boring", 0, "de").getSearchResult();
|
result = engine.search("this is something boring", 0, "de").getSearchResult();
|
||||||
|
@ -2,6 +2,8 @@ package org.schabi.newpipe.extractor.youtube;
|
|||||||
|
|
||||||
import android.test.AndroidTestCase;
|
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.ExtractionException;
|
||||||
import org.schabi.newpipe.extractor.search.SuggestionExtractor;
|
import org.schabi.newpipe.extractor.search.SuggestionExtractor;
|
||||||
import org.schabi.newpipe.extractor.services.youtube.YoutubeSuggestionExtractor;
|
import org.schabi.newpipe.extractor.services.youtube.YoutubeSuggestionExtractor;
|
||||||
@ -35,6 +37,8 @@ public class YoutubeSearchResultTest extends AndroidTestCase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
|
super.setUp();
|
||||||
|
NewPipe.init(new Downloader());
|
||||||
SuggestionExtractor engine = new YoutubeSuggestionExtractor(0);
|
SuggestionExtractor engine = new YoutubeSuggestionExtractor(0);
|
||||||
suggestionReply = engine.suggestionList("hello", "de");
|
suggestionReply = engine.suggestionList("hello", "de");
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package org.schabi.newpipe.extractor.youtube;
|
|||||||
|
|
||||||
import android.test.AndroidTestCase;
|
import android.test.AndroidTestCase;
|
||||||
|
|
||||||
|
import org.schabi.newpipe.Downloader;
|
||||||
import org.schabi.newpipe.extractor.AbstractStreamInfo;
|
import org.schabi.newpipe.extractor.AbstractStreamInfo;
|
||||||
import org.schabi.newpipe.extractor.NewPipe;
|
import org.schabi.newpipe.extractor.NewPipe;
|
||||||
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
||||||
@ -35,7 +36,9 @@ public class YoutubeStreamExtractorDefaultTest extends AndroidTestCase {
|
|||||||
public static final String HTTPS = "https://";
|
public static final String HTTPS = "https://";
|
||||||
private StreamExtractor extractor;
|
private StreamExtractor extractor;
|
||||||
|
|
||||||
public void setUp() throws IOException, ExtractionException {
|
public void setUp() throws Exception {
|
||||||
|
super.setUp();
|
||||||
|
NewPipe.init(new Downloader());
|
||||||
extractor = NewPipe.getService("Youtube")
|
extractor = NewPipe.getService("Youtube")
|
||||||
.getExtractorInstance("https://www.youtube.com/watch?v=YQHsXMglC9A");
|
.getExtractorInstance("https://www.youtube.com/watch?v=YQHsXMglC9A");
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ public class YoutubeStreamExtractorGemaTest extends AndroidTestCase {
|
|||||||
public void testGemaError() throws IOException, ExtractionException {
|
public void testGemaError() throws IOException, ExtractionException {
|
||||||
if(testActive) {
|
if(testActive) {
|
||||||
try {
|
try {
|
||||||
|
NewPipe.init(new Downloader());
|
||||||
NewPipe.getService("Youtube")
|
NewPipe.getService("Youtube")
|
||||||
.getExtractorInstance("https://www.youtube.com/watch?v=3O1_3zBUKM8");
|
.getExtractorInstance("https://www.youtube.com/watch?v=3O1_3zBUKM8");
|
||||||
} catch(YoutubeStreamExtractor.GemaException ge) {
|
} catch(YoutubeStreamExtractor.GemaException ge) {
|
||||||
|
@ -37,6 +37,8 @@ public class YoutubeStreamExtractorLiveStreamTest extends AndroidTestCase {
|
|||||||
public void setUp() throws IOException, ExtractionException {
|
public void setUp() throws IOException, ExtractionException {
|
||||||
//todo: make the extractor not throw over a livestream
|
//todo: make the extractor not throw over a livestream
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
NewPipe.init(new Downloader());
|
||||||
extractor = NewPipe.getService("Youtube")
|
extractor = NewPipe.getService("Youtube")
|
||||||
.getExtractorInstance("https://www.youtube.com/watch?v=J0s6NjqdjLE", new Downloader());
|
.getExtractorInstance("https://www.youtube.com/watch?v=J0s6NjqdjLE", new Downloader());
|
||||||
*/
|
*/
|
||||||
|
@ -2,6 +2,7 @@ package org.schabi.newpipe.extractor.youtube;
|
|||||||
|
|
||||||
import android.test.AndroidTestCase;
|
import android.test.AndroidTestCase;
|
||||||
|
|
||||||
|
import org.schabi.newpipe.Downloader;
|
||||||
import org.schabi.newpipe.extractor.NewPipe;
|
import org.schabi.newpipe.extractor.NewPipe;
|
||||||
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
||||||
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
||||||
@ -14,7 +15,9 @@ public class YoutubeStreamExtractorRestrictedTest extends AndroidTestCase {
|
|||||||
public static final String HTTPS = "https://";
|
public static final String HTTPS = "https://";
|
||||||
private StreamExtractor extractor;
|
private StreamExtractor extractor;
|
||||||
|
|
||||||
public void setUp() throws IOException, ExtractionException {
|
public void setUp() throws Exception {
|
||||||
|
super.setUp();
|
||||||
|
NewPipe.init(new Downloader());
|
||||||
extractor = NewPipe.getService("Youtube")
|
extractor = NewPipe.getService("Youtube")
|
||||||
.getExtractorInstance("https://www.youtube.com/watch?v=i6JTvzrpBy0");
|
.getExtractorInstance("https://www.youtube.com/watch?v=i6JTvzrpBy0");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user