-
Notifications
You must be signed in to change notification settings - Fork 422
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove YouTube stream tests mocks and their use
The cpn parameter is randomly generated so its value in the mocks is almost never valid. YouTube stream tests will now use an online version only.
- Loading branch information
Showing
67 changed files
with
54 additions
and
13,785 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,28 @@ | ||
/* | ||
* Created by Christian Schabesberger on 30.12.15. | ||
* | ||
* Copyright (C) Christian Schabesberger 2015 <[email protected]> | ||
* YoutubeVideoExtractorDefault.java is part of NewPipe Extractor. | ||
* | ||
* NewPipe Extractor 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 Extractor 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 Extractor. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package org.schabi.newpipe.extractor.services.youtube.stream; | ||
|
||
import org.junit.BeforeClass; | ||
import org.junit.Ignore; | ||
import org.junit.Test; | ||
import org.schabi.newpipe.downloader.DownloaderFactory; | ||
import org.schabi.newpipe.downloader.DownloaderTestImpl; | ||
import org.schabi.newpipe.extractor.MetaInfo; | ||
import org.schabi.newpipe.extractor.NewPipe; | ||
|
@@ -34,27 +53,10 @@ | |
import static org.schabi.newpipe.extractor.ServiceList.YouTube; | ||
import static org.schabi.newpipe.extractor.utils.Utils.EMPTY_STRING; | ||
|
||
/* | ||
* Created by Christian Schabesberger on 30.12.15. | ||
* | ||
* Copyright (C) Christian Schabesberger 2015 <[email protected]> | ||
* YoutubeVideoExtractorDefault.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/>. | ||
*/ | ||
// We cannot use mocks for this test class because of the content playback nonce field sent in POST | ||
// bodies requests, which is generated randomly. | ||
|
||
public class YoutubeStreamExtractorDefaultTest { | ||
private static final String RESOURCE_PATH = DownloaderFactory.RESOURCE_PATH + "services/youtube/extractor/stream/"; | ||
static final String BASE_URL = "https://www.youtube.com/watch?v="; | ||
public static final String YOUTUBE_LICENCE = "YouTube licence"; | ||
|
||
|
@@ -64,7 +66,7 @@ public static void setUp() throws IOException { | |
YoutubeParsingHelper.resetClientVersionAndKey(); | ||
YoutubeParsingHelper.setNumberGenerator(new Random(1)); | ||
YoutubeStreamExtractor.resetDeobfuscationCode(); | ||
NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "notAvailable")); | ||
NewPipe.init(DownloaderTestImpl.getInstance()); | ||
} | ||
|
||
@Test(expected = GeographicRestrictionException.class) | ||
|
@@ -121,7 +123,7 @@ public static void setUp() throws Exception { | |
YoutubeParsingHelper.resetClientVersionAndKey(); | ||
YoutubeParsingHelper.setNumberGenerator(new Random(1)); | ||
YoutubeStreamExtractor.resetDeobfuscationCode(); | ||
NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "pewdiwpie")); | ||
NewPipe.init(DownloaderTestImpl.getInstance()); | ||
extractor = YouTube.getStreamExtractor(URL); | ||
extractor.fetchPage(); | ||
} | ||
|
@@ -165,7 +167,7 @@ public static void setUp() throws Exception { | |
YoutubeParsingHelper.resetClientVersionAndKey(); | ||
YoutubeParsingHelper.setNumberGenerator(new Random(1)); | ||
YoutubeStreamExtractor.resetDeobfuscationCode(); | ||
NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "unboxing")); | ||
NewPipe.init(DownloaderTestImpl.getInstance()); | ||
extractor = YouTube.getStreamExtractor(URL); | ||
extractor.fetchPage(); | ||
} | ||
|
@@ -219,7 +221,7 @@ public static void setUp() throws Exception { | |
YoutubeParsingHelper.resetClientVersionAndKey(); | ||
YoutubeParsingHelper.setNumberGenerator(new Random(1)); | ||
YoutubeStreamExtractor.resetDeobfuscationCode(); | ||
NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "ratingsDisabled")); | ||
NewPipe.init(DownloaderTestImpl.getInstance()); | ||
extractor = YouTube.getStreamExtractor(URL); | ||
extractor.fetchPage(); | ||
} | ||
|
@@ -257,7 +259,7 @@ public static void setUp() throws Exception { | |
YoutubeParsingHelper.resetClientVersionAndKey(); | ||
YoutubeParsingHelper.setNumberGenerator(new Random(1)); | ||
YoutubeStreamExtractor.resetDeobfuscationCode(); | ||
NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "streamSegmentsTagesschau")); | ||
NewPipe.init(DownloaderTestImpl.getInstance()); | ||
extractor = YouTube.getStreamExtractor(URL); | ||
extractor.fetchPage(); | ||
} | ||
|
@@ -319,7 +321,7 @@ public static void setUp() throws Exception { | |
YoutubeParsingHelper.resetClientVersionAndKey(); | ||
YoutubeParsingHelper.setNumberGenerator(new Random(1)); | ||
YoutubeStreamExtractor.resetDeobfuscationCode(); | ||
NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "streamSegmentsMaiLab")); | ||
NewPipe.init(DownloaderTestImpl.getInstance()); | ||
extractor = YouTube.getStreamExtractor(URL); | ||
extractor.fetchPage(); | ||
} | ||
|
@@ -387,7 +389,7 @@ public static class PublicBroadcasterTest extends DefaultStreamExtractorTest { | |
public static void setUp() throws Exception { | ||
YoutubeParsingHelper.resetClientVersionAndKey(); | ||
YoutubeParsingHelper.setNumberGenerator(new Random(1)); | ||
NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "publicBroadcast")); | ||
NewPipe.init(DownloaderTestImpl.getInstance()); | ||
extractor = YouTube.getStreamExtractor(URL); | ||
YoutubeStreamExtractor.resetDeobfuscationCode(); | ||
extractor.fetchPage(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.