1
0
mirror of https://github.com/mitb-archive/filebot synced 2025-01-10 21:38:04 -05:00

Unify production ready client code with unit test code

This commit is contained in:
Reinhard Pointner 2018-04-03 16:00:59 +08:00
parent d7df37666c
commit 8e07de675c
9 changed files with 73 additions and 247 deletions

View File

@ -1,20 +1,19 @@
package net.filebot.web;
import static net.filebot.WebServices.*;
import static org.junit.Assert.*;
import org.junit.Test;
public class AcoustIDClientTest {
AcoustIDClient client = new AcoustIDClient("0B3qZnQc");
@Test
public void lookup() throws Exception {
int duration = 357;
String fingerprint = "AQADtIkSJWGWREF0XTiH0j_4aAl--JiZ4w8me4GP8FmgIuNRUQzO49vxzBrOg9o69MiDfh8cmtC-4yRysN7RP3io4wvuwF-OWpmRN0KtQ_yHI9fD4wglHReJC7UyFs9l2A00K8IpoVdohImY47tx8RmYZz5SpUQPfRrB6Knw6PgDeBoP_UckjheO30N1wkePnJWgo1lXHdMmHu2WED6qH38g1o3wxDbuOOgJM0PV46G64h-aXC80yseZNcF7MCRxH44Woie0hjscHe-Ol0c-EleCnMEX1cIP8YOeDleQesIVHg96CX9KXPnwHYyQ0GEuhM-Inxt-nEIpGnaTI0xFfFCPVN-IUz--pBqayUHJ7DiaRzlcJh565cXhScdPsNKDPmNhJ0ePHz_a5ch1vMHxL0fjED_eoz8abfgF3UcvfMQJO0c_VHvgIw_RE_h-lD3So4fa5LimFFkWVDtOGseVotxhnsiPH-JPIbyOS47xoRkZVNyOf2gu9CKO5AniDl16mMdfBTcNHzwP_6h1RMePnjpC8ThPVMcznUTJCHmTQZckPEf_4KY3XDn0HumPMsfV40ZzjTOeI5cJvccTI_xnVJ_RnF3wZMxRqYcPH-HHQT9y4HmMZn1QHX9O3ATyHIefoxJ1WC364Dx-_Id2NF-O78F_HP8hqhruXIF-PEfTDeGDH0ec7dCD6Afzoces41Fy46IohMkTaOLxLOVR7oZYG1fhPIeVRccXBf9x_PjxC04oXUUfQf9x5D8qw052dE9X_PiFRwlOE7-EH-V1POKHMyV6Yc9wHOy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CGJUEGUAMc55bAAjCCJIlmIKEIWUIAABQBQgDiABQYFKAEPEEQQABRgwxiAAjCcCKMagccAQJwgwQABAgEjAGWGIAoAhgSgRUGEjhFACIMgQAwwJwBkQAgggGDDCKAUUMgQxwwggZBARAAAEAmKIEAZBAAgABAAhhBECEIOgIA5owpRhRBFECKBKCIKIJwQAQggxkBDEpCGCG4AIIkQoBQURShAqiAGEAEQAhkYJIpmRBEjiDAMCEGEYMQAQQRwCAiABCGCCgCqIUcAQBAwCTgBBIFCCGQAAEgIjAoBjyhArBAJGIQMIQgAA65iQwAlADAMCMMgEAYQYR5wRABgFjQECAGaEYgAYpRjlQBDoCBCEWScEMIICIIkwgiCkEDFYQEOQIIIA4AhDTAAiAJACAGGEAE5AoIxCQBggKBDIQEeck0IwYoiBTAjEDCBACQBMQ4AgIoAQTCkjGGAACEUBQkw4IojAwAAOACGAIYAE8EoBRAACLhgRgCCIAIWIEAwQASBRBgBDBTBICQCgJIgojBRRDDBhgAAEGCAoFsAyRIwQhBDFHBQCGBKFIhQiBQClRAAlgENCAWYMIcwQQIgDAAACICHIKQMMIEQJQZUwRgGDgDAC";
String response = client.lookup(duration, fingerprint);
AudioTrack info = client.parseResult(response, duration);
String response = AcoustID.lookup(duration, fingerprint);
AudioTrack info = AcoustID.parseResult(response, duration);
assertEquals("Michael Jackson", info.getArtist());
assertEquals("Thriller", info.getTitle());
@ -25,8 +24,8 @@ public class AcoustIDClientTest {
int duration = 265;
String fingerprint = "AQADtJmWRFJCRkGcHXceND_Oquhz1H_xvjg8D8mYIf5-fOpKVE81NOOF5_hb1PrxJLhhRxfCLkNSOh-61Mvh3DJKOcMnG2eOPsmH_4R_I-SPJB-Df0NTB70-vPiDRtKOS3qK-Duhc8mR9-jyoOvhKhyJH-8FE5eOHHoy3BpC5Tieo_kV9LiZ41McHCF9iJmDPFTQPeiYHD5J_Cfy7DBz_IdxrXBRMTyeP9CSLeJQ8glyC18S5imeSHkSPBeavwgfHrqSD7l09Fl2mGMD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CmQQQQAQgAQFgBFBCCGSAwAEIcoIoJQEDCHhEDAKKmCREswQohAgiglkACACKgOhMUAhRgwCBAipEFGMAAGEUABYhAhSAiEFoFEQASGAIAAxJQiESDEHgCEISAEQEAAIJwhAShGoBAUAUCaIUAwIgQgzghgggECAKCIcMQoJxYgSwABlhACAMgMAEkwCpCBzhgADGDACWMIEA0YbIQBiQAAgGCFAKCCEJBAAAYwhAGmiCCOOAIEcMwAIggBzjBhHmHeMSCGIEggiAA0jTCHjCABCAAUQIUQJIowQggFkKBEAGCEBBMQgBIARBkGDCCFGCMMMIIAgQBgSSAI";
String response = client.lookup(duration, fingerprint);
AudioTrack info = client.parseResult(response, duration);
String response = AcoustID.lookup(duration, fingerprint);
AudioTrack info = AcoustID.parseResult(response, duration);
assertEquals("周杰倫", info.getArtist());
assertEquals("聽媽媽的話", info.getTitle());

View File

@ -1,5 +1,6 @@
package net.filebot.web;
import static net.filebot.WebServices.*;
import static org.junit.Assert.*;
import java.util.List;
@ -9,8 +10,6 @@ import org.junit.Test;
public class AnidbClientTest {
static AnidbClient anidb = new AnidbClient("filebot", 6);
/**
* 74 episodes
*/
@ -28,13 +27,13 @@ public class AnidbClientTest {
@Test
public void getAnimeTitles() throws Exception {
SearchResult[] animeTitles = anidb.getAnimeTitles();
SearchResult[] animeTitles = AniDB.getAnimeTitles();
assertTrue(animeTitles.length > 8000);
}
@Test
public void search() throws Exception {
List<SearchResult> results = anidb.search("one piece", Locale.ENGLISH);
List<SearchResult> results = AniDB.search("one piece", Locale.ENGLISH);
SearchResult result = results.get(0);
assertEquals("One Piece", result.getName());
@ -43,7 +42,7 @@ public class AnidbClientTest {
@Test
public void searchNoMatch() throws Exception {
List<SearchResult> results = anidb.search("i will not find anything for this query string", Locale.ENGLISH);
List<SearchResult> results = AniDB.search("i will not find anything for this query string", Locale.ENGLISH);
assertTrue(results.isEmpty());
}
@ -51,16 +50,16 @@ public class AnidbClientTest {
@Test
public void searchTitleAlias() throws Exception {
// Seikai no Senki (main title), Banner of the Stars (official English title)
assertEquals("Seikai no Senki", anidb.search("banner of the stars", Locale.ENGLISH).get(0).getName());
assertEquals("Seikai no Senki", anidb.search("seikai no senki", Locale.ENGLISH).get(0).getName());
assertEquals("Seikai no Senki", AniDB.search("banner of the stars", Locale.ENGLISH).get(0).getName());
assertEquals("Seikai no Senki", AniDB.search("seikai no senki", Locale.ENGLISH).get(0).getName());
// no matching title
assertEquals("Naruto", anidb.search("naruto", Locale.ENGLISH).get(0).getName());
assertEquals("Naruto", AniDB.search("naruto", Locale.ENGLISH).get(0).getName());
}
@Test
public void getEpisodeListAll() throws Exception {
List<Episode> list = anidb.getEpisodeList(monsterSearchResult, SortOrder.Airdate, Locale.ENGLISH);
List<Episode> list = AniDB.getEpisodeList(monsterSearchResult, SortOrder.Airdate, Locale.ENGLISH);
assertEquals(77, list.size());
@ -78,7 +77,7 @@ public class AnidbClientTest {
@Test
public void getEpisodeListAllShortLink() throws Exception {
List<Episode> list = anidb.getEpisodeList(twelvekingdomsSearchResult, SortOrder.Airdate, Locale.ENGLISH);
List<Episode> list = AniDB.getEpisodeList(twelvekingdomsSearchResult, SortOrder.Airdate, Locale.ENGLISH);
assertEquals(47, list.size());
@ -95,12 +94,12 @@ public class AnidbClientTest {
@Test
public void getEpisodeListEncoding() throws Exception {
assertEquals("Raven Princess - An der schönen blauen Donau", anidb.getEpisodeList(princessTutuSearchResult, SortOrder.Airdate, Locale.ENGLISH).get(6).getTitle());
assertEquals("Raven Princess - An der schönen blauen Donau", AniDB.getEpisodeList(princessTutuSearchResult, SortOrder.Airdate, Locale.ENGLISH).get(6).getTitle());
}
@Test
public void getEpisodeListI18N() throws Exception {
List<Episode> list = anidb.getEpisodeList(monsterSearchResult, SortOrder.Airdate, Locale.JAPANESE);
List<Episode> list = AniDB.getEpisodeList(monsterSearchResult, SortOrder.Airdate, Locale.JAPANESE);
Episode last = list.get(73);
assertEquals("MONSTER", last.getSeriesName());
@ -114,12 +113,12 @@ public class AnidbClientTest {
@Test
public void getEpisodeListTrimRecap() throws Exception {
assertEquals("Sea God of the East, Azure Sea of the West - Transition Chapter", anidb.getEpisodeList(twelvekingdomsSearchResult, SortOrder.Airdate, Locale.ENGLISH).get(44).getTitle());
assertEquals("Sea God of the East, Azure Sea of the West - Transition Chapter", AniDB.getEpisodeList(twelvekingdomsSearchResult, SortOrder.Airdate, Locale.ENGLISH).get(44).getTitle());
}
@Test
public void getEpisodeListLink() throws Exception {
assertEquals("http://anidb.net/a1539", anidb.getEpisodeListLink(monsterSearchResult).toURL().toString());
assertEquals("http://anidb.net/a1539", AniDB.getEpisodeListLink(monsterSearchResult).toURL().toString());
}
}

View File

@ -1,5 +1,6 @@
package net.filebot.web;
import static net.filebot.WebServices.*;
import static org.junit.Assert.*;
import java.util.List;
@ -8,11 +9,9 @@ import org.junit.Test;
public class OMDbClientTest {
private final OMDbClient client = new OMDbClient("49d311ec");
@Test
public void searchMovie1() throws Exception {
List<Movie> results = client.searchMovie("Avatar", null);
List<Movie> results = OMDb.searchMovie("Avatar", null);
Movie movie = results.get(0);
assertEquals("Avatar", movie.getName());
@ -22,7 +21,7 @@ public class OMDbClientTest {
@Test
public void searchMovie2() throws Exception {
List<Movie> results = client.searchMovie("The Terminator", null);
List<Movie> results = OMDb.searchMovie("The Terminator", null);
Movie movie = results.get(0);
assertEquals("The Terminator", movie.getName());
@ -32,7 +31,7 @@ public class OMDbClientTest {
@Test
public void searchMovie3() throws Exception {
List<Movie> results = client.searchMovie("Amélie", null);
List<Movie> results = OMDb.searchMovie("Amélie", null);
Movie movie = results.get(0);
assertEquals("Amélie", movie.getName());
@ -42,7 +41,7 @@ public class OMDbClientTest {
@Test
public void searchMovie4() throws Exception {
List<Movie> results = client.searchMovie("Heat", null);
List<Movie> results = OMDb.searchMovie("Heat", null);
Movie movie = results.get(0);
assertEquals("Heat", movie.getName());
@ -52,7 +51,7 @@ public class OMDbClientTest {
@Test
public void searchMovie6() throws Exception {
List<Movie> results = client.searchMovie("Drive 2011", null);
List<Movie> results = OMDb.searchMovie("Drive 2011", null);
Movie movie = results.get(0);
assertEquals("Drive", movie.getName());
@ -62,7 +61,7 @@ public class OMDbClientTest {
@Test
public void getMovieDescriptor1() throws Exception {
Movie movie = client.getMovieDescriptor(new Movie(499549), null);
Movie movie = OMDb.getMovieDescriptor(new Movie(499549), null);
assertEquals("Avatar", movie.getName());
assertEquals(2009, movie.getYear());
@ -71,7 +70,7 @@ public class OMDbClientTest {
@Test
public void getMovieDescriptor2() throws Exception {
Movie movie = client.getMovieDescriptor(new Movie(211915), null);
Movie movie = OMDb.getMovieDescriptor(new Movie(211915), null);
assertEquals("Amélie", movie.getName());
assertEquals(2001, movie.getYear());
@ -80,7 +79,7 @@ public class OMDbClientTest {
@Test
public void getMovieDescriptor3() throws Exception {
Movie movie = client.getMovieDescriptor(new Movie(75610), null);
Movie movie = OMDb.getMovieDescriptor(new Movie(75610), null);
assertEquals("21 Up", movie.getName());
assertEquals(1977, movie.getYear());
@ -89,7 +88,7 @@ public class OMDbClientTest {
@Test
public void getMovieDescriptor4() throws Exception {
Movie movie = client.getMovieDescriptor(new Movie(369702), null);
Movie movie = OMDb.getMovieDescriptor(new Movie(369702), null);
assertEquals("The Sea Inside", movie.getName());
assertEquals(2004, movie.getYear());
@ -98,7 +97,7 @@ public class OMDbClientTest {
@Test
public void getMovieDescriptor5() throws Exception {
Movie movie = client.getMovieDescriptor(new Movie(1020960), null);
Movie movie = OMDb.getMovieDescriptor(new Movie(1020960), null);
assertEquals("God, the Universe and Everything Else", movie.getName());
assertEquals(1988, movie.getYear());
@ -107,7 +106,7 @@ public class OMDbClientTest {
@Test
public void getImdbApiMovieInfoReleasedNA() throws Exception {
MovieInfo movie = client.getMovieInfo(new Movie(1287357));
MovieInfo movie = OMDb.getMovieInfo(new Movie(1287357));
assertEquals("Sommersonntag", movie.getName());
assertEquals(2008, movie.getReleased().getYear());
assertEquals("2008-06-07", movie.getReleased().toString());

View File

@ -21,7 +21,7 @@ import net.filebot.web.OpenSubtitlesXmlRpc.TryUploadResponse;
public class OpenSubtitlesXmlRpcTest {
private static OpenSubtitlesXmlRpc xmlrpc = new OpenSubtitlesXmlRpc(String.format("%s %s", getApplicationName(), getApplicationVersion()));
private static OpenSubtitlesXmlRpc xmlrpc = new OpenSubtitlesXmlRpc(String.format("%s %s", getApiKey("opensubtitles"), getApplicationVersion()));
@BeforeClass
public static void login() throws Exception {

View File

@ -1,6 +1,7 @@
package net.filebot.web;
import static net.filebot.CachedResource.*;
import static net.filebot.WebServices.*;
import static org.junit.Assert.*;
import java.net.URL;
@ -19,11 +20,9 @@ import net.filebot.CachedResource;
public class TMDbClientTest {
static TMDbClient db = new TMDbClient("66308fb6e3fd850dde4c7d21df2e8306", false);
@Test
public void searchByName() throws Exception {
List<Movie> result = db.searchMovie("Serenity", Locale.CHINESE);
List<Movie> result = TheMovieDB.searchMovie("Serenity", Locale.CHINESE);
Movie movie = result.get(0);
assertEquals("冲出宁静号", movie.getName());
@ -34,7 +33,7 @@ public class TMDbClientTest {
@Test
public void searchByNameWithYearShortName() throws Exception {
List<Movie> result = db.searchMovie("Up 2009", Locale.ENGLISH);
List<Movie> result = TheMovieDB.searchMovie("Up 2009", Locale.ENGLISH);
Movie movie = result.get(0);
assertEquals("Up", movie.getName());
@ -45,7 +44,7 @@ public class TMDbClientTest {
@Test
public void searchByNameWithYearNumberName() throws Exception {
List<Movie> result = db.searchMovie("9 (2009)", Locale.ENGLISH);
List<Movie> result = TheMovieDB.searchMovie("9 (2009)", Locale.ENGLISH);
Movie movie = result.get(0);
assertEquals("9", movie.getName());
@ -56,7 +55,7 @@ public class TMDbClientTest {
@Test
public void searchByNameGerman() throws Exception {
List<Movie> result = db.searchMovie("Die Gelbe Hölle", Locale.GERMAN);
List<Movie> result = TheMovieDB.searchMovie("Die Gelbe Hölle", Locale.GERMAN);
Movie movie = result.get(0);
assertEquals("Die gelbe Hölle", movie.getName());
@ -66,7 +65,7 @@ public class TMDbClientTest {
@Test
public void searchByNameMexican() throws Exception {
List<Movie> result = db.searchMovie("Suicide Squad", new Locale("es", "MX"));
List<Movie> result = TheMovieDB.searchMovie("Suicide Squad", new Locale("es", "MX"));
Movie movie = result.get(0);
assertEquals("Escuadrón Suicida", movie.getName());
@ -77,7 +76,7 @@ public class TMDbClientTest {
@Test
public void searchByIMDB() throws Exception {
Movie movie = db.getMovieDescriptor(new Movie(418279), Locale.ENGLISH);
Movie movie = TheMovieDB.getMovieDescriptor(new Movie(418279), Locale.ENGLISH);
assertEquals("Transformers", movie.getName());
assertEquals(2007, movie.getYear(), 0);
@ -87,7 +86,7 @@ public class TMDbClientTest {
@Test
public void getMovieInfo() throws Exception {
MovieInfo movie = db.getMovieInfo(new Movie(418279), Locale.ENGLISH, true);
MovieInfo movie = TheMovieDB.getMovieInfo(new Movie(418279), Locale.ENGLISH, true);
assertEquals("Transformers", movie.getName());
assertEquals("2007-06-27", movie.getReleased().toString());
@ -101,23 +100,23 @@ public class TMDbClientTest {
@Test
public void getMovieInfoForceLanguageCode() throws Exception {
MovieInfo shiva = db.getMovieInfo(new Movie(1260396), Locale.forLanguageTag("he-IL"), false);
MovieInfo shiva = TheMovieDB.getMovieInfo(new Movie(1260396), Locale.forLanguageTag("he-IL"), false);
assertEquals("שבעה", shiva.getName());
MovieInfo raid = db.getMovieInfo(new Movie(1899353), Locale.forLanguageTag("id-ID"), false);
MovieInfo raid = TheMovieDB.getMovieInfo(new Movie(1899353), Locale.forLanguageTag("id-ID"), false);
assertEquals("Serbuan Maut", raid.getName());
}
@Test
public void getAlternativeTitles() throws Exception {
Map<String, List<String>> titles = db.getAlternativeTitles(16320); // Serenity
Map<String, List<String>> titles = TheMovieDB.getAlternativeTitles(16320); // Serenity
assertEquals("[宁静号]", titles.get("HK").toString());
}
@Test
public void getArtwork() throws Exception {
Artwork a = db.getArtwork(16320, "backdrops", Locale.ROOT).get(0);
Artwork a = TheMovieDB.getArtwork(16320, "backdrops", Locale.ROOT).get(0);
assertEquals("[backdrops, 1920x1080]", a.getTags().toString());
assertEquals("https://image.tmdb.org/t/p/original/mQPg3iZyztfzFNwrW40nCUtXy2l.jpg", a.getUrl().toString());
assertEquals(6.0, a.getRating(), 1.0);
@ -125,7 +124,7 @@ public class TMDbClientTest {
@Test
public void getPeople() throws Exception {
Person p = db.getMovieInfo("16320", Locale.ENGLISH, true).getCrew().get(0);
Person p = TheMovieDB.getMovieInfo("16320", Locale.ENGLISH, true).getCrew().get(0);
assertEquals("Nathan Fillion", p.getName());
assertEquals("Mal", p.getCharacter());
assertEquals(null, p.getJob());
@ -136,7 +135,7 @@ public class TMDbClientTest {
@Test
public void discoverPeriod() throws Exception {
Movie m = db.discover(LocalDate.parse("2014-09-15"), LocalDate.parse("2014-10-22"), Locale.ENGLISH).get(0);
Movie m = TheMovieDB.discover(LocalDate.parse("2014-09-15"), LocalDate.parse("2014-10-22"), Locale.ENGLISH).get(0);
assertEquals("John Wick", m.getName());
assertEquals(2014, m.getYear());
@ -145,7 +144,7 @@ public class TMDbClientTest {
@Test
public void discoverBestOfYear() throws Exception {
Movie m = db.discover(2015, Locale.ENGLISH).get(0);
Movie m = TheMovieDB.discover(2015, Locale.ENGLISH).get(0);
assertEquals("Mad Max: Fury Road", m.getName());
assertEquals(2015, m.getYear());
@ -156,7 +155,7 @@ public class TMDbClientTest {
@Test
public void floodLimit() throws Exception {
for (Locale it : Locale.getAvailableLocales()) {
List<Movie> results = db.searchMovie("Serenity", it);
List<Movie> results = TheMovieDB.searchMovie("Serenity", it);
assertEquals(16320, results.get(0).getTmdbId());
}
}

View File

@ -1,5 +1,6 @@
package net.filebot.web;
import static net.filebot.WebServices.*;
import static org.junit.Assert.*;
import java.util.List;
@ -9,8 +10,6 @@ import org.junit.Test;
public class TMDbTVClientTest {
static TMDbTVClient db = new TMDbTVClient(TMDbClientTest.db);
static SearchResult buffy = new SearchResult(95, "Buffy the Vampire Slayer");
static SearchResult wonderfalls = new SearchResult(1982, "Wonderfalls");
static SearchResult firefly = new SearchResult(1437, "Firefly");
@ -18,7 +17,7 @@ public class TMDbTVClientTest {
@Test
public void search() throws Exception {
// test default language and query escaping (blanks)
List<SearchResult> results = db.search("babylon 5", Locale.ENGLISH);
List<SearchResult> results = TheMovieDB_TV.search("babylon 5", Locale.ENGLISH);
assertEquals(1, results.size());
@ -28,7 +27,7 @@ public class TMDbTVClientTest {
@Test
public void getEpisodeListAll() throws Exception {
List<Episode> list = db.getEpisodeList(buffy, SortOrder.Airdate, Locale.ENGLISH);
List<Episode> list = TheMovieDB_TV.getEpisodeList(buffy, SortOrder.Airdate, Locale.ENGLISH);
assertTrue(list.size() >= 144);
@ -55,7 +54,7 @@ public class TMDbTVClientTest {
@Test
public void getEpisodeListSingleSeason() throws Exception {
List<Episode> list = db.getEpisodeList(wonderfalls, SortOrder.Airdate, Locale.ENGLISH);
List<Episode> list = TheMovieDB_TV.getEpisodeList(wonderfalls, SortOrder.Airdate, Locale.ENGLISH);
Episode first = list.get(0);
assertEquals("Wonderfalls", first.getSeriesName());

View File

@ -1,5 +1,6 @@
package net.filebot.web;
import static net.filebot.WebServices.*;
import static net.filebot.web.EpisodeUtilities.*;
import static org.junit.Assert.*;
@ -17,7 +18,7 @@ public class TVMazeClientTest {
@Test
public void search() throws Exception {
List<SearchResult> results = client.search("Buffy", Locale.ENGLISH);
List<SearchResult> results = TVmaze.search("Buffy", Locale.ENGLISH);
SearchResult result = results.get(0);
@ -25,11 +26,9 @@ public class TVMazeClientTest {
assertEquals(buffySearchResult.getId(), result.getId());
}
private TVMazeClient client = new TVMazeClient();
@Test
public void getEpisodeList() throws Exception {
List<Episode> list = filterBySeason(client.getEpisodeList(buffySearchResult, SortOrder.Airdate, Locale.ENGLISH), 7);
List<Episode> list = filterBySeason(TVmaze.getEpisodeList(buffySearchResult, SortOrder.Airdate, Locale.ENGLISH), 7);
assertEquals(22, list.size());
@ -47,7 +46,7 @@ public class TVMazeClientTest {
@Test
public void getEpisodeListAll() throws Exception {
List<Episode> list = client.getEpisodeList(buffySearchResult, SortOrder.Airdate, Locale.ENGLISH);
List<Episode> list = TVmaze.getEpisodeList(buffySearchResult, SortOrder.Airdate, Locale.ENGLISH);
assertEquals(143, list.size());
@ -64,7 +63,7 @@ public class TVMazeClientTest {
@Test
public void getEpisodeListLinkAll() throws Exception {
assertEquals("http://www.tvmaze.com/shows/427", client.getEpisodeListLink(buffySearchResult).toString());
assertEquals("http://www.tvmaze.com/shows/427", TVmaze.getEpisodeListLink(buffySearchResult).toString());
}
}

View File

@ -1,5 +1,6 @@
package net.filebot.web;
import static net.filebot.WebServices.*;
import static org.junit.Assert.*;
import java.util.List;
@ -9,8 +10,6 @@ import org.junit.Test;
public class TheTVDBClientTest {
static TheTVDBClient db = new TheTVDBClient("BA864DEE427E384A");
SearchResult buffy = new SearchResult(70327, "Buffy the Vampire Slayer");
SearchResult wonderfalls = new SearchResult(78845, "Wonderfalls");
SearchResult firefly = new SearchResult(78874, "Firefly");
@ -18,7 +17,7 @@ public class TheTVDBClientTest {
@Test
public void search() throws Exception {
// test default language and query escaping (blanks)
List<SearchResult> results = db.search("babylon 5", Locale.ENGLISH);
List<SearchResult> results = TheTVDB.search("babylon 5", Locale.ENGLISH);
assertEquals(2, results.size());
@ -30,7 +29,7 @@ public class TheTVDBClientTest {
@Test
public void searchGerman() throws Exception {
List<SearchResult> results = db.search("Buffy", Locale.GERMAN);
List<SearchResult> results = TheTVDB.search("Buffy", Locale.GERMAN);
SearchResult first = results.get(0);
assertEquals("Buffy", first.getName());
@ -39,7 +38,7 @@ public class TheTVDBClientTest {
@Test
public void getEpisodeListAll() throws Exception {
List<Episode> list = db.getEpisodeList(buffy, SortOrder.Airdate, Locale.ENGLISH);
List<Episode> list = TheTVDB.getEpisodeList(buffy, SortOrder.Airdate, Locale.ENGLISH);
assertEquals(145, list.size());
@ -66,7 +65,7 @@ public class TheTVDBClientTest {
@Test
public void getEpisodeListSingleSeason() throws Exception {
List<Episode> list = db.getEpisodeList(wonderfalls, SortOrder.Airdate, Locale.ENGLISH);
List<Episode> list = TheTVDB.getEpisodeList(wonderfalls, SortOrder.Airdate, Locale.ENGLISH);
Episode first = list.get(0);
@ -82,7 +81,7 @@ public class TheTVDBClientTest {
@Test
public void getEpisodeListMissingInformation() throws Exception {
List<Episode> list = db.getEpisodeList(wonderfalls, SortOrder.Airdate, Locale.JAPANESE);
List<Episode> list = TheTVDB.getEpisodeList(wonderfalls, SortOrder.Airdate, Locale.JAPANESE);
Episode first = list.get(0);
@ -92,13 +91,13 @@ public class TheTVDBClientTest {
@Test
public void getEpisodeListIllegalSeries() throws Exception {
List<Episode> list = db.getEpisodeList(new SearchResult(313193, "*** DOES NOT EXIST ***"), SortOrder.Airdate, Locale.ENGLISH);
List<Episode> list = TheTVDB.getEpisodeList(new SearchResult(313193, "*** DOES NOT EXIST ***"), SortOrder.Airdate, Locale.ENGLISH);
assertTrue(list.isEmpty());
}
@Test
public void getEpisodeListNumberingDVD() throws Exception {
List<Episode> list = db.getEpisodeList(firefly, SortOrder.DVD, Locale.ENGLISH);
List<Episode> list = TheTVDB.getEpisodeList(firefly, SortOrder.DVD, Locale.ENGLISH);
Episode first = list.get(0);
assertEquals("Firefly", first.getSeriesName());
@ -112,7 +111,7 @@ public class TheTVDBClientTest {
@Test
public void getEpisodeListNumberingAbsoluteAirdate() throws Exception {
List<Episode> list = db.getEpisodeList(firefly, SortOrder.AbsoluteAirdate, Locale.ENGLISH);
List<Episode> list = TheTVDB.getEpisodeList(firefly, SortOrder.AbsoluteAirdate, Locale.ENGLISH);
Episode first = list.get(0);
assertEquals("Firefly", first.getSeriesName());
@ -125,26 +124,26 @@ public class TheTVDBClientTest {
}
public void getEpisodeListLink() {
assertEquals("http://www.thetvdb.com/?tab=seasonall&id=78874", db.getEpisodeListLink(firefly).toString());
assertEquals("http://www.thetvdb.com/?tab=seasonall&id=78874", TheTVDB.getEpisodeListLink(firefly).toString());
}
@Test
public void lookupByID() throws Exception {
SearchResult series = db.lookupByID(78874, Locale.ENGLISH);
SearchResult series = TheTVDB.lookupByID(78874, Locale.ENGLISH);
assertEquals("Firefly", series.getName());
assertEquals(78874, series.getId());
}
@Test
public void lookupByIMDbID() throws Exception {
SearchResult series = db.lookupByIMDbID(303461, Locale.ENGLISH);
SearchResult series = TheTVDB.lookupByIMDbID(303461, Locale.ENGLISH);
assertEquals("Firefly", series.getName());
assertEquals(78874, series.getId());
}
@Test
public void getSeriesInfo() throws Exception {
TheTVDBSeriesInfo it = db.getSeriesInfo(80348, Locale.ENGLISH);
TheTVDBSeriesInfo it = TheTVDB.getSeriesInfo(80348, Locale.ENGLISH);
assertEquals(80348, it.getId(), 0);
assertEquals("Action", it.getGenres().get(0));
@ -162,7 +161,7 @@ public class TheTVDBClientTest {
@Test
public void getArtwork() throws Exception {
Artwork i = db.getArtwork(buffy.getId(), "fanart", Locale.ENGLISH).get(0);
Artwork i = TheTVDB.getArtwork(buffy.getId(), "fanart", Locale.ENGLISH).get(0);
assertEquals("[fanart, graphical, 1280x720]", i.getTags().toString());
assertEquals("http://thetvdb.com/banners/fanart/original/70327-31.jpg", i.getUrl().toString());
@ -173,13 +172,13 @@ public class TheTVDBClientTest {
@Test
public void getLanguages() throws Exception {
List<String> languages = db.getLanguages();
List<String> languages = TheTVDB.getLanguages();
assertEquals("[zh, en, sv, no, da, fi, nl, de, it, es, fr, pl, hu, el, tr, ru, he, ja, pt, cs, sl, hr, ko]", languages.toString());
}
@Test
public void getActors() throws Exception {
Person p = db.getActors(firefly.getId(), Locale.ENGLISH).get(0);
Person p = TheTVDB.getActors(firefly.getId(), Locale.ENGLISH).get(0);
assertEquals("Alan Tudyk", p.getName());
assertEquals("Hoban 'Wash' Washburne", p.getCharacter());
assertEquals("Actor", p.getJob());
@ -190,7 +189,7 @@ public class TheTVDBClientTest {
@Test
public void getEpisodeInfo() throws Exception {
EpisodeInfo i = db.getEpisodeInfo(296337, Locale.ENGLISH);
EpisodeInfo i = TheTVDB.getEpisodeInfo(296337, Locale.ENGLISH);
assertEquals("78845", i.getSeriesId().toString());
assertEquals("296337", i.getId().toString());

View File

@ -1,167 +0,0 @@
package net.filebot.web;
import static org.junit.Assert.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Locale;
import org.junit.Test;
import net.filebot.web.TheTVDBClientV1.MirrorType;
public class TheTVDBClientV1Test {
TheTVDBClientV1 db = new TheTVDBClientV1("BA864DEE427E384A");
SearchResult buffy = new SearchResult(70327, "Buffy the Vampire Slayer");
SearchResult wonderfalls = new SearchResult(78845, "Wonderfalls");
SearchResult firefly = new SearchResult(78874, "Firefly");
SearchResult dracula = new SearchResult(313193, "Dracula (2016)"); // DOES NOT EXIST
@Test
public void search() throws Exception {
// test default language and query escaping (blanks)
List<SearchResult> results = db.search("babylon 5", Locale.ENGLISH);
assertEquals(2, results.size());
SearchResult first = results.get(0);
assertEquals("Babylon 5", first.getName());
assertEquals(70726, first.getId());
}
@Test
public void searchGerman() throws Exception {
List<SearchResult> results = db.search("Buffy the Vampire Slayer", Locale.GERMAN);
assertEquals(2, results.size());
SearchResult first = results.get(0);
assertEquals("Buffy the Vampire Slayer", first.getName());
assertEquals(70327, first.getId());
}
@Test
public void getEpisodeListAll() throws Exception {
List<Episode> list = db.getEpisodeList(buffy, SortOrder.Airdate, Locale.ENGLISH);
assertTrue(list.size() >= 144);
Episode first = list.get(0);
assertEquals("Buffy the Vampire Slayer", first.getSeriesName());
assertEquals("1997-03-10", first.getSeriesInfo().getStartDate().toString());
assertEquals("Welcome to the Hellmouth (1)", first.getTitle());
assertEquals("1", first.getEpisode().toString());
assertEquals("1", first.getSeason().toString());
assertEquals("1", first.getAbsolute().toString());
assertEquals("1997-03-10", first.getAirdate().toString());
}
@Test
public void getEpisodeListNull() throws Exception {
List<Episode> list = db.getEpisodeList(dracula, SortOrder.Airdate, Locale.ENGLISH);
assertTrue(list.isEmpty());
}
@Test
public void getEpisodeListSingleSeason() throws Exception {
List<Episode> list = db.getEpisodeList(wonderfalls, SortOrder.Airdate, Locale.ENGLISH);
Episode first = list.get(0);
assertEquals("Wonderfalls", first.getSeriesName());
assertEquals("2004-03-12", first.getSeriesInfo().getStartDate().toString());
assertEquals("Wax Lion", first.getTitle());
assertEquals("1", first.getEpisode().toString());
assertEquals("1", first.getSeason().toString());
assertEquals(null, first.getAbsolute()); // should be "1" but data has not yet been entered
assertEquals("2004-03-12", first.getAirdate().toString());
assertEquals("296337", first.getId().toString());
}
@Test
public void getEpisodeListNumberingDVD() throws Exception {
List<Episode> list = db.getEpisodeList(firefly, SortOrder.DVD, Locale.ENGLISH);
Episode first = list.get(0);
assertEquals("Firefly", first.getSeriesName());
assertEquals("2002-09-20", first.getSeriesInfo().getStartDate().toString());
assertEquals("Serenity", first.getTitle());
assertEquals("1", first.getEpisode().toString());
assertEquals("1", first.getSeason().toString());
assertEquals("1", first.getAbsolute().toString());
assertEquals("2002-12-20", first.getAirdate().toString());
assertEquals("297999", first.getId().toString());
}
@Test
public void getEpisodeListNumberingAbsoluteAirdate() throws Exception {
List<Episode> list = db.getEpisodeList(firefly, SortOrder.AbsoluteAirdate, Locale.ENGLISH);
Episode first = list.get(0);
assertEquals("Firefly", first.getSeriesName());
assertEquals("2002-09-20", first.getSeriesInfo().getStartDate().toString());
assertEquals("The Train Job", first.getTitle());
assertEquals("20020920", first.getEpisode().toString());
assertEquals(null, first.getSeason());
assertEquals("2", first.getAbsolute().toString());
assertEquals("2002-09-20", first.getAirdate().toString());
}
public void getEpisodeListLink() {
assertEquals("http://www.thetvdb.com/?tab=seasonall&id=78874", db.getEpisodeListLink(firefly).toString());
}
@Test
public void resolveTypeMask() {
// no flags set
assertEquals(MirrorType.newSet(), MirrorType.fromTypeMask(0));
// all flags set
assertEquals(EnumSet.of(MirrorType.SEARCH, MirrorType.XML, MirrorType.BANNER), MirrorType.fromTypeMask(7));
}
@Test
public void lookupByID() throws Exception {
SearchResult series = db.lookupByID(78874, Locale.ENGLISH);
assertEquals("Firefly", series.getName());
assertEquals(78874, series.getId());
}
@Test
public void lookupByIMDbID() throws Exception {
SearchResult series = db.lookupByIMDbID(303461, Locale.ENGLISH);
assertEquals("Firefly", series.getName());
assertEquals(78874, series.getId());
}
@Test
public void getSeriesInfo() throws Exception {
TheTVDBSeriesInfo it = (TheTVDBSeriesInfo) db.getSeriesInfo(80348, Locale.ENGLISH);
assertEquals(80348, it.getId(), 0);
assertEquals("TV-PG", it.getCertification());
assertEquals("2007-09-24", it.getStartDate().toString());
assertEquals("Action", it.getGenres().get(0));
assertEquals("tt0934814", it.getImdbId());
assertEquals("en", it.getLanguage());
assertEquals("45", it.getRuntime().toString());
assertEquals("Chuck", it.getName());
}
@Test
public void getBanner() throws Exception {
Artwork banner = db.getArtwork(buffy.getId(), "season", Locale.ROOT).stream().filter(it -> {
return it.matches("season", "seasonwide", "7", "en");
}).findFirst().get();
assertEquals("season", banner.getTags().get(0));
assertEquals("seasonwide", banner.getTags().get(1));
assertEquals("http://thetvdb.com/banners/seasonswide/70327-7.jpg", banner.getUrl().toString());
assertEquals(99712, WebRequest.fetch(banner.getUrl()).remaining(), 0);
}
}