[YouTube] Add MockOnly to method testing mixes in related items

This commit is contained in:
Stypox 2022-03-19 10:54:38 +01:00
parent 8201b3b90e
commit 09ddb6adbb
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23

View File

@ -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.BeforeAll;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.schabi.newpipe.downloader.DownloaderFactory; import org.schabi.newpipe.downloader.DownloaderFactory;
import org.schabi.newpipe.downloader.MockOnly;
import org.schabi.newpipe.extractor.InfoItem; import org.schabi.newpipe.extractor.InfoItem;
import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.StreamingService; import org.schabi.newpipe.extractor.StreamingService;
@ -42,7 +43,7 @@ public class YoutubeStreamExtractorRelatedMixTest extends DefaultStreamExtractor
YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.resetClientVersionAndKey();
YoutubeParsingHelper.setNumberGenerator(new Random(1)); YoutubeParsingHelper.setNumberGenerator(new Random(1));
YoutubeStreamExtractor.resetDeobfuscationCode(); YoutubeStreamExtractor.resetDeobfuscationCode();
NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "relatedMix")); NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "relatedMix"));
extractor = YouTube.getStreamExtractor(URL); extractor = YouTube.getStreamExtractor(URL);
extractor.fetchPage(); extractor.fetchPage();
} }
@ -62,6 +63,7 @@ public class YoutubeStreamExtractorRelatedMixTest extends DefaultStreamExtractor
return Arrays.asList("https://www.youtube.com/user/danielleviband/", "©"); return Arrays.asList("https://www.youtube.com/user/danielleviband/", "©");
} }
@Override public boolean expectedUploaderVerified() { return true; } @Override public boolean expectedUploaderVerified() { return true; }
@Override public long expectedUploaderSubscriberCountAtLeast() { return 32_000_000; }
@Override public long expectedLength() { return 208; } @Override public long expectedLength() { return 208; }
@Override public long expectedTimestamp() { return 0; } @Override public long expectedTimestamp() { return 0; }
@Override public long expectedViewCountAtLeast() { return 449_000_000; } @Override public long expectedViewCountAtLeast() { return 449_000_000; }
@ -86,6 +88,7 @@ public class YoutubeStreamExtractorRelatedMixTest extends DefaultStreamExtractor
// @formatter:on // @formatter:on
@Test @Test
@MockOnly // related items keep changing, and so do the mixes contained within them
@Override @Override
public void testRelatedItems() throws Exception { public void testRelatedItems() throws Exception {
super.testRelatedItems(); super.testRelatedItems();