use of org.nzbhydra.mapping.newznab.caps.CapsSearch in project nzbhydra2 by theotherp.
the class NewznabCheckerTest method shouldCheckCaps.
@Test
public void shouldCheckCaps() throws Exception {
NewznabResponseBuilder builder = new NewznabResponseBuilder();
NewznabXmlRoot thronesResult = builder.getTestResult(1, 100, "Thrones", 0, 100);
thronesResult.getRssChannel().setGenerator("nzedb");
when(indexerWebAccess.get(new URI("http://127.0.0.1:1234/api?apikey=apikey&t=tvsearch&tvdbid=121361"), indexerConfig)).thenReturn(thronesResult);
when(indexerWebAccess.get(new URI("http://127.0.0.1:1234/api?apikey=apikey&t=tvsearch&rid=24493"), indexerConfig)).thenReturn(builder.getTestResult(1, 100, "Thrones", 0, 100));
when(indexerWebAccess.get(new URI("http://127.0.0.1:1234/api?apikey=apikey&t=tvsearch&tvmazeid=82"), indexerConfig)).thenReturn(builder.getTestResult(1, 100, "Thrones", 0, 100));
when(indexerWebAccess.get(new URI("http://127.0.0.1:1234/api?apikey=apikey&t=tvsearch&traktid=1390"), indexerConfig)).thenReturn(builder.getTestResult(1, 100, "GOT", 0, 100));
when(indexerWebAccess.get(new URI("http://127.0.0.1:1234/api?apikey=apikey&t=movie&tmdbid=1399"), indexerConfig)).thenReturn(builder.getTestResult(1, 100, "Avengers", 0, 100));
when(indexerWebAccess.get(new URI("http://127.0.0.1:1234/api?apikey=apikey&t=movie&imdbid=0848228"), indexerConfig)).thenReturn(builder.getTestResult(1, 100, "Avengers", 0, 100));
capsRoot.getSearching().setAudioSearch(new CapsSearch("yes", "q"));
CheckCapsResponse checkCapsRespone = testee.checkCaps(indexerConfig);
assertEquals(6, checkCapsRespone.getIndexerConfig().getSupportedSearchIds().size());
assertTrue(checkCapsRespone.getIndexerConfig().getSupportedSearchIds().contains(TVDB));
assertTrue(checkCapsRespone.getIndexerConfig().getSupportedSearchIds().contains(TVRAGE));
assertTrue(checkCapsRespone.getIndexerConfig().getSupportedSearchIds().contains(TVMAZE));
assertTrue(checkCapsRespone.getIndexerConfig().getSupportedSearchIds().contains(TRAKT));
assertTrue(checkCapsRespone.getIndexerConfig().getSupportedSearchIds().contains(IMDB));
assertTrue(checkCapsRespone.getIndexerConfig().getSupportedSearchIds().contains(TMDB));
assertEquals(3, checkCapsRespone.getIndexerConfig().getSupportedSearchTypes().size());
assertTrue(checkCapsRespone.getIndexerConfig().getSupportedSearchTypes().contains(ActionAttribute.AUDIO));
assertTrue(checkCapsRespone.getIndexerConfig().getSupportedSearchTypes().contains(ActionAttribute.TVSEARCH));
assertTrue(checkCapsRespone.getIndexerConfig().getSupportedSearchTypes().contains(ActionAttribute.MOVIE));
assertEquals(BackendType.NZEDB, checkCapsRespone.getIndexerConfig().getBackend());
assertTrue(checkCapsRespone.isAllCapsChecked());
verify(indexerWebAccess, times(7)).get(any(), eq(indexerConfig));
}
Aggregations