mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-23 16:28:51 -05:00
* fixed some unit tests
This commit is contained in:
parent
2fe8bd1306
commit
c9bc001a9c
@ -0,0 +1,94 @@
|
|||||||
|
|
||||||
|
package net.sourceforge.filebot.web;
|
||||||
|
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.junit.AfterClass;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
|
||||||
|
public class OpenSubtitlesXmlRpcTest {
|
||||||
|
|
||||||
|
private static OpenSubtitlesXmlRpc xmlrpc = new OpenSubtitlesXmlRpc("FileBot 0.0");
|
||||||
|
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
public static void login() throws Exception {
|
||||||
|
// login manually
|
||||||
|
xmlrpc.loginAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void search() throws Exception {
|
||||||
|
List<MovieDescriptor> list = xmlrpc.searchMoviesOnIMDB("babylon 5");
|
||||||
|
|
||||||
|
MovieDescriptor sample = (MovieDescriptor) list.get(0);
|
||||||
|
|
||||||
|
// check sample entry
|
||||||
|
assertEquals("\"Babylon 5\" (1994) (TV series)", sample.getName());
|
||||||
|
assertEquals(105946, sample.getImdbId());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getSubtitleListEnglish() throws Exception {
|
||||||
|
List<OpenSubtitlesSubtitleDescriptor> list = xmlrpc.searchSubtitles(361256, "eng");
|
||||||
|
|
||||||
|
SubtitleDescriptor sample = list.get(0);
|
||||||
|
|
||||||
|
assertTrue(sample.getName().startsWith("Wonderfalls"));
|
||||||
|
assertEquals("English", sample.getLanguageName());
|
||||||
|
|
||||||
|
// check size
|
||||||
|
assertTrue(list.size() > 20);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getSubtitleListAllLanguages() throws Exception {
|
||||||
|
List<OpenSubtitlesSubtitleDescriptor> list = xmlrpc.searchSubtitles(361256);
|
||||||
|
|
||||||
|
OpenSubtitlesSubtitleDescriptor sample = list.get(75);
|
||||||
|
|
||||||
|
assertTrue(sample.getName().startsWith("Wonderfalls"));
|
||||||
|
assertEquals("Hungarian", sample.getLanguageName());
|
||||||
|
|
||||||
|
// check size
|
||||||
|
assertTrue(list.size() > 70);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getSubtitleListMovieHash() {
|
||||||
|
//TODO not implemented yet
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void fetchSubtitle() throws Exception {
|
||||||
|
List<OpenSubtitlesSubtitleDescriptor> list = xmlrpc.searchSubtitles(361256, "eng");
|
||||||
|
|
||||||
|
// check format
|
||||||
|
assertEquals("srt", list.get(0).getType());
|
||||||
|
|
||||||
|
// fetch subtitle file
|
||||||
|
ByteBuffer data = list.get(0).fetch();
|
||||||
|
|
||||||
|
// check size
|
||||||
|
assertEquals(48550, data.remaining(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@AfterClass
|
||||||
|
public static void logout() throws Exception {
|
||||||
|
// logout manually
|
||||||
|
xmlrpc.logout();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -87,8 +87,8 @@ public class TVDotComClientTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getEpisodeListAllManySeasons() throws Exception {
|
public void getEpisodeListAllManySeasons() throws Exception {
|
||||||
// more than 700 episodes / 26 seasons (on going)
|
// more than 700 episodes / 26 seasons
|
||||||
List<Episode> list = tvdotcom.getEpisodeList(tvdotcom.search("Doctor Who").get(0));
|
List<Episode> list = tvdotcom.getEpisodeList(tvdotcom.search("Doctor Who (1963)").get(0));
|
||||||
|
|
||||||
// there are still new episodes coming out
|
// there are still new episodes coming out
|
||||||
assertTrue(list.size() > 700);
|
assertTrue(list.size() > 700);
|
||||||
|
@ -8,13 +8,13 @@ import java.util.EnumSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
import net.sf.ehcache.CacheManager;
|
import net.sf.ehcache.CacheManager;
|
||||||
import net.sourceforge.filebot.web.TheTVDBClient.MirrorType;
|
import net.sourceforge.filebot.web.TheTVDBClient.MirrorType;
|
||||||
import net.sourceforge.filebot.web.TheTVDBClient.TheTVDBSearchResult;
|
import net.sourceforge.filebot.web.TheTVDBClient.TheTVDBSearchResult;
|
||||||
|
|
||||||
import org.junit.After;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
|
|
||||||
public class TheTVDBClientTest {
|
public class TheTVDBClientTest {
|
||||||
|
|
||||||
@ -77,16 +77,16 @@ public class TheTVDBClientTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getEpisodeListSingleSeason() throws Exception {
|
public void getEpisodeListSingleSeason() throws Exception {
|
||||||
List<Episode> list = thetvdb.getEpisodeList(new TheTVDBSearchResult("Buffy the Vampire Slayer", 70327), 7);
|
List<Episode> list = thetvdb.getEpisodeList(new TheTVDBSearchResult("Wonderfalls", 78845), 1);
|
||||||
|
|
||||||
assertEquals(22, list.size());
|
assertEquals(13, list.size());
|
||||||
|
|
||||||
Episode chosen = list.get(21);
|
Episode chosen = list.get(0);
|
||||||
|
|
||||||
assertEquals("Buffy the Vampire Slayer", chosen.getSeriesName());
|
assertEquals("Wonderfalls", chosen.getSeriesName());
|
||||||
assertEquals("Chosen", chosen.getTitle());
|
assertEquals("Wax Lion", chosen.getTitle());
|
||||||
assertEquals("22", chosen.getEpisode());
|
assertEquals("1", chosen.getEpisode());
|
||||||
assertEquals("7", chosen.getSeason());
|
assertEquals("1", chosen.getSeason());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import org.junit.runners.Suite.SuiteClasses;
|
|||||||
|
|
||||||
|
|
||||||
@RunWith(Suite.class)
|
@RunWith(Suite.class)
|
||||||
@SuiteClasses( { TVDotComClientTest.class, AnidbClientTest.class, TVRageClientTest.class, TheTVDBClientTest.class, IMDbClientTest.class, SubsceneSubtitleClientTest.class, SubtitleSourceClientTest.class, SublightSubtitleClientTest.class })
|
@SuiteClasses( { TVDotComClientTest.class, AnidbClientTest.class, TVRageClientTest.class, TheTVDBClientTest.class, IMDbClientTest.class, SubsceneSubtitleClientTest.class, SubtitleSourceClientTest.class, SublightSubtitleClientTest.class, OpenSubtitlesXmlRpcTest.class })
|
||||||
public class WebTestSuite {
|
public class WebTestSuite {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user