Skip to content

Commit

Permalink
[YouTube] Remove YoutubeSearchExtractorTest.Suggestion
Browse files Browse the repository at this point in the history
Searches are now always corrected by YouTube, which provides a way to still search for the input term. In this case, a "Did you mean" message will be shown. The extractor doesn't support the ability to search on the input term instead of the corrected search, at least for now.

As mocks have to be updated due to the addition of the Content-Type header, the test will always fail, even in MockOnly mode, due to the reasons mentioned above, so it should be removed.
  • Loading branch information
AudricV committed Jul 11, 2022
1 parent 6017730 commit fc7c4e7
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 1,394 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
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.ListExtractor;
import org.schabi.newpipe.extractor.MetaInfo;
Expand Down Expand Up @@ -136,31 +135,6 @@ public static void setUp() throws Exception {
@Override public InfoItem.InfoType expectedInfoItemType() { return InfoItem.InfoType.STREAM; }
}

@MockOnly("Currently constantly switching between \"Did you mean\" and \"Showing results for ...\" occurs")
public static class Suggestion extends DefaultSearchExtractorTest {
private static SearchExtractor extractor;
private static final String QUERY = "newpip";
private static final String EXPECTED_SUGGESTION = "newpipe";

@BeforeAll
public static void setUp() throws Exception {
YoutubeTestsUtils.ensureStateless();
NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "suggestions"));
extractor = YouTube.getSearchExtractor(QUERY, singletonList(VIDEOS), "");
extractor.fetchPage();
}

@Override public SearchExtractor extractor() { return extractor; }
@Override public StreamingService expectedService() { return YouTube; }
@Override public String expectedName() { return QUERY; }
@Override public String expectedId() { return QUERY; }
@Override public String expectedUrlContains() { return "youtube.com/results?search_query=" + QUERY; }
@Override public String expectedOriginalUrlContains() { return "youtube.com/results?search_query=" + QUERY; }
@Override public String expectedSearchString() { return QUERY; }
@Nullable @Override public String expectedSearchSuggestion() { return EXPECTED_SUGGESTION; }
@Override public InfoItem.InfoType expectedInfoItemType() { return InfoItem.InfoType.STREAM; }
}

public static class CorrectedSearch extends DefaultSearchExtractorTest {
private static SearchExtractor extractor;
private static final String QUERY = "pewdeipie";
Expand Down

This file was deleted.

Loading

0 comments on commit fc7c4e7

Please sign in to comment.