2017-08-05 16:15:36 +02:00
|
|
|
package org.schabi.newpipe.extractor.services.youtube;
|
2017-08-05 10:03:56 +02:00
|
|
|
|
2017-12-07 02:09:46 +01:00
|
|
|
import org.junit.BeforeClass;
|
2017-08-08 17:01:50 +02:00
|
|
|
import org.junit.Ignore;
|
2017-08-05 10:03:56 +02:00
|
|
|
import org.junit.Test;
|
|
|
|
import org.schabi.newpipe.Downloader;
|
|
|
|
import org.schabi.newpipe.extractor.InfoItem;
|
|
|
|
import org.schabi.newpipe.extractor.NewPipe;
|
|
|
|
import org.schabi.newpipe.extractor.search.SearchEngine;
|
|
|
|
import org.schabi.newpipe.extractor.search.SearchResult;
|
|
|
|
|
2017-08-08 17:01:50 +02:00
|
|
|
import static org.junit.Assert.*;
|
2017-12-07 09:46:59 +01:00
|
|
|
import static org.schabi.newpipe.extractor.ExtractorAsserts.assertIsValidUrl;
|
2017-08-07 18:12:51 +02:00
|
|
|
import static org.schabi.newpipe.extractor.ServiceList.YouTube;
|
2017-08-05 16:15:36 +02:00
|
|
|
|
2017-08-05 10:03:56 +02:00
|
|
|
|
2017-08-06 22:20:15 +02:00
|
|
|
/*
|
2017-08-05 10:03:56 +02:00
|
|
|
* Created by Christian Schabesberger on 29.12.15.
|
|
|
|
*
|
|
|
|
* Copyright (C) Christian Schabesberger 2015 <chris.schabesberger@mailbox.org>
|
|
|
|
* YoutubeSearchEngineStreamTest.java is part of NewPipe.
|
|
|
|
*
|
|
|
|
* NewPipe is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* NewPipe is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test for {@link SearchEngine}
|
|
|
|
*/
|
2018-01-04 18:24:09 +01:00
|
|
|
public class YoutubeSearchEngineStreamTest extends BaseYoutubeSearchTest {
|
2017-08-05 10:03:56 +02:00
|
|
|
|
2017-12-07 02:09:46 +01:00
|
|
|
@BeforeClass
|
|
|
|
public static void setUp() throws Exception {
|
2017-08-05 10:03:56 +02:00
|
|
|
NewPipe.init(Downloader.getInstance());
|
2017-08-07 18:12:51 +02:00
|
|
|
SearchEngine engine = YouTube.getService().getSearchEngine();
|
2017-08-05 10:03:56 +02:00
|
|
|
|
2017-08-05 16:15:36 +02:00
|
|
|
// Youtube will suggest "results" instead of "rsults",
|
|
|
|
// keep in mind that the suggestions can change by country (the parameter "de")
|
2017-12-15 22:12:32 +01:00
|
|
|
result = engine.search("abc", 0, "de", SearchEngine.Filter.STREAM)
|
2017-08-16 04:40:03 +02:00
|
|
|
.getSearchResult();
|
2017-08-05 10:03:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
2017-08-10 19:50:59 +02:00
|
|
|
public void testResultsItemType() {
|
2017-08-06 22:20:15 +02:00
|
|
|
for (InfoItem infoItem : result.resultList) {
|
|
|
|
assertEquals(InfoItem.InfoType.STREAM, infoItem.info_type);
|
|
|
|
}
|
2017-08-05 10:03:56 +02:00
|
|
|
}
|
|
|
|
|
2017-08-08 17:01:50 +02:00
|
|
|
@Ignore
|
2017-08-05 10:03:56 +02:00
|
|
|
@Test
|
|
|
|
public void testSuggestion() {
|
|
|
|
//todo write a real test
|
|
|
|
assertTrue(result.suggestion != null);
|
|
|
|
}
|
|
|
|
}
|