Commit 9e8315e4 authored by Tony Crisci's avatar Tony Crisci Committed by Victor Toso

steam-store: add tests for plugin

Related: #29
parent 6ffe4833
Pipeline #57382 passed with stage
in 4 minutes and 6 seconds
......@@ -17,6 +17,7 @@ test_plugins = [
test_lua_sources = [
'games',
'spotify-cover',
'steam-store',
]
# Plugins
......
[default]
version=1
[https://store.steampowered.com/api/appdetails?appids=641990]
data=resolve-641990.data
{"641990":{"success":true,"data":{"type":"game","name":"The Escapists 2","steam_appid":641990,"required_age":0,"is_free":false,"controller_support":"full","dlc":[666350,701180,716580,784930,821170],"detailed_description":"<h1>Just Updated<\/h1><p><img src=\"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/extras\/Untitled-1.png?t=1525881861\" ><h2 class=\"bb_tag\">Festive fun in free Santa\u2019s Shakedown update<\/h2><br>Deck the cells with bars and escape attempts! Christmas has come early in the latest free game update to The Escapists 2, featuring a brand new map \u2013 Santa\u2019s Shakedown. Not content with life in a perpetually festive lock-up, you must devise ingenious new ways of getting out of prison without getting caught in the tinsel! Featuring brand new items and some very unique craftables, you must pitch in with new prison jobs such as Christmas tree-decorating and toy soldier construction to blend in until the time is right to ho-ho-hop out of there!<br>Wrap up warm, grab some fellow inmates if it tickles your fancy, and head to the Play Game menu now to experience Santa\u2019s Shakedown.<\/p><br><h1>Featured DLC<\/h1><p><img src=\"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/extras\/WW.jpg?t=1525881861\" ><br><br>Things have taken a strange turn in the locked off rooms of an abandoned hospital. Once again, you\u2019ll have to craft, fight and scheme your way to freedom from this eerie supernatural slammer.<\/p><br><h1>About the Game<\/h1><img src=\"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/extras\/TheEscapists2_Smaller_key_art.png?t=1525881861\" ><h2 class=\"bb_tag\">The Ultimate Prison Sandbox!<\/h2><img src=\"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/extras\/Escapists2Danny1.jpg?t=1525881861\" ><br>Risk it all to breakout from the toughest prisons in the world. Explore the biggest prisons yet, with multiple floors, roofs, vents and underground tunnels. <br>You\u2019ll have to live by the prison rules, attending roll call, doing prison jobs and following strict routines; all the while secretly engineering your bid for freedom!<br>Your prison escape antics will take you from the frosty Fort Tundra, a train hurtling through the desert, and even to the final frontier!<h2 class=\"bb_tag\">Escape Team Assemble!<\/h2><img src=\"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/extras\/Escapists2Danny4.jpg?t=1525881861\" > <br>Unite with up to 3 friends to create the ultimate escape crew and engineer the wildest escapes yet! Jump online or gather round on a couch to prepare for your sneaky adventures. By working together you\u2019ll be able to create even more elaborate and daring plans.<br><br>Feeling competitive? Dive into the versus mode and show that you\u2019ve got the skills to break out of any prison faster than your friends can. If all else fails, settle your rivalry in the court yard with a prison punch up!<h2 class=\"bb_tag\">Create YOUR Con!<\/h2><img src=\"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/extras\/Escapists2Danny3.jpg?t=1525881861\" ><br>It\u2019s time to make your prisoner truly yours. Choose from a massive array of customisations to make your character unique to you. It\u2019s important to look stylish whilst you mastermind your escape.<h2 class=\"bb_tag\">Craft your Escape!<\/h2><img src=\"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/extras\/Escapists2Danny8.jpg?t=1525881861\" ><br>Being in prison forces you to be creative and work with the limited tools at your disposal. You\u2019ll have to combine everyday objects like soap and socks to craft new weapons and tools to help you achieve your goal. Steal forks from the cafeteria to chip a tunnel in your room, and craft a poster from magazines and duct tape to hide the evidence. You\u2019ll soon learn that duct tape solves (almost) everything!<h2 class=\"bb_tag\">Prepare for a fight!\u00a0<\/h2><img src=\"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/extras\/Escapists2Danny7.jpg?t=1525881861\" ><br>The Escapists 2 introduces a brand new combat system to make every prison brawl more exciting and interactive. You\u2019ll have to block and tie together chains of attacks whilst strafing around your locked on targets to gain the upper hand in combat. Make sure your visit the gym first to build up those muscles!<h2 class=\"bb_tag\">New ways to escape!<\/h2><img src=\"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/extras\/Escapists2Danny2.jpg?t=1525881861\" ><br>As the prisons get tougher you\u2019re going to have to get more creative with your escape plans. There\u2019s a ton of options to tackle almost any prison escape.<h2 class=\"bb_tag\">Construct a clink!<\/h2><img src=\"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/extras\/Editor.jpg?t=1525881861\" ><br>With the Prison Map Editor, it\u2019s your turn to construct a prison worthy of housing the toughest inmates! It includes all the rooms, fences and guard dogs you need to build a prison that\u2019s as hard as your imagination makes it \u2013 no duct-tape required.<br>You can pick up those prison blueprints and start crafting your own creations through the Custom Prisons option on the main menu, and when you\u2019re ready you can show the world by sharing them through Steam Workshop where you can download subscribe to fellow architects\u2019 lock-ups \u2013 all custom maps can be played either solo or in both local and online multiplayer!<h2 class=\"bb_tag\">Features<\/h2><ul class=\"bb_ul\"><li>11 Prisons<br><\/li><li>Up to 4 player co-operative and versus multiplayer<br><\/li><li> Drop-in\/ Drop-out Online\/Splitscreen multiplayer<br><\/li><li>Over 300 customisations<br><\/li><li>Multi-storey Prisons<\/li><\/ul><br><img src=\"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/extras\/Multiplayer.png?t=1525881861\" >","about_the_game":"<ABOUT_THE_GAME>","short_description":"Craft, Steal, Brawl and Escape! It\u2019s time to bust out of the toughest prisons in the world as you return to the life of an inmate in The Escapists 2, now with multiplayer! Have you got what it takes to escape?","supported_languages":"English, French, German, Spanish, Russian, Simplified Chinese, Italian","header_image":"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/header.jpg?t=1525881861","website":"https:\/\/www.team17.com\/games\/the-escapists-2\/","pc_requirements":{"minimum":"<strong>Minimum:<\/strong><br><ul class=\"bb_ul\"><li><strong>OS:<\/strong> Windows 7\/8.1\/10 (32-bit versions)<br><\/li><li><strong>Processor:<\/strong> Intel Core Duo E6600 @ 2.4GHz<br><\/li><li><strong>Memory:<\/strong> 2 GB RAM<br><\/li><li><strong>Graphics:<\/strong> Intel 4400, GeForce GT 8800, AMD Radeon HD 4650<br><\/li><li><strong>DirectX:<\/strong> Version 11<br><\/li><li><strong>Storage:<\/strong> 4 GB available space<br><\/li><li><strong>Sound Card:<\/strong> Windows Compatible Sound card<\/li><\/ul>","recommended":"<strong>Recommended:<\/strong><br><ul class=\"bb_ul\"><li><strong>OS:<\/strong> Windows 7\/8.1\/10 (64-bit versions)<br><\/li><li><strong>Processor:<\/strong> i5-2500k@3.3GHz, AMD FX 6300 3.5GHz<br><\/li><li><strong>Memory:<\/strong> 4 GB RAM<br><\/li><li><strong>Graphics:<\/strong> GeForce GTX 750, AMD R7 370<br><\/li><li><strong>DirectX:<\/strong> Version 11<br><\/li><li><strong>Storage:<\/strong> 4 GB available space<br><\/li><li><strong>Sound Card:<\/strong> Windows Compatible Sound card<\/li><\/ul>"},"mac_requirements":{"minimum":"<strong>Minimum:<\/strong><br><ul class=\"bb_ul\"><li><strong>OS:<\/strong> OSX 10.10 Yosemite<br><\/li><li><strong>Processor:<\/strong> Intel Core i5 @2.7Ghz<br><\/li><li><strong>Memory:<\/strong> 2 GB RAM<br><\/li><li><strong>Graphics:<\/strong> Nvidia GT 640M, AMD Radeon HD 5750, Intel HD Graphics 6100<br><\/li><li><strong>Storage:<\/strong> 4 GB available space<\/li><\/ul>"},"linux_requirements":{"minimum":"<strong>Minimum:<\/strong><br><ul class=\"bb_ul\"><li><strong>OS:<\/strong> Ubuntu 14.04, Mint 18.2<br><\/li><li><strong>Processor:<\/strong> Intel Core i5 @3.3Ghz<br><\/li><li><strong>Memory:<\/strong> 4 GB RAM<br><\/li><li><strong>Graphics:<\/strong> Nvidia GTS 8800, AMD Radeon HD 4650, Intel HD Graphics 6100<br><\/li><li><strong>Storage:<\/strong> 4 GB available space<\/li><\/ul>"},"legal_notice":"The Escapists 2 developed by Mouldy Toof Studios and Team17 Digital Ltd \u00a9 2017. Published by Team17 Digital Ltd. All trademarks, copyrights and logos are property of their respective owners.","developers":["Team17 Digital Ltd","Mouldy Toof Studios"],"publishers":["Team17 Digital Ltd"],"price_overview":{"currency":"USD","initial":1999,"final":1999,"discount_percent":0},"packages":[178436],"package_groups":[{"name":"default","title":"Buy The Escapists 2","description":"","selection_text":"Select a purchase option","save_text":"","display_type":0,"is_recurring_subscription":"false","subs":[{"packageid":178436,"percent_savings_text":"","percent_savings":0,"option_text":"The Escapists 2 - $19.99","option_description":"","can_get_free_license":"0","is_free_license":false,"price_in_cents_with_discount":1999}]}],"platforms":{"windows":true,"mac":true,"linux":true},"metacritic":{"score":75,"url":"https:\/\/www.metacritic.com\/game\/pc\/the-escapists-2?ftag=MCD-06-10aaa1f"},"categories":[{"id":2,"description":"Single-player"},{"id":1,"description":"Multi-player"},{"id":36,"description":"Online Multi-Player"},{"id":37,"description":"Local Multi-Player"},{"id":9,"description":"Co-op"},{"id":38,"description":"Online Co-op"},{"id":39,"description":"Local Co-op"},{"id":24,"description":"Shared\/Split Screen"},{"id":22,"description":"Steam Achievements"},{"id":28,"description":"Full controller support"},{"id":29,"description":"Steam Trading Cards"},{"id":23,"description":"Steam Cloud"},{"id":25,"description":"Steam Leaderboards"}],"genres":[{"id":"23","description":"Indie"},{"id":"28","description":"Simulation"},{"id":"2","description":"Strategy"}],"screenshots":[{"id":0,"path_thumbnail":"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/ss_4c06641e551c04e72abb54d3c190233ff02c05ca.600x338.jpg?t=1525881861","path_full":"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/ss_4c06641e551c04e72abb54d3c190233ff02c05ca.1920x1080.jpg?t=1525881861"},{"id":1,"path_thumbnail":"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/ss_75c9e0c479c4fb6cc2a40686685ed26d0488f332.600x338.jpg?t=1525881861","path_full":"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/ss_75c9e0c479c4fb6cc2a40686685ed26d0488f332.1920x1080.jpg?t=1525881861"},{"id":2,"path_thumbnail":"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/ss_2bb6149a553bbc28c85a624f7628f18fb1573860.600x338.jpg?t=1525881861","path_full":"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/ss_2bb6149a553bbc28c85a624f7628f18fb1573860.1920x1080.jpg?t=1525881861"},{"id":3,"path_thumbnail":"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/ss_797e85fff36b0c2f5da3caa5028132ab52f3c97c.600x338.jpg?t=1525881861","path_full":"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/ss_797e85fff36b0c2f5da3caa5028132ab52f3c97c.1920x1080.jpg?t=1525881861"},{"id":4,"path_thumbnail":"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/ss_84fff3cb6e8306970c8b2fbe7210552646b6f2b2.600x338.jpg?t=1525881861","path_full":"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/ss_84fff3cb6e8306970c8b2fbe7210552646b6f2b2.1920x1080.jpg?t=1525881861"},{"id":5,"path_thumbnail":"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/ss_d74be4a2cc7e25873607d8292775002468f09bc5.600x338.jpg?t=1525881861","path_full":"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/ss_d74be4a2cc7e25873607d8292775002468f09bc5.1920x1080.jpg?t=1525881861"},{"id":6,"path_thumbnail":"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/ss_5834c153aeeea9c574af95a0d60de9ea148063a9.600x338.jpg?t=1525881861","path_full":"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/ss_5834c153aeeea9c574af95a0d60de9ea148063a9.1920x1080.jpg?t=1525881861"},{"id":7,"path_thumbnail":"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/ss_fbe51beaf5081f76a1319c99f79793ee6beff01a.600x338.jpg?t=1525881861","path_full":"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/ss_fbe51beaf5081f76a1319c99f79793ee6beff01a.1920x1080.jpg?t=1525881861"},{"id":8,"path_thumbnail":"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/ss_83de34c51055759a4dfdb5bedca6b488a723b56c.600x338.jpg?t=1525881861","path_full":"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/ss_83de34c51055759a4dfdb5bedca6b488a723b56c.1920x1080.jpg?t=1525881861"},{"id":9,"path_thumbnail":"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/ss_134045d5dea19e087095399246a11e846e84a592.600x338.jpg?t=1525881861","path_full":"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/ss_134045d5dea19e087095399246a11e846e84a592.1920x1080.jpg?t=1525881861"},{"id":10,"path_thumbnail":"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/ss_3e2919ba1f41a32e95c3df99222c441567fa02ac.600x338.jpg?t=1525881861","path_full":"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/ss_3e2919ba1f41a32e95c3df99222c441567fa02ac.1920x1080.jpg?t=1525881861"},{"id":11,"path_thumbnail":"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/ss_1cd75b9d80bfabe8dddf26b9af08eb10dfcc2ecc.600x338.jpg?t=1525881861","path_full":"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/ss_1cd75b9d80bfabe8dddf26b9af08eb10dfcc2ecc.1920x1080.jpg?t=1525881861"},{"id":12,"path_thumbnail":"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/ss_f365ece08877bc0edb7b5b328c1e6b935fd760d5.600x338.jpg?t=1525881861","path_full":"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/ss_f365ece08877bc0edb7b5b328c1e6b935fd760d5.1920x1080.jpg?t=1525881861"}],"movies":[{"id":256694499,"name":"Launch Trailer","thumbnail":"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/256694499\/movie.293x165.jpg?t=1504542318","webm":{"480":"http:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/256694499\/movie480.webm?t=1504542318","max":"http:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/256694499\/movie_max.webm?t=1504542318"},"highlight":true},{"id":256703598,"name":"Santa's Shakedown Update","thumbnail":"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/256703598\/movie.293x165.jpg?t=1513178847","webm":{"480":"http:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/256703598\/movie480.webm?t=1513178847","max":"http:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/256703598\/movie_max.webm?t=1513178847"},"highlight":true},{"id":256689565,"name":"The Escapists 2 - Multiplayer Trailer","thumbnail":"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/256689565\/movie.293x165.jpg?t=1499788850","webm":{"480":"http:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/256689565\/movie480.webm?t=1499788850","max":"http:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/256689565\/movie_max.webm?t=1499788850"},"highlight":true},{"id":256689574,"name":"The Escapists 2 - Old West Trailer","thumbnail":"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/256689574\/movie.293x165.jpg?t=1499788861","webm":{"480":"http:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/256689574\/movie480.webm?t=1499788861","max":"http:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/256689574\/movie_max.webm?t=1499788861"},"highlight":true}],"recommendations":{"total":5257},"achievements":{"total":58,"highlighted":[{"name":"Ripped on the Inside","path":"https:\/\/steamcdn-a.akamaihd.net\/steamcommunity\/public\/images\/apps\/641990\/5764dbe0ef0580f7a48cad556d9bdb7888ea3e81.jpg"},{"name":"Criminal Mastermind","path":"https:\/\/steamcdn-a.akamaihd.net\/steamcommunity\/public\/images\/apps\/641990\/2551bb894fc4a5ed5725b336f89f55467eecdd4a.jpg"},{"name":"The Olympian","path":"https:\/\/steamcdn-a.akamaihd.net\/steamcommunity\/public\/images\/apps\/641990\/852757a092902302f59d12e876222e0fa4c5ddfe.jpg"},{"name":"Statistician","path":"https:\/\/steamcdn-a.akamaihd.net\/steamcommunity\/public\/images\/apps\/641990\/33a6d5b7ec9db7c3a3f2a3e4a662ce2086ad3ce1.jpg"},{"name":"Bad Intentions","path":"https:\/\/steamcdn-a.akamaihd.net\/steamcommunity\/public\/images\/apps\/641990\/ff867f080295abbd0753634b3f70269033686359.jpg"},{"name":"Bad Intentions Part 2","path":"https:\/\/steamcdn-a.akamaihd.net\/steamcommunity\/public\/images\/apps\/641990\/ab7cab24baa11c5571bcabe7fe4622cc116a8254.jpg"},{"name":"Dr. Love","path":"https:\/\/steamcdn-a.akamaihd.net\/steamcommunity\/public\/images\/apps\/641990\/abe1349d436ea989b5856310ef0befe376f5fde1.jpg"},{"name":"Artful Dodger","path":"https:\/\/steamcdn-a.akamaihd.net\/steamcommunity\/public\/images\/apps\/641990\/b62ed4f44bfd8a7be72a3bc6ccf10cbb445f6ef3.jpg"},{"name":"The Great Escape","path":"https:\/\/steamcdn-a.akamaihd.net\/steamcommunity\/public\/images\/apps\/641990\/c46b887e687231d2a021bc15fd1ba945060755cd.jpg"},{"name":"Artisan","path":"https:\/\/steamcdn-a.akamaihd.net\/steamcommunity\/public\/images\/apps\/641990\/07c34c9c0431a8e3d9d166d6a0519d7a8668aaf8.jpg"}]},"release_date":{"coming_soon":false,"date":"Aug 21, 2017"},"support_info":{"url":"https:\/\/www.team17.com\/support\/","email":"help@team17support.com"},"background":"https:\/\/steamcdn-a.akamaihd.net\/steam\/apps\/641990\/page_bg_generated_v6b.jpg?t=1525881861","content_descriptors":{"ids":[],"notes":null}}}}
#
# meson.build
#
# Author: Tony Crisci <tony@dubstepdish.com>
#
# Copyright (C) 2016 Igalia S.L. All rights reserved.
source_tests = [
'test_steam_store',
]
foreach t: source_tests
exe = executable(t, t + '.c',
install: false,
dependencies: must_deps,
c_args: [
'-DSTEAM_STORE_DATA_PATH="@0@/data/"'.format(meson.current_source_dir()),
'-DLUA_FACTORY_PLUGIN_PATH="@0@/src/lua-factory/"'.format(meson.build_root()),
'-DLUA_SOURCES_PATH="@0@/src/lua-factory/sources/"'.format(meson.source_root()),
])
test(t, exe)
endforeach
/*
* Copyright (C) 2018 Igalia S.L.
*
* Author: Tony Crisci <tony@dubstepdish.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#include <grilo.h>
#include <stdio.h>
static void
test_setup (void)
{
GError *error = NULL;
GrlRegistry *registry;
registry = grl_registry_get_default ();
grl_registry_load_all_plugins (registry, TRUE, &error);
g_assert_no_error (error);
}
static void
test_resolve_game_found (void)
{
GError *error = NULL;
GrlRegistry *registry;
GrlSource *source;
GrlOperationOptions *options;
GList *keys;
guint expected_n_thumbnails, expected_n_publishers, expected_n_developers;
GrlKeyID publisher_key, developer_key;
const GValue *developers, *publishers;
GList *publishers_list, *developers_list;
registry = grl_registry_get_default ();
source = grl_registry_lookup_source (registry, "grl-steam-store");
g_assert (source);
GrlMedia *media = grl_media_new ();
grl_media_set_id(media, "641990");
keys = grl_metadata_key_list_new (GRL_METADATA_KEY_TITLE,
GRL_METADATA_KEY_THUMBNAIL,
GRL_METADATA_KEY_DESCRIPTION,
GRL_METADATA_KEY_EXTERNAL_URL,
GRL_METADATA_KEY_RATING,
GRL_METADATA_KEY_PUBLICATION_DATE,
NULL);
options = grl_operation_options_new (NULL);
grl_operation_options_set_resolution_flags (options, GRL_RESOLVE_FULL);
grl_source_resolve_sync (source, media, keys, options, &error);
g_assert_no_error (error);
/* Thumbnail */
expected_n_thumbnails = grl_data_length (GRL_DATA (media), GRL_METADATA_KEY_THUMBNAIL);
g_assert_cmpuint (expected_n_thumbnails, ==, 1);
g_assert_cmpstr (grl_media_get_thumbnail_nth (media, 0),
==,
"https://steamcdn-a.akamaihd.net/steam/apps/641990/header.jpg?t=1525881861");
/* Description */
g_assert_cmpstr (grl_media_get_description (media),
==,
"<ABOUT_THE_GAME>");
/* Title */
g_assert_cmpstr (grl_media_get_title (media),
==,
"The Escapists 2");
/* Publication Date */
GDateTime *date_time = grl_media_get_publication_date (media);
g_assert_cmpint (g_date_time_get_year (date_time), ==, 2017);
/* External URL */
g_assert_cmpstr (grl_media_get_external_url (media),
==,
"https://www.team17.com/games/the-escapists-2/");
/* Rating */
g_assert_cmpfloat (grl_media_get_rating (media),
==,
75.0);
/* Genres */
gint expected_n_genres = grl_data_length (GRL_DATA (media), GRL_METADATA_KEY_GENRE);
g_assert_cmpuint (expected_n_genres, ==, 3);
g_assert_cmpstr (grl_media_get_genre_nth (media, 0),
==,
"Indie");
g_assert_cmpstr (grl_media_get_genre_nth (media, 1),
==,
"Simulation");
g_assert_cmpstr (grl_media_get_genre_nth (media, 2),
==,
"Strategy");
/* Publishers */
publisher_key = grl_registry_lookup_metadata_key (registry, "publisher");
publishers = grl_data_get (GRL_DATA (media), publisher_key);
g_assert_nonnull (publishers);
expected_n_publishers = grl_data_length (GRL_DATA (media), publisher_key);
g_assert_cmpuint (expected_n_publishers, ==, 1);
publishers_list = grl_data_get_single_values_for_key_string (GRL_DATA (media), publisher_key);
g_assert_nonnull (publishers_list);
g_assert_cmpstr ((gchar *)g_list_nth_data (publishers_list, 0),
==,
"Team17 Digital Ltd");
/* Developers */
developer_key = grl_registry_lookup_metadata_key(registry, "developer");
developers = grl_data_get (GRL_DATA (media), developer_key);
g_assert_nonnull (developers);
expected_n_developers = grl_data_length (GRL_DATA (media), developer_key);
g_assert_cmpuint (expected_n_developers, ==, 2);
developers_list = grl_data_get_single_values_for_key_string (GRL_DATA (media), developer_key);
g_assert_nonnull (developers_list);
g_assert_cmpstr ((gchar *)g_list_nth_data (developers_list, 0),
==,
"Team17 Digital Ltd");
g_assert_cmpstr ((gchar *)g_list_nth_data (developers_list, 1),
==,
"Mouldy Toof Studios");
}
int
main (int argc, char **argv)
{
g_setenv ("GRL_PLUGIN_PATH", LUA_FACTORY_PLUGIN_PATH, TRUE);
g_setenv ("GRL_LUA_SOURCES_PATH", LUA_SOURCES_PATH, TRUE);
g_setenv ("GRL_PLUGIN_LIST", "grl-lua-factory", TRUE);
g_setenv ("GRL_NET_MOCKED", STEAM_STORE_DATA_PATH "network-data.ini", TRUE);
grl_init (&argc, &argv);
g_test_init (&argc, &argv, NULL);
test_setup ();
g_test_add_func ("/steam-store/resolve/game-found", test_resolve_game_found);
gint result = g_test_run ();
grl_deinit ();
return result;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment