use of org.nzbhydra.searching.searchrequests.SearchRequest in project nzbhydra2 by theotherp.
the class NewznabTest method shoulNotdAddExcludedAndRequiredWordsWithSomeCharacters.
@Test
public void shoulNotdAddExcludedAndRequiredWordsWithSomeCharacters() throws Exception {
SearchRequest searchRequest = new SearchRequest(SearchSource.INTERNAL, SearchType.SEARCH, 0, 100);
searchRequest.setQuery("q");
searchRequest.getInternalData().setForbiddenWords(Lists.newArrayList("a", "b b", "-c", "d.d"));
assertEquals(UriComponentsBuilder.fromHttpUrl("http://127.0.0.1:1234/api?t=search&extended=1&q=q --a").build(), testee.buildSearchUrl(searchRequest, null, null).build());
}
use of org.nzbhydra.searching.searchrequests.SearchRequest in project nzbhydra2 by theotherp.
the class NewznabTest method shouldConvertIdIfNecessary.
@Test
public void shouldConvertIdIfNecessary() throws Exception {
SearchRequest searchRequest = new SearchRequest(SearchSource.INTERNAL, SearchType.SEARCH, 0, 100);
searchRequest.getIdentifiers().put(IdType.IMDB, "imdbId");
testee.config.getSupportedSearchIds().add(IdType.TMDB);
when(infoProviderMock.canConvertAny(anySet(), anySet())).thenReturn(true);
testee.extendQueryUrlWithSearchIds(searchRequest, uriComponentsBuilderMock);
verify(uriComponentsBuilderMock).queryParam("tmdbid", "tmdbId");
}
use of org.nzbhydra.searching.searchrequests.SearchRequest in project nzbhydra2 by theotherp.
the class NewznabTest method shouldNotAddForbiddenWordsToEmptyQuery.
@Test
public void shouldNotAddForbiddenWordsToEmptyQuery() throws Exception {
SearchRequest searchRequest = new SearchRequest(SearchSource.INTERNAL, SearchType.SEARCH, 0, 100);
searchRequest.getInternalData().setForbiddenWords(Lists.newArrayList("a", "b", "c"));
assertEquals(UriComponentsBuilder.fromHttpUrl("http://127.0.0.1:1234/api?t=search&extended=1").build(), testee.buildSearchUrl(searchRequest, null, null).build());
}
use of org.nzbhydra.searching.searchrequests.SearchRequest in project nzbhydra2 by theotherp.
the class NewznabTest method shouldNotConvertIdIfNotNecessary.
@Test
public void shouldNotConvertIdIfNotNecessary() throws Exception {
SearchRequest searchRequest = new SearchRequest(SearchSource.INTERNAL, SearchType.SEARCH, 0, 100);
searchRequest.getIdentifiers().put(IdType.TMDB, "tmdbId");
testee.extendQueryUrlWithSearchIds(searchRequest, uriComponentsBuilderMock);
verify(infoProviderMock, never()).convert(anyString(), eq(IdType.TMDB));
}
use of org.nzbhydra.searching.searchrequests.SearchRequest in project nzbhydra2 by theotherp.
the class NewznabTest method shouldRemoveTrailingTtFromImdbId.
@Test
public void shouldRemoveTrailingTtFromImdbId() throws Exception {
testee.config = new IndexerConfig();
testee.config.setSupportedSearchIds(Lists.newArrayList(IdType.IMDB));
SearchRequest searchRequest = new SearchRequest(SearchSource.INTERNAL, SearchType.SEARCH, 0, 100);
searchRequest.getIdentifiers().put(IdType.IMDB, "12345");
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl("http://www.indexerName.com/api");
builder = testee.extendQueryUrlWithSearchIds(searchRequest, builder);
MultiValueMap<String, String> params = builder.build().getQueryParams();
assertTrue(params.containsKey("imdbid"));
assertEquals(1, params.size());
assertEquals("12345", params.get("imdbid").get(0));
verify(infoProviderMock, never()).convert(anyString(), any(IdType.class));
}
Aggregations