Search in sources :

Example 1 with NewznabXmlRoot

use of org.nzbhydra.mapping.newznab.xml.NewznabXmlRoot 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));
}
Also used : NewznabXmlRoot(org.nzbhydra.mapping.newznab.xml.NewznabXmlRoot) NewznabResponseBuilder(org.nzbhydra.fortests.NewznabResponseBuilder) URI(java.net.URI) CapsSearch(org.nzbhydra.mapping.newznab.caps.CapsSearch) BinsearchTest(org.nzbhydra.indexers.BinsearchTest) Test(org.junit.Test)

Example 2 with NewznabXmlRoot

use of org.nzbhydra.mapping.newznab.xml.NewznabXmlRoot in project nzbhydra2 by theotherp.

the class RssMappingTest method shouldParseResponseFromNzbsOrg.

@Test
public void shouldParseResponseFromNzbsOrg() throws Exception {
    NewznabXmlRoot rssRoot = getRssRootFromXml("nzbsOrgResponse.xml");
    assertEquals(Integer.valueOf(1000), rssRoot.getRssChannel().getNewznabResponse().getTotal());
    assertNotNull(rssRoot.getRssChannel().getItems().get(0).getPubDate());
}
Also used : NewznabXmlRoot(org.nzbhydra.mapping.newznab.xml.NewznabXmlRoot) Test(org.junit.Test)

Example 3 with NewznabXmlRoot

use of org.nzbhydra.mapping.newznab.xml.NewznabXmlRoot in project nzbhydra2 by theotherp.

the class RssMappingTest method shouldParseResponseFromNewztown.

@Test
public void shouldParseResponseFromNewztown() throws Exception {
    NewznabXmlRoot rssRoot = getRssRootFromXml("newztownResponse.xml");
    assertEquals(Integer.valueOf(4443964), rssRoot.getRssChannel().getNewznabResponse().getTotal());
    assertNotNull(rssRoot.getRssChannel().getItems().get(0).getPubDate());
}
Also used : NewznabXmlRoot(org.nzbhydra.mapping.newznab.xml.NewznabXmlRoot) Test(org.junit.Test)

Example 4 with NewznabXmlRoot

use of org.nzbhydra.mapping.newznab.xml.NewznabXmlRoot in project nzbhydra2 by theotherp.

the class RssMappingTest method shouldParseResponseFromNzbFinder.

@Test
public void shouldParseResponseFromNzbFinder() throws Exception {
    NewznabXmlRoot rssRoot = getRssRootFromXml("nzbFinderResponse.xml");
    assertEquals(Integer.valueOf(125000), rssRoot.getRssChannel().getNewznabResponse().getTotal());
    assertNotNull(rssRoot.getRssChannel().getItems().get(0).getPubDate());
}
Also used : NewznabXmlRoot(org.nzbhydra.mapping.newznab.xml.NewznabXmlRoot) Test(org.junit.Test)

Example 5 with NewznabXmlRoot

use of org.nzbhydra.mapping.newznab.xml.NewznabXmlRoot in project nzbhydra2 by theotherp.

the class RssMappingTest method shouldParseResponseFromTabulaRasa.

@Test
public void shouldParseResponseFromTabulaRasa() throws Exception {
    NewznabXmlRoot rssRoot = getRssRootFromXml("tabulaRasaResponse.xml");
    assertEquals(Integer.valueOf(125000), rssRoot.getRssChannel().getNewznabResponse().getTotal());
    assertNotNull(rssRoot.getRssChannel().getItems().get(0).getPubDate());
}
Also used : NewznabXmlRoot(org.nzbhydra.mapping.newznab.xml.NewznabXmlRoot) Test(org.junit.Test)

Aggregations

NewznabXmlRoot (org.nzbhydra.mapping.newznab.xml.NewznabXmlRoot)41 Test (org.junit.Test)30 MockResponse (okhttp3.mockwebserver.MockResponse)12 NewznabXmlItem (org.nzbhydra.mapping.newznab.xml.NewznabXmlItem)11 AbstractConfigReplacingTest (org.nzbhydra.tests.AbstractConfigReplacingTest)10 NewznabAttribute (org.nzbhydra.mapping.newznab.xml.NewznabAttribute)8 RecordedRequest (okhttp3.mockwebserver.RecordedRequest)7 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)6 ArrayList (java.util.ArrayList)5 Dispatcher (okhttp3.mockwebserver.Dispatcher)4 NewznabXmlChannel (org.nzbhydra.mapping.newznab.xml.NewznabXmlChannel)4 NzbhydraMockMvcTest (org.nzbhydra.tests.NzbhydraMockMvcTest)4 URI (java.net.URI)3 NewznabResponseBuilder (org.nzbhydra.fortests.NewznabResponseBuilder)3 NewznabParameters (org.nzbhydra.mapping.newznab.NewznabParameters)3 NewznabXmlEnclosure (org.nzbhydra.mapping.newznab.xml.NewznabXmlEnclosure)3 NewznabXmlGuid (org.nzbhydra.mapping.newznab.xml.NewznabXmlGuid)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 Matcher (java.util.regex.Matcher)2 NewznabXmlResponse (org.nzbhydra.mapping.newznab.xml.NewznabXmlResponse)2