diff --git a/src/Aviat/AnimeClient/Model/Anime.php b/src/Aviat/AnimeClient/Model/Anime.php index 4bd0dc8e..13ab51d0 100644 --- a/src/Aviat/AnimeClient/Model/Anime.php +++ b/src/Aviat/AnimeClient/Model/Anime.php @@ -125,7 +125,7 @@ class Anime extends API { $response = $this->client->get("anime/{$anime_id}", $config); - return $response->json(); + return json_decode($response->getBody(), TRUE); } /** diff --git a/tests/AnimeClient/Model/AnimeCollectionModelTest.php b/tests/AnimeClient/Model/AnimeCollectionModelTest.php index 1f7bc228..c23da485 100644 --- a/tests/AnimeClient/Model/AnimeCollectionModelTest.php +++ b/tests/AnimeClient/Model/AnimeCollectionModelTest.php @@ -53,4 +53,24 @@ class AnimeCollectionModelTest extends AnimeClient_TestCase { $collectionModel = new Friend(new AnimeCollectionModel($this->container)); $this->assertFalse($collectionModel->valid_database); } + + public function testNonExistentDatabase() + { + $this->container->set('config', new Config([ + 'database' => [ + 'collection' => [ + 'type' => 'sqlite', + 'host' => '', + 'user' => '', + 'pass' => '', + 'port' => '', + 'name' => 'default', + 'database' => '', + 'file' => '/foo/bar/baz/foobazbar.db', + ] + ] + ])); + $collectionModel = new Friend(new AnimeCollectionModel($this->container)); + $this->assertFalse($collectionModel->valid_database); + } } \ No newline at end of file diff --git a/tests/AnimeClient/Model/AnimeModelTest-inProgress.php b/tests/AnimeClient/Model/AnimeModelTest-inProgress.php deleted file mode 100644 index 9b4f092b..00000000 --- a/tests/AnimeClient/Model/AnimeModelTest-inProgress.php +++ /dev/null @@ -1,30 +0,0 @@ -animeModel = new Friend(new TestAnimeModel($this->container)); - } - - protected function _pluck_anime_titles($array) - { - $out = []; - foreach($array as $index => $item) - { - $out[] = $item['anime']['title']; - } - - return $out; - } - - /*public function testSortByName() - { - $data = $this->animeModel->_get_list_from_api("completed"); - }*/ -} \ No newline at end of file diff --git a/tests/AnimeClient/Model/AnimeModelTest.php b/tests/AnimeClient/Model/AnimeModelTest.php new file mode 100644 index 00000000..67abd434 --- /dev/null +++ b/tests/AnimeClient/Model/AnimeModelTest.php @@ -0,0 +1,62 @@ +animeModel = new Friend(new TestAnimeModel($this->container)); + $this->mockDir = __DIR__ . '/../../test_data/anime_list/search_mocks'; + } + + public function dataSearch() + { + return [ + 'nonsense search' => [ + 'search' => 'foo', + ], + 'search for common series' => [ + 'search' => 'Fate', + ], + 'search for weird series' => [ + 'search' => 'Twintails', + ] + ]; + } + + /** + * @dataProvider dataSearch + */ + public function testSearch($search) + { + // Mock requests + $json = file_get_contents(_dir($this->mockDir, "{$search}.json")); + $client = $this->getMockClient(200, [ + 'Content-Type' => 'application/json' + ], $json); + $this->animeModel->__set('client', $client); + + $actual = $this->animeModel->search($search); + $this->assertEquals(json_decode($json, TRUE), $actual); + } + + public function testSearchBadResponse() + { + $client = $this->getMockClient(400, [ + 'Content-Type' => 'application/json' + ], "[]"); + $this->animeModel->__set('client', $client); + + $this->setExpectedException('\RuntimeException'); + $this->animeModel->search(''); + } +} \ No newline at end of file diff --git a/tests/AnimeClient_TestCase.php b/tests/AnimeClient_TestCase.php index e8c9cadd..36f4bd2a 100644 --- a/tests/AnimeClient_TestCase.php +++ b/tests/AnimeClient_TestCase.php @@ -1,6 +1,10 @@ container->set('request', $web_factory->newRequest()); $this->container->set('response', $web_factory->newResponse()); } + + /** + * Create a mock guzzle client for testing + * api call methods + * + * @param int $code The status code + * @param array $headers + * @param string $body + * @return Client + */ + public function getMockClient($code, $headers, $body) + { + $mock = new MockHandler([ + new Response($code, $headers, $body) + ]); + $handler = HandlerStack::create($mock); + $client = new Client(['handler' => $handler]); + + return $client; + } } // End of AnimeClient_TestCase.php \ No newline at end of file diff --git a/tests/mocks.php b/tests/mocks.php index 2a52bed3..e45bf549 100644 --- a/tests/mocks.php +++ b/tests/mocks.php @@ -59,17 +59,17 @@ class FriendTestClass extends FriendParentTestClass { } class TestTransformer extends AbstractTransformer { - + public function transform($item) { $out = []; $genre_list = (array) $item; - + foreach($genre_list as $genre) { $out[] = $genre['name']; } - + return $out; } } @@ -114,16 +114,13 @@ class TestJsonView extends JsonView { // ----------------------------------------------------------------------------- // AnimeClient Mocks // ----------------------------------------------------------------------------- - -class MockBaseApiModel extends BaseApiModel { - - protected $base_url = 'https://httpbin.org/'; +trait MockInjectionTrait { public function __get($key) { return $this->$key; } - + public function __set($key, $value) { $this->$key = $value; @@ -131,22 +128,15 @@ class MockBaseApiModel extends BaseApiModel { } } +class MockBaseApiModel extends BaseApiModel { + + use MockInjectionTrait; + protected $base_url = 'https://httpbin.org/'; + +} + class TestAnimeModel extends AnimeModel { - protected $transformed_data_file; - - public function __construct(ContainerInterface $container) - { - parent::__construct($container); - $this->transformed_data_file = _dir( - TEST_DATA_DIR, 'anime_list','anime-completed-transformed.json' - ); - } - - protected function _get_list_from_api($status="all") - { - $data = json_decode(file_get_contents($this->transformed_data_file), TRUE); - return $data; - } + use MockInjectionTrait; } // End of mocks.php \ No newline at end of file diff --git a/tests/test_data/anime_list/search_mocks/Fate.json b/tests/test_data/anime_list/search_mocks/Fate.json new file mode 100644 index 00000000..e7074f19 --- /dev/null +++ b/tests/test_data/anime_list/search_mocks/Fate.json @@ -0,0 +1 @@ +[{"id":6028,"mal_id":10087,"slug":"fate-zero","status":"Finished Airing","url":"https://hummingbird.me/anime/fate-zero","title":"Fate/Zero","alternate_title":"","episode_count":13,"episode_length":24,"cover_image":"https://static.hummingbird.me/anime/poster_images/000/006/028/large/fat.jpg?1410533243","synopsis":"Fate/Zero takes place 10 years prior to the events of Fate/stay night, detailing the events of the 4th Holy Grail War in Fuyuki City. The War of the Holy Grail is a contest in which seven magi summon seven Heroic Spirits to compete to obtain the power of the \"Holy Grail,\" which grants a miracle. After three inconclusive wars for the elusive Holy Grail, the Fourth War commences.\n\nFounded by the Einzbern, Makiri, and Tohsaka families centuries ago, the Einzbern family is determined to achieve success after three successive failures, no matter the cost. As a result, they have elected to bring the hated magus killer, Kiritsugu Emiya, into their ranks, despite his methods and reputation as a skilled mercenary and a hitman who employs whatever he can use to accomplish his goals. Though Kiritsugu had once wanted to become a hero who could save everyone, he has long since abandoned this ideal upon realizing that saving one person comes at the cost of another's life. For the sake of humanity, he will ruthlessly destroy anything and anyone who threatens the peace of others.\n\nHowever, Kiritsugu finds himself deeply torn between the love he has found for his new family—his wife Irisviel and their daughter Illya—and what he must do to obtain the Holy Grail. Meanwhile, Kiritsugu's greatest opponent appears in the form of Kirei Kotomine, a priest who cannot find any sense of fulfillment in his life and sets his sights on Kiritsugu as the possible answer to the emptiness he feels.\n\n(Source: Wikipedia)","show_type":"TV","started_airing":"2011-10-02","finished_airing":"2011-12-25","community_rating":4.38312457029746,"age_rating":"R17+","genres":[{"name":"Action"},{"name":"Supernatural"},{"name":"Fantasy"}]},{"id":6765,"mal_id":12565,"slug":"fate-prototype","status":"Finished Airing","url":"https://hummingbird.me/anime/fate-prototype","title":"Fate/Prototype","alternate_title":"","episode_count":1,"episode_length":12,"cover_image":"https://static.hummingbird.me/anime/poster_images/000/006/765/large/Fate.jpg?1408459344","synopsis":"Fate/Prototype is a digest version of Nasu's original version of Fate/stay night.","show_type":"OVA","started_airing":"2011-12-31","finished_airing":null,"community_rating":3.44598734485711,"age_rating":"PG13","genres":[{"name":"Action"},{"name":"Magic"},{"name":"Supernatural"},{"name":"Fantasy"},{"name":"Romance"}]},{"id":323,"mal_id":356,"slug":"fate-stay-night","status":"Finished Airing","url":"https://hummingbird.me/anime/fate-stay-night","title":"Fate/stay night","alternate_title":"","episode_count":24,"episode_length":24,"cover_image":"https://static.hummingbird.me/anime/poster_images/000/000/323/large/irvXBWz58WtYl.jpg?1416268420","synopsis":"Raised by a mysterious sorcerer after the horrific death of his parents, Shiro Emiya has only just begun to help others using the small tidbits of magic that he's learned. However, when he's suddenly caught in a battle between two more powerful Magus, Shiro finds himself performing a spell above his expected ability, summoning the beautiful spirit warrior Saber to protect him! But safety is only momentary as Shiro and Saber now find themselves thrust into in a secret world of dark magic and deadly challenges: a no-holds barred duel to the death known as the Holy Grail War! At stake: a prize of unimaginable power. But can the inexperienced Shiro and Saber survive long enough to even enter the contest? First they'll have to withstand waves of treachery and assassination, even as Shiro scrambles to learn everything he'll need to know to stay alive as seven teams of Magus and Spirit Servants face off in mortal combat! \r\n(Source: Sentai Filmworks) ","show_type":"TV","started_airing":"2006-01-07","finished_airing":"2006-06-17","community_rating":3.58189654137179,"age_rating":"R17+","genres":[{"name":"Action"},{"name":"Magic"},{"name":"Supernatural"},{"name":"Fantasy"},{"name":"Romance"}]},{"id":6906,"mal_id":13183,"slug":"fate-zero-remix","status":"Finished Airing","url":"https://hummingbird.me/anime/fate-zero-remix","title":"Fate/Zero Remix","alternate_title":null,"episode_count":2,"episode_length":24,"cover_image":"https://static.hummingbird.me/anime/poster_images/000/006/906/large/6906.jpg?1408459721","synopsis":"Two recap specials titled \"Fate/Zero Remix I\" and \"Fate/Zero Remix II\" serve to summarize the first 13 episodes of Fate/Zero.","show_type":"Special","started_airing":"2012-03-25","finished_airing":"2012-04-01","community_rating":3.61629645419437,"age_rating":"R17+","genres":[{"name":"Action"},{"name":"Supernatural"},{"name":"Fantasy"}]},{"id":7873,"mal_id":19165,"slug":"fate-zero-cafe","status":"Finished Airing","url":"https://hummingbird.me/anime/fate-zero-cafe","title":"Fate/Zero Cafe","alternate_title":"","episode_count":1,"episode_length":null,"cover_image":"https://static.hummingbird.me/anime/poster_images/000/007/873/large/51943.jpg?1408462757","synopsis":"The story re-imagines the cast of the Fate/Zero as cute super-deformed characters who open a café, led by Saber as the manager.\r\n(Source: ANN)","show_type":"Movie","started_airing":"2013-07-13","finished_airing":null,"community_rating":3.42412644067366,"age_rating":"G","genres":[{"name":"Comedy"}]},{"id":7658,"mal_id":11741,"slug":"fate-zero-2nd-season","status":"Finished Airing","url":"https://hummingbird.me/anime/fate-zero-2nd-season","title":"Fate/Zero 2nd Season","alternate_title":null,"episode_count":12,"episode_length":24,"cover_image":"https://static.hummingbird.me/anime/poster_images/000/007/658/large/cover.jpg?1421091601","synopsis":"The battle for the Holy Grail continues, with more lives lost and more secrets revealed. When the curtain falls, who will emerge victorious is anyone's guess... And what \"victorious\" truly means, is even more questionable.\n(Source: ANN)","show_type":"TV","started_airing":"2012-04-08","finished_airing":"2012-06-24","community_rating":4.45751383508293,"age_rating":"R17+","genres":[{"name":"Action"},{"name":"Supernatural"},{"name":"Fantasy"},{"name":"Thriller"}]},{"id":8024,"mal_id":20543,"slug":"bayonetta-bloody-fate","status":"Finished Airing","url":"https://hummingbird.me/anime/bayonetta-bloody-fate","title":"Bayonetta: Bloody Fate","alternate_title":"","episode_count":1,"episode_length":89,"cover_image":"https://static.hummingbird.me/anime/poster_images/000/008/024/large/BayonettaCov.jpg?1416274970","synopsis":"","show_type":"Movie","started_airing":"2013-11-23","finished_airing":null,"community_rating":3.22048513179247,"age_rating":null,"genres":[]},{"id":5028,"mal_id":7559,"slug":"fate-stay-night-tv-reproduction","status":"Finished Airing","url":"https://hummingbird.me/anime/fate-stay-night-tv-reproduction","title":"Fate/stay night TV Reproduction","alternate_title":"","episode_count":2,"episode_length":60,"cover_image":"https://static.hummingbird.me/anime/poster_images/000/005/028/large/5028.jpg?1408454141","synopsis":"An edited and condensed version of the TV series.","show_type":"OVA","started_airing":"2010-01-17","finished_airing":"2010-01-17","community_rating":3.33754846007069,"age_rating":"PG13","genres":[{"name":"Action"},{"name":"Magic"},{"name":"Supernatural"},{"name":"Fantasy"},{"name":"Romance"}]},{"id":7173,"mal_id":14829,"slug":"fate-kaleid-liner-prisma-illya","status":"Finished Airing","url":"https://hummingbird.me/anime/fate-kaleid-liner-prisma-illya","title":"Fate/kaleid liner Prisma☆Illya","alternate_title":"","episode_count":10,"episode_length":24,"cover_image":"https://static.hummingbird.me/anime/poster_images/000/007/173/large/2077629048_d8d4f459_1.jpg?1417705350","synopsis":"Spin-off of Fate/stay night with Illyasviel von Einzbern as the protagonist, living an alternate life as a school girl.","show_type":"TV","started_airing":"2013-06-22","finished_airing":"2013-09-07","community_rating":3.57979413790543,"age_rating":"PG13","genres":[{"name":"Action"},{"name":"Comedy"},{"name":"Magic"},{"name":"Fantasy"},{"name":"Mahou Shoujo"}]},{"id":8675,"mal_id":25537,"slug":"fate-stay-night-heaven-s-feel","status":"Not Yet Aired","url":"https://hummingbird.me/anime/fate-stay-night-heaven-s-feel","title":"Fate/stay night: Heaven's Feel","alternate_title":null,"episode_count":1,"episode_length":null,"cover_image":"https://static.hummingbird.me/anime/poster_images/000/008/675/large/main.jpg?1417531554","synopsis":"Movie adaptation of the third route of Fate/stay night.","show_type":"Movie","started_airing":null,"finished_airing":null,"community_rating":4.28896100611121,"age_rating":"R17+","genres":[{"name":"Action"},{"name":"Magic"},{"name":"Supernatural"},{"name":"Fantasy"}]},{"id":7858,"mal_id":19109,"slug":"fate-kaleid-liner-prisma-illya-specials","status":"Finished Airing","url":"https://hummingbird.me/anime/fate-kaleid-liner-prisma-illya-specials","title":"Fate/kaleid liner Prisma☆Illya Specials","alternate_title":"","episode_count":5,"episode_length":5,"cover_image":"https://static.hummingbird.me/anime/poster_images/000/007/858/large/eb4ttx.jpg?1417831577","synopsis":"Specials bundled with all the BD/DVD volumes.\r\n","show_type":"Special","started_airing":"2013-09-27","finished_airing":"2014-01-31","community_rating":3.32885886149236,"age_rating":"PG13","genres":[{"name":"Comedy"},{"name":"Magic"},{"name":"Fantasy"}]},{"id":8003,"mal_id":20509,"slug":"fate-kaleid-liner-prisma-illya-2wei","status":"Finished Airing","url":"https://hummingbird.me/anime/fate-kaleid-liner-prisma-illya-2wei","title":"Fate/kaleid liner Prisma☆Illya 2wei!","alternate_title":null,"episode_count":10,"episode_length":23,"cover_image":"https://static.hummingbird.me/anime/poster_images/000/008/003/large/2bPZ3MM.jpg?1417705353","synopsis":"About a month after the events of the first season, a new mission to normalize the Earth's pulsations comes up. However, when Illya tries to subdue the pulsations...","show_type":"TV","started_airing":"2014-07-10","finished_airing":"2014-09-11","community_rating":3.69041590342813,"age_rating":"PG13","genres":[{"name":"Action"},{"name":"Comedy"},{"name":"Magic"},{"name":"Supernatural"},{"name":"Fantasy"},{"name":"Mahou Shoujo"}]},{"id":11438,"mal_id":31706,"slug":"fate-kaleid-liner-prisma-illya-3rei","status":"Not Yet Aired","url":"https://hummingbird.me/anime/fate-kaleid-liner-prisma-illya-3rei","title":"Fate/kaleid liner Prisma☆Illya 3rei!!","alternate_title":"","episode_count":null,"episode_length":null,"cover_image":"https://static.hummingbird.me/anime/poster_images/000/011/438/large/71IgP2zWhGL.jpg?1444436293","synopsis":"Fourth season of the Fate/kaleid liner Prisma☆Illya series.","show_type":"TV","started_airing":null,"finished_airing":null,"community_rating":0.0,"age_rating":null,"genres":[{"name":"Action"},{"name":"Comedy"},{"name":"Magic"},{"name":"Fantasy"},{"name":"Slice of Life"},{"name":"Mahou Shoujo"}]},{"id":7882,"mal_id":22297,"slug":"fate-stay-night-unlimited-blade-works-2014","status":"Finished Airing","url":"https://hummingbird.me/anime/fate-stay-night-unlimited-blade-works-2014","title":"Fate/stay night: Unlimited Blade Works (TV)","alternate_title":"","episode_count":12,"episode_length":28,"cover_image":"https://static.hummingbird.me/anime/poster_images/000/007/882/large/X9QaZvX.jpg?1435979093","synopsis":"New anime adaptation of Fate/stay night, following the Unlimited Blade Works route.\r\n\r\nThis story focuses primarily on the heroine Rin Tohsaka. After her father’s death, Rin enters the Holy Grail War as the sole heir to the prestigious Tohsaka Household, with her servant Archer. But, she soon finds out that Shirou Emiya, a boy from her high school has gotten himself involved in the battles and unexpectedly saves him when he is fatally injured. Before long, Rin sets out to strike down the conspiracies surrounding the Holy Grail War along with Shirou and his summoned servant Saber. And so, the story begins to explore the truth behind Shirou’s powers and the nature behind his unyielding will to become a “hero.”\r\n\r\n(Source: Crunchyroll)","show_type":"TV","started_airing":"2014-10-12","finished_airing":"2014-12-28","community_rating":4.27421649993599,"age_rating":"R17+","genres":[{"name":"Action"},{"name":"Magic"},{"name":"Supernatural"},{"name":"Fantasy"}]},{"id":8831,"mal_id":26057,"slug":"fate-kaleid-liner-prisma-illya-2wei-ova","status":"Finished Airing","url":"https://hummingbird.me/anime/fate-kaleid-liner-prisma-illya-2wei-ova","title":"Fate/kaleid liner Prisma☆Illya 2wei! OVA","alternate_title":null,"episode_count":1,"episode_length":30,"cover_image":"https://static.hummingbird.me/anime/poster_images/000/008/831/large/YMaw0GZ.jpg?1428097481","synopsis":"OAD bundled with the limited edition sixth volume of the \"Fate/kaleid liner Prisma Illya Drei!!\" manga.\n\n(Source: ANN)","show_type":"OVA","started_airing":"2015-07-25","finished_airing":null,"community_rating":3.65767496245168,"age_rating":"PG13","genres":[{"name":"Action"},{"name":"Comedy"},{"name":"Magic"},{"name":"Fantasy"},{"name":"Ecchi"},{"name":"Mahou Shoujo"}]},{"id":9095,"mal_id":27525,"slug":"fate-kaleid-liner-prisma-illya-2wei-herz","status":"Finished Airing","url":"https://hummingbird.me/anime/fate-kaleid-liner-prisma-illya-2wei-herz","title":"Fate/kaleid liner Prisma☆Illya 2wei Herz!","alternate_title":null,"episode_count":10,"episode_length":23,"cover_image":"https://static.hummingbird.me/anime/poster_images/000/009/095/large/Q0l30yH.jpg?1427031275","synopsis":"Third season of Fate/kaleid Liner Prisma Illya.","show_type":"TV","started_airing":"2015-07-24","finished_airing":"2015-09-26","community_rating":3.72636750907894,"age_rating":"PG13","genres":[{"name":"Action"},{"name":"Comedy"},{"name":"Magic"},{"name":"Fantasy"},{"name":"Mahou Shoujo"}]},{"id":4788,"mal_id":6922,"slug":"fate-stay-night-unlimited-blade-works","status":"Finished Airing","url":"https://hummingbird.me/anime/fate-stay-night-unlimited-blade-works","title":"Fate/stay night: Unlimited Blade Works","alternate_title":"Fate/stay night - Unlimited Blade Works","episode_count":1,"episode_length":100,"cover_image":"https://static.hummingbird.me/anime/poster_images/000/004/788/large/fate_stay_night_438.jpg?1439074735","synopsis":"This is the adaptation of the 2nd route of the popular visual novel: Fate/Stay Night. In this route, Tohsaka Rin will be the major female character. Revelations about Shirou and his destiny will be made.\n\n(Source: AnimeNfo)","show_type":"Movie","started_airing":"2010-01-23","finished_airing":null,"community_rating":3.66795668070922,"age_rating":"R17+","genres":[{"name":"Action"},{"name":"Magic"},{"name":"Supernatural"},{"name":"Fantasy"}]},{"id":7861,"mal_id":18851,"slug":"fate-kaleid-liner-prisma-illya-2014","status":"Finished Airing","url":"https://hummingbird.me/anime/fate-kaleid-liner-prisma-illya-2014","title":"Fate/kaleid liner Prisma☆Illya: Undoukai de Dance!","alternate_title":"","episode_count":1,"episode_length":25,"cover_image":"https://static.hummingbird.me/anime/poster_images/000/007/861/large/fate.jpg?1412709442","synopsis":"Illyasviel von Einzbern, an ordinary elementary schoolgirl who dreams about anime magical girls—until she encounters Magical Ruby and assumes the duties of a real magical girl.\r\n(Source: ANN)","show_type":"OVA","started_airing":"2014-01-25","finished_airing":null,"community_rating":3.24918648762793,"age_rating":"PG-13","genres":[{"name":"Action"},{"name":"Comedy"},{"name":"Magic"},{"name":"Supernatural"},{"name":"Fantasy"},{"name":"Ecchi"},{"name":"Mahou Shoujo"}]},{"id":9718,"mal_id":27821,"slug":"fate-stay-night-unlimited-blade-works-tv-episode-0","status":"Finished Airing","url":"https://hummingbird.me/anime/fate-stay-night-unlimited-blade-works-tv-episode-0","title":"Fate/stay night: Unlimited Blade Works Episode 0","alternate_title":"","episode_count":1,"episode_length":51,"cover_image":"https://static.hummingbird.me/anime/poster_images/000/009/718/large/A15843-1460376551.1406470005.jpg?1416324010","synopsis":"Pilot episode of Fate/stay night: Unlimited Blade Works (TV), adapting the prologue of the visual novel.","show_type":"TV","started_airing":"2014-10-05","finished_airing":null,"community_rating":4.22169440741569,"age_rating":"R17+","genres":[{"name":"Action"},{"name":"Magic"},{"name":"Supernatural"},{"name":"Fantasy"}]},{"id":11176,"mal_id":31056,"slug":"fate-kaleid-liner-prisma-illya-2wei-herz-specials","status":"Currently Airing","url":"https://hummingbird.me/anime/fate-kaleid-liner-prisma-illya-2wei-herz-specials","title":"Fate/kaleid liner Prisma☆Illya 2wei Herz! Specials","alternate_title":null,"episode_count":5,"episode_length":5,"cover_image":"https://static.hummingbird.me/anime/poster_images/000/011/176/large/bd01_jk.jpg?1443118523","synopsis":"The official website of the Fate/kaleid liner Prisma Illya anime franchise revealed on Friday that the Blu-ray Disc volumes and the limited-edition DVD volumes of the Fate/kaleid liner Prisma Illya 2wei Herz! anime will each contain a five-minute episode of a short anime titled \"Beast, Again!\" (Beast, Futatabi!).\n\n(Source: ANN)","show_type":"Special","started_airing":"2015-09-25","finished_airing":null,"community_rating":0.0,"age_rating":null,"genres":[{"name":"Comedy"},{"name":"Ecchi"}]}] \ No newline at end of file diff --git a/tests/test_data/anime_list/search_mocks/Twintails.json b/tests/test_data/anime_list/search_mocks/Twintails.json new file mode 100644 index 00000000..e4f8d56b --- /dev/null +++ b/tests/test_data/anime_list/search_mocks/Twintails.json @@ -0,0 +1 @@ +[{"id":8710,"mal_id":24705,"slug":"ore-twintails-ni-narimasu","status":"Finished Airing","url":"https://hummingbird.me/anime/ore-twintails-ni-narimasu","title":"Ore, Twintails ni Narimasu.","alternate_title":"Gonna be the Twin-Tails!!","episode_count":12,"episode_length":24,"cover_image":"https://static.hummingbird.me/anime/poster_images/000/008/710/large/ore-twintails-ni-narimasu.jpg?1416244663","synopsis":"Mitsuka Souji is a first year high school student who greatly loves the \"twintails\" hairstyle. One day a beautiful girl, Twoearle, who comes from another world suddenly appeared in front of him and gave him the power to transform into the twintails warrior TailRed. Now Souji, with the help of his childhood friend Tsube Aika who can becomes the twintails warrior TailBlue, must fight in order to protect the peace on earth.\n\n(Source: Wikipedia)","show_type":"TV","started_airing":"2014-10-10","finished_airing":"2014-12-26","community_rating":3.32172789396078,"age_rating":"PG13","genres":[{"name":"Action"},{"name":"Comedy"},{"name":"Fantasy"},{"name":"Romance"},{"name":"School"},{"name":"Gender Bender"}]}] \ No newline at end of file diff --git a/tests/test_data/anime_list/search_mocks/foo.json b/tests/test_data/anime_list/search_mocks/foo.json new file mode 100644 index 00000000..5ed96c68 --- /dev/null +++ b/tests/test_data/anime_list/search_mocks/foo.json @@ -0,0 +1 @@ +[{"id":2072,"mal_id":2287,"slug":"fighting-foodons","status":"Finished Airing","url":"https://hummingbird.me/anime/fighting-foodons","title":"Fighting Foodons","alternate_title":null,"episode_count":26,"episode_length":25,"cover_image":"https://static.hummingbird.me/anime/poster_images/000/002/072/large/2072.jpg?1408445717","synopsis":"An 11-year old boy named Zen bands together with his younger sister, Karen, and a young boy who has a large appetite, Pitan, to battle an evil empire by using their \"Foodons\"; strange monsters that are created from various foods.\r\n(Source: ANN)","show_type":"TV","started_airing":"2001-12-11","finished_airing":"2002-06-25","community_rating":3.34829240336234,"age_rating":"G","genres":[{"name":"Adventure"},{"name":"Comedy"},{"name":"Fantasy"},{"name":"Game"}]},{"id":8076,"mal_id":21177,"slug":"nobunaga-the-fool","status":"Finished Airing","url":"https://hummingbird.me/anime/nobunaga-the-fool","title":"Nobunaga the Fool","alternate_title":"","episode_count":24,"episode_length":24,"cover_image":"https://static.hummingbird.me/anime/poster_images/000/008/076/large/Mo6KEK4.jpg?1418957602","synopsis":"Once upon a time, the two sides were bound by the \"Dragon Pulse\" spanning the heavens. The civilization that once had prospered has now turned to a tale of dreams, as the inextinguishable flames of war tear the realm asunder. The two planets remain engulfed in endless battles. The return of the super technology known as \"sacred treasures\" could revolutionize the world order, but no one knows of them but one person — a \"heretical girl.\" A girl from the Western Planet, Jeanne Kaguya d'Arc, saw heavenly visions of the birth of a \"Star Messiah\" who will save the world. She embarks on a journey to the Eastern Planet with Leonardo da Vinci, \"the one who observes the world.\" They come across the heretic of the Eastern Planet and \"the greatest fool of the day,\" Oda Nobunaga.\r\n[Source: ANN]","show_type":"TV","started_airing":"2014-01-06","finished_airing":"2014-06-23","community_rating":3.05059451693133,"age_rating":"PG13","genres":[{"name":"Action"},{"name":"Sci-Fi"},{"name":"Mecha"}]},{"id":202,"mal_id":227,"slug":"flcl","status":"Finished Airing","url":"https://hummingbird.me/anime/flcl","title":"FLCL","alternate_title":"Fooly Cooly","episode_count":6,"episode_length":25,"cover_image":"https://static.hummingbird.me/anime/poster_images/000/000/202/large/flcl.jpg?1416333917","synopsis":"Naota is a normal Japanese 6th grade boy (although a little cynical), but when his older brother leaves for America to play baseball, his brother leaves his homeless 17 year old girlfriend Mamimi behind. Mamimi is sending mixed signals and advances to Naota, and he doesn't know what to do about her. But to make matters worse, Naota's world is totally turned upside down when he is run over by a woman on a Vespa. During their first encounter, she hits him over the head with her bass guitar, which then causes a horn to grow out of his forehead. She calls herself \"Haruko\" and her presence changes Naota's life to even further insanity.\n\n(Source: ANN)","show_type":"OVA","started_airing":"2000-04-26","finished_airing":"2001-03-16","community_rating":4.07436539869193,"age_rating":"PG13","genres":[{"name":"Action"},{"name":"Comedy"},{"name":"Sci-Fi"},{"name":"Dementia"},{"name":"Mecha"},{"name":"Parody"}]},{"id":2918,"mal_id":3299,"slug":"h2o-footprints-in-the-sand","status":"Finished Airing","url":"https://hummingbird.me/anime/h2o-footprints-in-the-sand","title":"H2O: Footprints in the Sand","alternate_title":"","episode_count":12,"episode_length":24,"cover_image":"https://static.hummingbird.me/anime/poster_images/000/002/918/large/2918.jpg?1408448155","synopsis":"Takuma Hirose is a blind young male high school student, though the cause for his blindness is undetermined. In order to heal his medical condition, he is sent to live in a village with his uncle. There, he meets several girls, three of which stand out more than any of the others. They are Hayami Kohinata, Hinata Kangura, and Otoha. Otoha temporarily heals his blindness and Hirose uses his sight to help others. He finds out that, for some reason, Hayami Kohinata is hated in the village, and he tries his best to help her out. Meanwhile, many sad secrets unfold in the village...","show_type":"TV","started_airing":"2008-01-03","finished_airing":"2008-03-20","community_rating":3.441786526783,"age_rating":"PG13","genres":[{"name":"Drama"},{"name":"Romance"},{"name":"Psychological"},{"name":"School"},{"name":"Dementia"}]},{"id":8527,"mal_id":24437,"slug":"world-fool-news","status":"Finished Airing","url":"https://hummingbird.me/anime/world-fool-news","title":"World Fool News","alternate_title":null,"episode_count":6,"episode_length":5,"cover_image":"https://static.hummingbird.me/anime/poster_images/000/008/527/large/63067.jpg?1408464711","synopsis":"Takahashi is transferred to a main anchor of a news program, which is known for being a little...weird. This is a comedy about somewhat ridiculous happenings occurring at a broadcasting station.\n\n(Source: YouTube)","show_type":"ONA","started_airing":"2013-04-01","finished_airing":"2013-05-06","community_rating":0.0,"age_rating":"G","genres":[{"name":"Comedy"},{"name":"Slice of Life"}]},{"id":7033,"mal_id":13807,"slug":"corpse-party-missing-footage","status":"Finished Airing","url":"https://hummingbird.me/anime/corpse-party-missing-footage","title":"Corpse Party: Missing Footage","alternate_title":null,"episode_count":1,"episode_length":11,"cover_image":"https://static.hummingbird.me/anime/poster_images/000/007/033/large/713yk0oqSJL.jpg?1441227661","synopsis":"An original video anime bundled with a limited-number edition of Corpse Party -The Anthology- Sachiko no Renai Yuugi Hysteric Birthday 2U (コープスパーティー -THE ANTHOLOGY- サチコの恋愛遊戯Hysteric Birthday 2U) spinoff game.\n\n(Source: ANN)","show_type":"OVA","started_airing":"2012-08-02","finished_airing":"2012-08-01","community_rating":2.96168135153526,"age_rating":"R17+","genres":[{"name":"Horror"},{"name":"School"}]},{"id":8448,"mal_id":18205,"slug":"world-fool-news-tv","status":"Finished Airing","url":"https://hummingbird.me/anime/world-fool-news-tv","title":"World Fool News (TV)","alternate_title":"","episode_count":12,"episode_length":7,"cover_image":"https://static.hummingbird.me/anime/poster_images/000/008/448/large/533e456351cb0a333e48b2def13e1e651397940118_full.jpg?1408464485","synopsis":"A TV anime remake of the World Fool News ONA.\r\nTakahashi is transferred to a main anchor of a news program, which is known for being a little...weird. This is a comedy about somewhat ridiculous happenings occurring at a broadcasting station.\r\n(Source: YouTube)","show_type":"TV","started_airing":"2014-04-17","finished_airing":"2014-07-03","community_rating":3.36834246791931,"age_rating":"G","genres":[{"name":"Comedy"},{"name":"Slice of Life"}]},{"id":9967,"mal_id":28171,"slug":"shokugeki-no-souma","status":"Finished Airing","url":"https://hummingbird.me/anime/shokugeki-no-souma","title":"Shokugeki no Souma","alternate_title":"Food Wars!","episode_count":24,"episode_length":25,"cover_image":"https://static.hummingbird.me/anime/poster_images/000/009/967/large/f06b1f552d22b9a167db9908b4bd82111424062942_full.jpg?1435540961","synopsis":"Yukihira Souma's dream is to become a full-time chef in his father's restaurant and surpass his father's culinary skill. But just as Yukihira graduates from middle school, his father, Yukihira Jouichirou, closes down the restaurant to cook in Europe. Although downtrodden, Souma's fighting spirit is rekindled by a challenge from Jouichirou which is to survive in an elite culinary school where only 10% of the students graduate. Can Souma survive?\r\n\r\n(Source: Population GO)","show_type":"TV","started_airing":"2015-04-04","finished_airing":"2015-09-26","community_rating":4.33808152019473,"age_rating":"PG13","genres":[{"name":"Comedy"},{"name":"School"},{"name":"Ecchi"}]},{"id":7026,"mal_id":13779,"slug":"house-foods-ouchi-de-tabeyou","status":"Finished Airing","url":"https://hummingbird.me/anime/house-foods-ouchi-de-tabeyou","title":"House Foods: Ouchi de Tabeyou","alternate_title":"","episode_count":2,"episode_length":1,"cover_image":"https://static.hummingbird.me/anime/poster_images/000/007/026/large/7026.jpg?1408460090","synopsis":"House Foods Ouchi de Tabeyou CM: Summer versions (5 versions) (2003, directed by Miyazaki Hayao, Momose Yoshiyuki, 4:3, 4x15sec + 1x30sec): TV commercials for House Foods. Aired from Jun. 1 to Aug. 31, 2003. Narrated by Okae Kumiko. \r\nHouse Foods Ouchi de Tabeyou CM: Winter versions (3 versions) (2004, directed by Momose Yoshiyuki, 4:3, 2x15sec + 1x30sec): TV commercials for House Foods. Aired from Jan. 6 to Feb. 29, 2004. Narrated by Kurotani Tomoka. \r\n(Source: AniDB) ","show_type":"Special","started_airing":"2003-06-01","finished_airing":"2004-01-06","community_rating":0.0,"age_rating":"G","genres":[{"name":"Kids"}]},{"id":4448,"mal_id":6152,"slug":"final-fantasy-vii-advent-children-venice-film-festival-footage","status":"Finished Airing","url":"https://hummingbird.me/anime/final-fantasy-vii-advent-children-venice-film-festival-footage","title":"Final Fantasy VII: Advent Children - Venice Film Festival Footage","alternate_title":null,"episode_count":1,"episode_length":23,"cover_image":"https://static.hummingbird.me/anime/poster_images/000/004/448/large/4448.jpg?1408452581","synopsis":"Advent Children Special Edition is the 25 minute version of the movie which was shown at the 62nd Venice Film Festival in 2005. Available as a bonus on the two disc special edition.","show_type":"Special","started_airing":"2005-09-14","finished_airing":null,"community_rating":3.76015325853223,"age_rating":"PG13","genres":[{"name":"Action"},{"name":"Drama"},{"name":"Sci-Fi"},{"name":"Fantasy"}]},{"id":6372,"mal_id":10825,"slug":"ranma-battle-ga-ippai-29-nin-no-korinai-yatsura","status":"Finished Airing","url":"https://hummingbird.me/anime/ranma-battle-ga-ippai-29-nin-no-korinai-yatsura","title":"Ranma ½: Battle ga Ippai 29-nin no Korinai Yatsura","alternate_title":"Ranma ½: Huge Battle! 29 Unteachable Fools","episode_count":1,"episode_length":27,"cover_image":"https://static.hummingbird.me/anime/poster_images/000/006/372/large/6372.jpg?1408458215","synopsis":"This special, known in Japan as \"Batoru Kaiibai 29 Hitou Korinai Yatsura,\" was available through the Kitty Animation Circle making it a difficult item to come by. It contained clips from twenty-nine of Ranma's most memorable opponents from the television series. \r\n(Source: furinkan.com/ranma/anime/specials.html)","show_type":"OVA","started_airing":"1995-03-03","finished_airing":null,"community_rating":0.0,"age_rating":null,"genres":[{"name":"Comedy"},{"name":"Slice of Life"},{"name":"Martial Arts"},{"name":"Gender Bender"}]}] \ No newline at end of file