From 09ddb6adbb88ba01e8eec777f9ed8aaab63f3aa6 Mon Sep 17 00:00:00 2001 From: Stypox Date: Sat, 19 Mar 2022 10:54:38 +0100 Subject: [PATCH] [YouTube] Add MockOnly to method testing mixes in related items --- .../youtube/stream/YoutubeStreamExtractorRelatedMixTest.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorRelatedMixTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorRelatedMixTest.java index 321a6da41..48c2d2243 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorRelatedMixTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorRelatedMixTest.java @@ -11,6 +11,7 @@ import static org.schabi.newpipe.extractor.services.youtube.stream.YoutubeStream import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.schabi.newpipe.downloader.DownloaderFactory; +import org.schabi.newpipe.downloader.MockOnly; import org.schabi.newpipe.extractor.InfoItem; import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.StreamingService; @@ -42,7 +43,7 @@ public class YoutubeStreamExtractorRelatedMixTest extends DefaultStreamExtractor YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); YoutubeStreamExtractor.resetDeobfuscationCode(); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "relatedMix")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "relatedMix")); extractor = YouTube.getStreamExtractor(URL); extractor.fetchPage(); } @@ -62,6 +63,7 @@ public class YoutubeStreamExtractorRelatedMixTest extends DefaultStreamExtractor return Arrays.asList("https://www.youtube.com/user/danielleviband/", "©"); } @Override public boolean expectedUploaderVerified() { return true; } + @Override public long expectedUploaderSubscriberCountAtLeast() { return 32_000_000; } @Override public long expectedLength() { return 208; } @Override public long expectedTimestamp() { return 0; } @Override public long expectedViewCountAtLeast() { return 449_000_000; } @@ -86,6 +88,7 @@ public class YoutubeStreamExtractorRelatedMixTest extends DefaultStreamExtractor // @formatter:on @Test + @MockOnly // related items keep changing, and so do the mixes contained within them @Override public void testRelatedItems() throws Exception { super.testRelatedItems();