summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2017-05-21 15:28:33 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2017-05-21 15:28:33 +0100
commit3d4a6dde3da8d564bcbca21842302cbf8fde89c4 (patch)
tree01c91be0d5982f4626dcfc75ad12782f0bb37bfe
parentStandalone split (diff)
downloadp2pvr-3d4a6dde3da8d564bcbca21842302cbf8fde89c4.tar.bz2
p2pvr-3d4a6dde3da8d564bcbca21842302cbf8fde89c4.tar.xz
p2pvr-3d4a6dde3da8d564bcbca21842302cbf8fde89c4.zip
Update with recent test from mock api
-rw-r--r--libtmdb/Jamfile.jam7
-rw-r--r--libtmdb/httpClient.cpp2
-rw-r--r--libtmdb/samples/movie_550.json46
-rw-r--r--libtmdb/samples/searchMulti_bradPitt.json81
-rw-r--r--libtmdb/samples/searchMulti_breakingBad.json101
-rw-r--r--libtmdb/samples/tv_1396.json196
-rw-r--r--libtmdb/testCallMockApi.cpp14
-rw-r--r--libtmdb/testFormatUrls.cpp12
-rw-r--r--libtmdb/testModels.cpp65
9 files changed, 339 insertions, 185 deletions
diff --git a/libtmdb/Jamfile.jam b/libtmdb/Jamfile.jam
index 0e87cb6..c8cf6b3 100644
--- a/libtmdb/Jamfile.jam
+++ b/libtmdb/Jamfile.jam
@@ -40,7 +40,12 @@ path-constant me : . ;
run
testModels.cpp
- : : :
+ : :
+ samples/movie_550.json
+ samples/searchMulti_bradPitt.json
+ samples/searchMulti_breakingBad.json
+ samples/tv_1396.json
+ :
<define>ROOT=\"$(me)\"
<define>BOOST_TEST_DYN_LINK
<library>boost_utf
diff --git a/libtmdb/httpClient.cpp b/libtmdb/httpClient.cpp
index 4331c07..45377cf 100644
--- a/libtmdb/httpClient.cpp
+++ b/libtmdb/httpClient.cpp
@@ -30,7 +30,7 @@ namespace TMDb {
HttpClient::appendQueryParameters(std::string & path, const Parameters & parameters) const
{
path += "?";
- appendQueryParameters(path, { "apikey", ApiKey });
+ appendQueryParameters(path, { "api_key", ApiKey });
for (const auto & nvp : parameters) {
if (nvp.second.value) {
path += "&";
diff --git a/libtmdb/samples/movie_550.json b/libtmdb/samples/movie_550.json
index fe0b4a8..162a95f 100644
--- a/libtmdb/samples/movie_550.json
+++ b/libtmdb/samples/movie_550.json
@@ -1,33 +1,46 @@
{
"adult": false,
- "backdrop_path": "/8uO0gUM8aNqYLs1OsTBQiXu0fEv.jpg",
+ "backdrop_path": "/87hTDiay2N2qWyX4Ds7ybXi9h8I.jpg",
"belongs_to_collection": null,
"budget": 63000000,
"genres": [
{
- "id": 28,
- "name": "Action"
- },
- {
"id": 18,
"name": "Drama"
- },
- {
- "id": 53,
- "name": "Thriller"
}
],
- "homepage": "http://www.fightclub.com/",
+ "homepage": "http://www.foxmovies.com/movies/fight-club",
"id": 550,
"imdb_id": "tt0137523",
+ "original_language": "en",
"original_title": "Fight Club",
"overview": "A ticking-time-bomb insomniac and a slippery soap salesman channel primal male aggression into a shocking new form of therapy. Their concept catches on, with underground \"fight clubs\" forming in every town, until an eccentric gets in the way and ignites an out-of-control spiral toward oblivion.",
- "popularity": 61151.745000000003,
- "poster_path": "/2lECpi35Hnbpa4y46JX0aY3AWTy.jpg",
+ "popularity": 8.202502,
+ "poster_path": "/adw6Lq9FiC9zjYEpOqfq03ituwp.jpg",
"production_companies": [
{
- "name": "20th Century Fox",
- "id": 25
+ "id": 508,
+ "name": "Regency Enterprises"
+ },
+ {
+ "id": 711,
+ "name": "Fox 2000 Pictures"
+ },
+ {
+ "id": 20555,
+ "name": "Taurus Film"
+ },
+ {
+ "id": 54050,
+ "name": "Linson Films"
+ },
+ {
+ "id": 54051,
+ "name": "Atman Entertainment"
+ },
+ {
+ "id": 54052,
+ "name": "Knickerbocker Films"
}
],
"production_countries": [
@@ -52,6 +65,7 @@
"status": "Released",
"tagline": "How much can you know about yourself if you've never been in a fight?",
"title": "Fight Club",
- "vote_average": 9.0999999999999996,
- "vote_count": 174
+ "video": false,
+ "vote_average": 8.2,
+ "vote_count": 7715
}
diff --git a/libtmdb/samples/searchMulti_bradPitt.json b/libtmdb/samples/searchMulti_bradPitt.json
new file mode 100644
index 0000000..3f4e1ce
--- /dev/null
+++ b/libtmdb/samples/searchMulti_bradPitt.json
@@ -0,0 +1,81 @@
+{
+ "page": 1,
+ "results": [
+ {
+ "adult": false,
+ "id": 287,
+ "known_for": [
+ {
+ "adult": false,
+ "backdrop_path": "/87hTDiay2N2qWyX4Ds7ybXi9h8I.jpg",
+ "genre_ids": [
+ 18
+ ],
+ "id": 550,
+ "media_type": "movie",
+ "original_language": "en",
+ "original_title": "Fight Club",
+ "overview": "A ticking-time-bomb insomniac and a slippery soap salesman channel primal male aggression into a shocking new form of therapy. Their concept catches on, with underground \"fight clubs\" forming in every town, until an eccentric gets in the way and ignites an out-of-control spiral toward oblivion.",
+ "popularity": 9.202502,
+ "poster_path": "/adw6Lq9FiC9zjYEpOqfq03ituwp.jpg",
+ "release_date": "1999-10-15",
+ "title": "Fight Club",
+ "video": false,
+ "vote_average": 8.2,
+ "vote_count": 7704
+ },
+ {
+ "adult": false,
+ "backdrop_path": "/7nF6B9yCEq1ZCT82sGJVtNxOcl5.jpg",
+ "genre_ids": [
+ 18,
+ 28,
+ 53,
+ 10752
+ ],
+ "id": 16869,
+ "media_type": "movie",
+ "original_language": "en",
+ "original_title": "Inglourious Basterds",
+ "overview": "In Nazi-occupied France during World War II, a group of Jewish-American soldiers known as \"The Basterds\" are chosen specifically to spread fear throughout the Third Reich by scalping and brutally killing Nazis. The Basterds, lead by Lt. Aldo Raine soon cross paths with a French-Jewish teenage girl who runs a movie theater in Paris which is targeted by the soldiers.",
+ "popularity": 7.037053,
+ "poster_path": "/6zYuTKyvcwmtNvXXvJZNT0IgBL0.jpg",
+ "release_date": "2009-08-18",
+ "title": "Inglourious Basterds",
+ "video": false,
+ "vote_average": 7.8,
+ "vote_count": 5245
+ },
+ {
+ "adult": false,
+ "backdrop_path": "/xMOQVYLeIKBXenJ9KMeasj7S64y.jpg",
+ "genre_ids": [
+ 28,
+ 18,
+ 27,
+ 878,
+ 53
+ ],
+ "id": 72190,
+ "media_type": "movie",
+ "original_language": "en",
+ "original_title": "World War Z",
+ "overview": "Life for former United Nations investigator Gerry Lane and his family seems content. Suddenly, the world is plagued by a mysterious infection turning whole human populations into rampaging mindless zombies. After barely escaping the chaos, Lane is persuaded to go on a mission to investigate this disease. What follows is a perilous trek around the world where Lane must brave horrific dangers and long odds to find answers before human civilization falls.",
+ "popularity": 6.470611,
+ "poster_path": "/Ha5t0J21eyiq6Az1EXzx0iwsGH.jpg",
+ "release_date": "2013-06-20",
+ "title": "World War Z",
+ "video": false,
+ "vote_average": 6.7,
+ "vote_count": 4706
+ }
+ ],
+ "media_type": "person",
+ "name": "Brad Pitt",
+ "popularity": 21.322915,
+ "profile_path": "/ejYIW1enUcGJ9GS3Bs34mtONwWS.jpg"
+ }
+ ],
+ "total_pages": 1,
+ "total_results": 1
+}
diff --git a/libtmdb/samples/searchMulti_breakingBad.json b/libtmdb/samples/searchMulti_breakingBad.json
index fb0ec82..05239bc 100644
--- a/libtmdb/samples/searchMulti_breakingBad.json
+++ b/libtmdb/samples/searchMulti_breakingBad.json
@@ -1,39 +1,66 @@
{
- "page": 1,
- "results": [
- {
- "backdrop_path": "/sIJyCJedGlZf1TId41gCtkblBGo.jpg",
- "id": 1396,
- "original_name": "Breaking Bad",
- "first_air_date": "2008-01-19",
- "poster_path": "/4yMXf3DW6oCL0lVPZaZM2GypgwE.jpg",
- "popularity": 12.2665228348243,
- "name": "Breaking Bad",
- "vote_average": 9,
- "vote_count": 68,
- "media_type": "tv"
- },
- {
- "adult": false,
- "backdrop_path": "/mMKahLSpwb9Yj2B0tB6vku3tkGy.jpg",
- "id": 239459,
- "original_title": "No Half Measures: Creating the Final Season of Breaking Bad",
- "release_date": "2013-11-26",
- "poster_path": "/8OixSR45U5dbqv8F0tlspmTbXxN.jpg",
- "popularity": 2.8761099924108,
- "title": "No Half Measures: Creating the Final Season of Breaking Bad",
- "vote_average": 8.5,
- "vote_count": 5,
- "media_type": "movie"
- },
- {
- "adult": false,
- "id": 287,
- "name": "Brad Pitt",
- "profile_path": "/w8zJQuN7tzlm6FY9mfGKihxp3Cb.jpg",
- "media_type": "person"
- }
- ],
- "total_pages": 1,
- "total_results": 3
+ "page": 1,
+ "results": [
+ {
+ "backdrop_path": "/eSzpy96DwBujGFj0xMbXBcGcfxX.jpg",
+ "first_air_date": "2008-01-19",
+ "genre_ids": [
+ 18
+ ],
+ "id": 1396,
+ "media_type": "tv",
+ "name": "Breaking Bad",
+ "origin_country": [
+ "US"
+ ],
+ "original_language": "en",
+ "original_name": "Breaking Bad",
+ "overview": "Breaking Bad is an American crime drama television series created and produced by Vince Gilligan. Set and produced in Albuquerque, New Mexico, Breaking Bad is the story of Walter White, a struggling high school chemistry teacher who is diagnosed with inoperable lung cancer at the beginning of the series. He turns to a life of crime, producing and selling methamphetamine, in order to secure his family's financial future before he dies, teaming with his former student, Jesse Pinkman. Heavily serialized, the series is known for positioning its characters in seemingly inextricable corners and has been labeled a contemporary western by its creator.",
+ "popularity": 19.210298,
+ "poster_path": "/1yeVJox3rjo2jBKrrihIMj7uoS9.jpg",
+ "vote_average": 8.17,
+ "vote_count": 1532
+ },
+ {
+ "adult": false,
+ "backdrop_path": "/mMKahLSpwb9Yj2B0tB6vku3tkGy.jpg",
+ "genre_ids": [
+ 99
+ ],
+ "id": 239459,
+ "media_type": "movie",
+ "original_language": "en",
+ "original_title": "No Half Measures: Creating the Final Season of Breaking Bad",
+ "overview": "A documentary about the making of season five of the acclaimed AMC series Breaking Bad.",
+ "popularity": 1.378066,
+ "poster_path": "/8OixSR45U5dbqv8F0tlspmTbXxN.jpg",
+ "release_date": "2013-11-26",
+ "title": "No Half Measures: Creating the Final Season of Breaking Bad",
+ "video": false,
+ "vote_average": 8.3,
+ "vote_count": 34
+ },
+ {
+ "adult": false,
+ "backdrop_path": "/v89znpPuYKWGqyyfoSSMJ7qNOae.jpg",
+ "genre_ids": [
+ 35,
+ 10751
+ ],
+ "id": 19050,
+ "media_type": "movie",
+ "original_language": "en",
+ "original_title": "The Bad News Bears in Breaking Training",
+ "overview": "Sentimental sequel film finds the Bears, somehow, the little league champions of California. As a result, the team is invited to play a between-games exhibition at the Houston Astrodome with the local champs, the Toros. Kelly Leak, the Bears' star player, decides to rejoin the team and go with them to Houston to make amends with his estranged father, Mike",
+ "popularity": 1.004188,
+ "poster_path": "/eGl9pMHuxpF6jRQG4F65Gslh796.jpg",
+ "release_date": "1977-07-08",
+ "title": "The Bad News Bears in Breaking Training",
+ "video": false,
+ "vote_average": 5.2,
+ "vote_count": 9
+ }
+ ],
+ "total_pages": 1,
+ "total_results": 3
}
diff --git a/libtmdb/samples/tv_1396.json b/libtmdb/samples/tv_1396.json
index 6043750..acd1c4d 100644
--- a/libtmdb/samples/tv_1396.json
+++ b/libtmdb/samples/tv_1396.json
@@ -1,89 +1,111 @@
{
- "backdrop_path": "/sIJyCJedGlZf1TId41gCtkblBGo.jpg",
- "created_by": [
- {
- "id": 66633,
- "name": "Vince Gilligan",
- "profile_path": "/rLSUjr725ez1cK7SKVxC9udO03Y.jpg"
- }
- ],
- "episode_run_time": [
- 45,
- 47
- ],
- "first_air_date": "2008-01-19",
- "genres": [
- {
- "id": 18,
- "name": "Drama"
- }
- ],
- "homepage": "http://www.amctv.com/shows/breaking-bad",
- "id": 1396,
- "in_production": false,
- "languages": [
- "en",
- "de",
- "ro",
- "es",
- "fa"
- ],
- "last_air_date": "2013-09-29",
- "name": "Breaking Bad",
- "networks": [
- {
- "id": 174,
- "name": "AMC"
- }
- ],
- "number_of_episodes": 62,
- "number_of_seasons": 5,
- "original_name": "Breaking Bad",
- "origin_country": [
- "US"
- ],
- "overview": "Breaking Bad is an American crime drama television series created and produced by Vince Gilligan. Set and produced in Albuquerque, New Mexico, Breaking Bad is the story of Walter White, a struggling high school chemistry teacher who is diagnosed with inoperable lung cancer at the beginning of the series. He turns to a life of crime, producing and selling methamphetamine, in order to secure his family's financial future before he dies, teaming with his former student, Jesse Pinkman. Heavily serialized, the series is known for positioning its characters in seemingly inextricable corners and has been labeled a contemporary western by its creator.",
- "popularity": 7.68402647476576,
- "poster_path": "/4yMXf3DW6oCL0lVPZaZM2GypgwE.jpg",
- "seasons": [
- {
- "air_date": "2009-02-17",
- "id": 3577,
- "poster_path": "/spPmYZAq2xLKQOEIdBPkhiRxrb9.jpg",
- "season_number": 0
- },
- {
- "air_date": "2008-01-19",
- "id": 3572,
- "poster_path": "/dHCYpEoHEjAV6Xt3eyNthkdLRl3.jpg",
- "season_number": 1
- },
- {
- "air_date": "2009-03-08",
- "id": 3573,
- "poster_path": "/ww6cDy0dhrVEdMqielNEsYz96mg.jpg",
- "season_number": 2
- },
- {
- "air_date": "2010-03-21",
- "id": 3575,
- "poster_path": "/rINvcsYHUprsx9L8zNr5JltALda.jpg",
- "season_number": 3
- },
- {
- "air_date": "2011-07-17",
- "id": 3576,
- "poster_path": "/ngnE7FFQqrrLgK3yVsv3kjwtQMZ.jpg",
- "season_number": 4
- },
- {
- "air_date": "2012-07-15",
- "id": 3578,
- "poster_path": "/ih1JKNxEzW56azeFpEQmdu4poA4.jpg",
- "season_number": 5
- }
- ],
- "status": "Ended",
- "vote_average": 9,
- "vote_count": 72
+ "backdrop_path": "/eSzpy96DwBujGFj0xMbXBcGcfxX.jpg",
+ "created_by": [
+ {
+ "id": 66633,
+ "name": "Vince Gilligan",
+ "profile_path": "/rLSUjr725ez1cK7SKVxC9udO03Y.jpg"
+ }
+ ],
+ "episode_run_time": [
+ 45,
+ 47
+ ],
+ "first_air_date": "2008-01-19",
+ "genres": [
+ {
+ "id": 18,
+ "name": "Drama"
+ }
+ ],
+ "homepage": "http://www.amc.com/shows/breaking-bad",
+ "id": 1396,
+ "in_production": false,
+ "languages": [
+ "en",
+ "de",
+ "ro",
+ "es",
+ "fa"
+ ],
+ "last_air_date": "2013-09-29",
+ "name": "Breaking Bad",
+ "networks": [
+ {
+ "id": 174,
+ "name": "AMC"
+ }
+ ],
+ "number_of_episodes": 62,
+ "number_of_seasons": 5,
+ "origin_country": [
+ "US"
+ ],
+ "original_language": "en",
+ "original_name": "Breaking Bad",
+ "overview": "Breaking Bad is an American crime drama television series created and produced by Vince Gilligan. Set and produced in Albuquerque, New Mexico, Breaking Bad is the story of Walter White, a struggling high school chemistry teacher who is diagnosed with inoperable lung cancer at the beginning of the series. He turns to a life of crime, producing and selling methamphetamine, in order to secure his family's financial future before he dies, teaming with his former student, Jesse Pinkman. Heavily serialized, the series is known for positioning its characters in seemingly inextricable corners and has been labeled a contemporary western by its creator.",
+ "popularity": 18.210298,
+ "poster_path": "/1yeVJox3rjo2jBKrrihIMj7uoS9.jpg",
+ "production_companies": [
+ {
+ "id": 2605,
+ "name": "Gran Via Productions"
+ },
+ {
+ "id": 11073,
+ "name": "Sony Pictures Television"
+ },
+ {
+ "id": 33742,
+ "name": "High Bridge Entertainment"
+ }
+ ],
+ "seasons": [
+ {
+ "air_date": "2009-02-17",
+ "episode_count": 6,
+ "id": 3577,
+ "poster_path": "/AngNuUbXSciwLnUXtdOBHqphxNr.jpg",
+ "season_number": 0
+ },
+ {
+ "air_date": "2008-01-19",
+ "episode_count": 7,
+ "id": 3572,
+ "poster_path": "/o5131POxv9xFl3wBmdg0YWc9Iz4.jpg",
+ "season_number": 1
+ },
+ {
+ "air_date": "2009-03-08",
+ "episode_count": 13,
+ "id": 3573,
+ "poster_path": "/7FwD7IuyHy6xl18LDIRxjl7vDbo.jpg",
+ "season_number": 2
+ },
+ {
+ "air_date": "2010-03-21",
+ "episode_count": 13,
+ "id": 3575,
+ "poster_path": "/1HVSSlEAOILiR4BskS1zV04kTjx.jpg",
+ "season_number": 3
+ },
+ {
+ "air_date": "2011-07-17",
+ "episode_count": 13,
+ "id": 3576,
+ "poster_path": "/5ewrnKp4TboU4hTLT5cWO350mHj.jpg",
+ "season_number": 4
+ },
+ {
+ "air_date": "2012-07-15",
+ "episode_count": 16,
+ "id": 3578,
+ "poster_path": "/r3z70vunihrAkjILQKWHX0G2xzO.jpg",
+ "season_number": 5
+ }
+ ],
+ "status": "Ended",
+ "type": "Scripted",
+ "vote_average": 8.2,
+ "vote_count": 1536
}
diff --git a/libtmdb/testCallMockApi.cpp b/libtmdb/testCallMockApi.cpp
index 79efbe2..cb06791 100644
--- a/libtmdb/testCallMockApi.cpp
+++ b/libtmdb/testCallMockApi.cpp
@@ -3,24 +3,24 @@
#include "tmdb-proxy.h"
-const std::string MockBase = "http://private-5513-themoviedb.apiary-mock.com/3";
+const std::string MockBase = "http://api.themoviedb.org/3";
const std::string ApiKey = "48b32823d2b60c5c1085af36daed03fa";
BOOST_AUTO_TEST_CASE( search_tmdb )
{
TMDb::Proxy test(MockBase, ApiKey);
- auto resp = test.SearchMulti("breaking bad", 0, Ice::Current());
- BOOST_REQUIRE_EQUAL(20, resp->Results.size());
- BOOST_REQUIRE_EQUAL(134, resp->TotalResults);
+ auto resp = test.SearchMulti("breaking bad", 1, Ice::Current());
+ BOOST_REQUIRE_EQUAL(3, resp->Results.size());
+ BOOST_REQUIRE_EQUAL(3, resp->TotalResults);
BOOST_REQUIRE_EQUAL(1396, resp->Results[0]->Id);
- BOOST_REQUIRE_EQUAL(34541, resp->Results[1]->Id);
- BOOST_REQUIRE_EQUAL(332501, resp->Results[19]->Id);
+ BOOST_REQUIRE_EQUAL(239459, resp->Results[1]->Id);
+ BOOST_REQUIRE_EQUAL(19050, resp->Results[2]->Id);
}
BOOST_AUTO_TEST_CASE( get_movie )
{
TMDb::Proxy test(MockBase, ApiKey);
- auto resp = test.GetMovie(1396, Ice::Current());
+ auto resp = test.GetMovie(550, Ice::Current());
BOOST_REQUIRE_EQUAL("Fight Club", resp->Title);
}
diff --git a/libtmdb/testFormatUrls.cpp b/libtmdb/testFormatUrls.cpp
index 0df6670..49ce017 100644
--- a/libtmdb/testFormatUrls.cpp
+++ b/libtmdb/testFormatUrls.cpp
@@ -18,41 +18,41 @@ BOOST_AUTO_TEST_CASE( format_url_simple )
{
TMDb::Proxy test(MockBase, ApiKey);
auto url = test.GetUrl<int>("/something/%d", 23, { });
- BOOST_REQUIRE_EQUAL("http://private-5513-themoviedb.apiary-mock.com/3/something/23?apikey=48b32823d2b60c5c1085af36daed03fa", url);
+ BOOST_REQUIRE_EQUAL("http://private-5513-themoviedb.apiary-mock.com/3/something/23?api_key=48b32823d2b60c5c1085af36daed03fa", url);
}
BOOST_AUTO_TEST_CASE( format_url_query )
{
TMDb::Proxy test(MockBase, ApiKey);
auto url = test.GetUrl<int>("/something/%d", 23, { { "page", 5 } });
- BOOST_REQUIRE_EQUAL("http://private-5513-themoviedb.apiary-mock.com/3/something/23?apikey=48b32823d2b60c5c1085af36daed03fa&page=5", url);
+ BOOST_REQUIRE_EQUAL("http://private-5513-themoviedb.apiary-mock.com/3/something/23?api_key=48b32823d2b60c5c1085af36daed03fa&page=5", url);
}
BOOST_AUTO_TEST_CASE( format_url_multiple )
{
TMDb::Proxy test(MockBase, ApiKey);
auto url = test.GetUrl("/something", { { "page", 5}, {"query", "string" } });
- BOOST_REQUIRE_EQUAL("http://private-5513-themoviedb.apiary-mock.com/3/something?apikey=48b32823d2b60c5c1085af36daed03fa&page=5&query=string", url);
+ BOOST_REQUIRE_EQUAL("http://private-5513-themoviedb.apiary-mock.com/3/something?api_key=48b32823d2b60c5c1085af36daed03fa&page=5&query=string", url);
}
BOOST_AUTO_TEST_CASE( format_url_escaped )
{
TMDb::Proxy test(MockBase, ApiKey);
auto url = test.GetUrl("/something", { { "query", "sample string" } });
- BOOST_REQUIRE_EQUAL("http://private-5513-themoviedb.apiary-mock.com/3/something?apikey=48b32823d2b60c5c1085af36daed03fa&query=sample%20string", url);
+ BOOST_REQUIRE_EQUAL("http://private-5513-themoviedb.apiary-mock.com/3/something?api_key=48b32823d2b60c5c1085af36daed03fa&query=sample%20string", url);
}
BOOST_AUTO_TEST_CASE( format_url_optionalvalue )
{
TMDb::Proxy test(MockBase, ApiKey);
auto url = test.GetUrl("/something", { { "query", IceUtil::Optional<Ice::Int>(10) } });
- BOOST_REQUIRE_EQUAL("http://private-5513-themoviedb.apiary-mock.com/3/something?apikey=48b32823d2b60c5c1085af36daed03fa&query=10", url);
+ BOOST_REQUIRE_EQUAL("http://private-5513-themoviedb.apiary-mock.com/3/something?api_key=48b32823d2b60c5c1085af36daed03fa&query=10", url);
}
BOOST_AUTO_TEST_CASE( format_url_optionalnovalue )
{
TMDb::Proxy test(MockBase, ApiKey);
auto url = test.GetUrl("/something", { { "query", IceUtil::Optional<Ice::Int>() } });
- BOOST_REQUIRE_EQUAL("http://private-5513-themoviedb.apiary-mock.com/3/something?apikey=48b32823d2b60c5c1085af36daed03fa", url);
+ BOOST_REQUIRE_EQUAL("http://private-5513-themoviedb.apiary-mock.com/3/something?api_key=48b32823d2b60c5c1085af36daed03fa", url);
}
diff --git a/libtmdb/testModels.cpp b/libtmdb/testModels.cpp
index 0557017..3b1b289 100644
--- a/libtmdb/testModels.cpp
+++ b/libtmdb/testModels.cpp
@@ -4,6 +4,7 @@
#include <tmdb-models.h>
#include <slicer/slicer.h>
#include <slicer/json/serializer.h>
+#include <definedDirs.h>
namespace std {
std::ostream &
@@ -14,13 +15,9 @@ namespace std {
}
};
-#define XSTR(s) STR(s)
-#define STR(s) #s
-const boost::filesystem::path root(XSTR(ROOT));
-
-BOOST_AUTO_TEST_CASE( deserialize_searchmulti_json )
+BOOST_AUTO_TEST_CASE( deserialize_searchmulti_json_breakingbad )
{
- auto results = Slicer::DeserializeAny<Slicer::JsonFileDeserializer, TMDb::SearchMultiResultsPtr>((root / "samples" / "searchMulti_breakingBad.json").string());
+ auto results = Slicer::DeserializeAny<Slicer::JsonFileDeserializer, TMDb::SearchMultiResultsPtr>((rootDir / "samples" / "searchMulti_breakingBad.json").string());
BOOST_REQUIRE_EQUAL(1, results->Page);
BOOST_REQUIRE_EQUAL(1, results->TotalPages);
BOOST_REQUIRE_EQUAL(3, results->TotalResults);
@@ -28,7 +25,7 @@ BOOST_AUTO_TEST_CASE( deserialize_searchmulti_json )
BOOST_REQUIRE_EQUAL("::TMDb::SearchMatchTv", results->Results[0]->ice_id());
auto tv = TMDb::SearchMatchTvPtr::dynamicCast(results->Results[0]);
BOOST_REQUIRE_EQUAL("Breaking Bad", tv->Name);
- BOOST_REQUIRE_EQUAL("/4yMXf3DW6oCL0lVPZaZM2GypgwE.jpg", tv->PosterPath);
+ BOOST_REQUIRE_EQUAL("/1yeVJox3rjo2jBKrrihIMj7uoS9.jpg", tv->PosterPath);
BOOST_REQUIRE_EQUAL(1396, tv->Id);
BOOST_REQUIRE_EQUAL("::TMDb::SearchMatchMovie", results->Results[1]->ice_id());
@@ -36,32 +33,40 @@ BOOST_AUTO_TEST_CASE( deserialize_searchmulti_json )
BOOST_REQUIRE_EQUAL("No Half Measures: Creating the Final Season of Breaking Bad", movie->Title);
BOOST_REQUIRE_EQUAL("/8OixSR45U5dbqv8F0tlspmTbXxN.jpg", movie->PosterPath);
BOOST_REQUIRE_EQUAL(239459, movie->Id);
+}
+
+BOOST_AUTO_TEST_CASE( deserialize_searchmulti_json_bradpitt )
+{
+ auto results = Slicer::DeserializeAny<Slicer::JsonFileDeserializer, TMDb::SearchMultiResultsPtr>((rootDir / "samples" / "searchMulti_bradPitt.json").string());
+ BOOST_REQUIRE_EQUAL(1, results->Page);
+ BOOST_REQUIRE_EQUAL(1, results->TotalPages);
+ BOOST_REQUIRE_EQUAL(1, results->TotalResults);
- BOOST_REQUIRE_EQUAL("::TMDb::SearchMatchPerson", results->Results[2]->ice_id());
- auto person = TMDb::SearchMatchPersonPtr::dynamicCast(results->Results[2]);
+ BOOST_REQUIRE_EQUAL("::TMDb::SearchMatchPerson", results->Results[0]->ice_id());
+ auto person = TMDb::SearchMatchPersonPtr::dynamicCast(results->Results[0]);
BOOST_REQUIRE_EQUAL("Brad Pitt", person->Name);
BOOST_REQUIRE_EQUAL(287, person->Id);
}
BOOST_AUTO_TEST_CASE( deserialize_movie_json )
{
- auto movie = Slicer::DeserializeAny<Slicer::JsonFileDeserializer, TMDb::MoviePtr>((root / "samples" / "movie_550.json").string());
+ auto movie = Slicer::DeserializeAny<Slicer::JsonFileDeserializer, TMDb::MoviePtr>((rootDir / "samples" / "movie_550.json").string());
BOOST_REQUIRE_EQUAL(550, movie->Id);
BOOST_REQUIRE_EQUAL(false, movie->Adult);
- BOOST_REQUIRE_EQUAL("/8uO0gUM8aNqYLs1OsTBQiXu0fEv.jpg", movie->BackdropPath);
- BOOST_REQUIRE_EQUAL(3, movie->Genres.size());
- BOOST_REQUIRE_EQUAL(28, movie->Genres.front().Id);
- BOOST_REQUIRE_EQUAL("Action", movie->Genres.front().Name);
+ BOOST_REQUIRE_EQUAL("/87hTDiay2N2qWyX4Ds7ybXi9h8I.jpg", movie->BackdropPath);
+ BOOST_REQUIRE_EQUAL(1, movie->Genres.size());
+ BOOST_REQUIRE_EQUAL(18, movie->Genres.front().Id);
+ BOOST_REQUIRE_EQUAL("Drama", movie->Genres.front().Name);
BOOST_REQUIRE_EQUAL(63000000, movie->Budget);
- BOOST_REQUIRE_EQUAL("http://www.fightclub.com/", movie->HomePage);
+ BOOST_REQUIRE_EQUAL("http://www.foxmovies.com/movies/fight-club", movie->HomePage);
BOOST_REQUIRE_EQUAL("tt0137523", movie->ImdbId);
BOOST_REQUIRE_EQUAL("Fight Club", movie->OriginalTitle);
- BOOST_REQUIRE_CLOSE(61151.75, movie->Popularity, 0.1);
- BOOST_REQUIRE_EQUAL("/2lECpi35Hnbpa4y46JX0aY3AWTy.jpg", movie->PosterPath);
+ BOOST_REQUIRE_CLOSE(8.202502, movie->Popularity, 0.1);
+ BOOST_REQUIRE_EQUAL("/adw6Lq9FiC9zjYEpOqfq03ituwp.jpg", movie->PosterPath);
BOOST_REQUIRE_EQUAL(295, movie->Overview.length());
- BOOST_REQUIRE_EQUAL(1, movie->ProductionCompanies.size());
- BOOST_REQUIRE_EQUAL(25, movie->ProductionCompanies.front().Id);
- BOOST_REQUIRE_EQUAL("20th Century Fox", movie->ProductionCompanies.front().Name);
+ BOOST_REQUIRE_EQUAL(6, movie->ProductionCompanies.size());
+ BOOST_REQUIRE_EQUAL(508, movie->ProductionCompanies.front().Id);
+ BOOST_REQUIRE_EQUAL("Regency Enterprises", movie->ProductionCompanies.front().Name);
BOOST_REQUIRE_EQUAL(2, movie->ProductionCountries.size());
BOOST_REQUIRE_EQUAL("DE", movie->ProductionCountries.front().Id);
BOOST_REQUIRE_EQUAL("Germany", movie->ProductionCountries.front().Name);
@@ -74,14 +79,14 @@ BOOST_AUTO_TEST_CASE( deserialize_movie_json )
BOOST_REQUIRE_EQUAL("Released", movie->Status);
BOOST_REQUIRE_EQUAL("How much can you know about yourself if you've never been in a fight?", movie->Tagline);
BOOST_REQUIRE_EQUAL("Fight Club", movie->Title);
- BOOST_REQUIRE_CLOSE(9.0999999, movie->VoteAverage, 0.01);
- BOOST_REQUIRE_EQUAL(174, movie->VoteCount);
+ BOOST_REQUIRE_CLOSE(8.2, movie->VoteAverage, 0.01);
+ BOOST_REQUIRE_EQUAL(7715, movie->VoteCount);
}
BOOST_AUTO_TEST_CASE( deserialize_tvseries_json )
{
- auto tvSeries = Slicer::DeserializeAny<Slicer::JsonFileDeserializer, TMDb::TvSeriesPtr>((root / "samples" / "tv_1396.json").string());
- BOOST_REQUIRE_EQUAL("/sIJyCJedGlZf1TId41gCtkblBGo.jpg", tvSeries->BackdropPath);
+ auto tvSeries = Slicer::DeserializeAny<Slicer::JsonFileDeserializer, TMDb::TvSeriesPtr>((rootDir / "samples" / "tv_1396.json").string());
+ BOOST_REQUIRE_EQUAL("/eSzpy96DwBujGFj0xMbXBcGcfxX.jpg", tvSeries->BackdropPath);
BOOST_REQUIRE_EQUAL(1, tvSeries->CreatedBy.size());
BOOST_REQUIRE_EQUAL(66633, tvSeries->CreatedBy.front().Id);
BOOST_REQUIRE_EQUAL("Vince Gilligan", tvSeries->CreatedBy.front().Name);
@@ -92,7 +97,7 @@ BOOST_AUTO_TEST_CASE( deserialize_tvseries_json )
BOOST_REQUIRE_EQUAL(1, tvSeries->Genres.size());
BOOST_REQUIRE_EQUAL(18, tvSeries->Genres.front().Id);
BOOST_REQUIRE_EQUAL("Drama", tvSeries->Genres.front().Name);
- BOOST_REQUIRE_EQUAL("http://www.amctv.com/shows/breaking-bad", tvSeries->HomePage);
+ BOOST_REQUIRE_EQUAL("http://www.amc.com/shows/breaking-bad", tvSeries->HomePage);
BOOST_REQUIRE_EQUAL(1396, tvSeries->Id);
BOOST_REQUIRE_EQUAL(false, tvSeries->InProduction);
BOOST_REQUIRE_EQUAL(5, tvSeries->Languages.size());
@@ -107,15 +112,15 @@ BOOST_AUTO_TEST_CASE( deserialize_tvseries_json )
BOOST_REQUIRE_EQUAL(1, tvSeries->OriginCountries.size());
BOOST_REQUIRE_EQUAL("US", tvSeries->OriginCountries.front());
BOOST_REQUIRE_EQUAL(651, tvSeries->Overview.length());
- BOOST_REQUIRE_CLOSE(7.684, tvSeries->Popularity, 0.01);
- BOOST_REQUIRE_EQUAL("/4yMXf3DW6oCL0lVPZaZM2GypgwE.jpg", tvSeries->PosterPath);
+ BOOST_REQUIRE_CLOSE(18.21, tvSeries->Popularity, 0.01);
+ BOOST_REQUIRE_EQUAL("/1yeVJox3rjo2jBKrrihIMj7uoS9.jpg", tvSeries->PosterPath);
BOOST_REQUIRE_EQUAL(6, tvSeries->Seasons.size());
BOOST_REQUIRE_EQUAL(TMDb::Date({2012, 7, 15}), tvSeries->Seasons.back().AirDate);
BOOST_REQUIRE_EQUAL(3578, tvSeries->Seasons.back().Id);
- BOOST_REQUIRE_EQUAL("/ih1JKNxEzW56azeFpEQmdu4poA4.jpg", tvSeries->Seasons.back().PosterPath);
+ BOOST_REQUIRE_EQUAL("/r3z70vunihrAkjILQKWHX0G2xzO.jpg", tvSeries->Seasons.back().PosterPath);
BOOST_REQUIRE_EQUAL(5, tvSeries->Seasons.back().SeasonNumber);
BOOST_REQUIRE_EQUAL("Ended", tvSeries->Status);
- BOOST_REQUIRE_CLOSE(9, tvSeries->VoteAverage, 0.01);
- BOOST_REQUIRE_EQUAL(72, tvSeries->VoteCount);
+ BOOST_REQUIRE_CLOSE(8.2, tvSeries->VoteAverage, 0.01);
+ BOOST_REQUIRE_EQUAL(1536, tvSeries->VoteCount);
}