[grilo-plugins/wip/jfelder/theaudiodb-artist-art: 2/4] theaudiodb: Add a unit test



commit 3d8839bc2011682c7d69c00b40701784dd827ea8
Author: Jean Felder <jfelder src gnome org>
Date:   Thu Aug 22 10:29:21 2019 +0200

    theaudiodb: Add a unit test

 tests/lua-factory/sources/data/config.ini          |   6 +
 .../sources/data/theaudiodb_pixies_doolittle.txt   |   1 +
 .../data/theaudiodb_radiohead_nevermind.txt        |   1 +
 tests/lua-factory/sources/meson.build              |   1 +
 tests/lua-factory/sources/test_lua_theaudiodb.c    | 126 +++++++++++++++++++++
 5 files changed, 135 insertions(+)
---
diff --git a/tests/lua-factory/sources/data/config.ini b/tests/lua-factory/sources/data/config.ini
index 6e24379b..4844157b 100644
--- a/tests/lua-factory/sources/data/config.ini
+++ b/tests/lua-factory/sources/data/config.ini
@@ -13,3 +13,9 @@ data = acoustid_trombone_shorty_buckjump.txt
 data = acoustid_philip_glass_the_passion_of.txt
 
[https://api.acoustid.org/v2/lookup?client=ACOUSTID_TEST_MOCK_API_KEY&meta=compress+recordings+releasegroups+releases+sources+tracks&duration=385]
 data = acoustid_radiohead_paranoid_android.txt
+
+# test_lua_theaudiodb
+[https://theaudiodb.com/api/v1/json/THEAUDIODB_TEST_MOCK_API_KEY/searchalbum.php?s=pixies&a=doolittle]
+data = theaudiodb_pixies_doolittle.txt
+[https://theaudiodb.com/api/v1/json/THEAUDIODB_TEST_MOCK_API_KEY/searchalbum.php?s=nirvana&a=nevermind]
+data = theaudiodb_radiohead_nevermind.txt
diff --git a/tests/lua-factory/sources/data/theaudiodb_pixies_doolittle.txt 
b/tests/lua-factory/sources/data/theaudiodb_pixies_doolittle.txt
new file mode 100644
index 00000000..2c49247a
--- /dev/null
+++ b/tests/lua-factory/sources/data/theaudiodb_pixies_doolittle.txt
@@ -0,0 +1 @@
+{"album":[{"idAlbum":"2120443","idArtist":"112739","idLabel":null,"strAlbum":"Doolittle","strAlbumStripped":"Doolittle","strArtist":"Pixies","strArtistStripped":"Pixies","intYearReleased":"1989","strStyle":"Rock/Pop","strGenre":"Alternative
 
Rock","strLabel":null,"strReleaseFormat":"Album","intSales":"0","strAlbumThumb":"https://www.theaudiodb.com/images/media/album/thumb/doolittle-4e3a8a18cb017.jpg","strAlbumThumbHQ":null,"strAlbumThumbBack":null,"strAlbumCDart":"https://www.theaudiodb.com/images/media/album/cdart/doolittle-4e73926514e07.png","strAlbumSpine":null,"strAlbum3DCase":null,"strAlbum3DFlat":null,"strAlbum3DFace":null,"strAlbum3DThumb":null,"strDescriptionEN":"Doolittle
 is the second studio album from the American alternative rock band Pixies, released in April 1989 on 4AD. 
The album's offbeat and dark subject material, featuring references to surrealism, Biblical violence, torture 
and death, contrasts with the clean production sound achieved by the newly hired pro
 ducer Gi
 l Norton. Doolittle was the Pixies' first international release, with Elektra Records acting as the album's 
distributor in the United States and PolyGram in Canada.\nPixies released two singles from Doolittle, \"Here 
Comes Your Man\" and \"Monkey Gone to Heaven\", both of which were chart successes on the US chart for Modern 
Rock Tracks. The album itself reached number eight on the UK Albums Chart, an unexpected success for the 
band. In retrospect, album tracks such as \"Debaser\", \"Wave of Mutilation\", \"Monkey Gone to Heaven\", 
\"Gouge Away\", and \"Hey\" are highly acclaimed by critics, while the album, along with debut LP Surfer 
Rosa, is often seen as the band's strongest work.\nDoolittle has continued to sell consistently well in the 
years since its release, and in 1995 was certified gold by the Recording Industry Association of America. The 
album has been cited as inspirational by many alternative artists, while numerous music publications have 
ranked it as one of th
 e most i
 nfluential albums ever. A 2003 poll of NME writers ranked Doolittle as the second-greatest album of all 
time, and Rolling Stone placed the album at 226 on its list of \"The 500 Greatest Albums of All 
Time\".","strDescriptionDE":null,"strDescriptionFR":null,"strDescriptionCN":null,"strDescriptionIT":null,"strDescriptionJP":null,"strDescriptionRU":null,"strDescriptionES":null,"strDescriptionPT":null,"strDescriptionSE":null,"strDescriptionNL":null,"strDescriptionHU":null,"strDescriptionNO":null,"strDescriptionIL":null,"strDescriptionPL":null,"intLoved":"1","intScore":"9.4","intScoreVotes":"5","strReview":"If
 anything is likely to make you feel old, it's the grim realisation that some of your favourite ever records 
are over 20 years old. Take, for example, Pixies' Doolittle. Originally released in April 1989, it came in a 
year which had already given us New Order's Technique, Lou Reed's New York and was about to unleash 
astonishing debuts from both The Stone Roses and Soul II So
 ul along
 side The Cure's last fully good album, Disintegration. A vintage year indeed. \n\nNow 20 years on, 
Doolittle's power and influence has barely been beaten. It was this album that inspired Kurt Cobain's vision 
for Nirvana, created the quiet/loud dynamic that Mogwai owe a career to, had everyone from Bowie to 
Radiohead, Blur to PJ Harvey awestruck and when they reformed \u2013 one of the first to do so in the last 
few years before it got silly \u2013 it was Doolittle that many middle-aged indiepeople were wanting to hear 
and howl and scream along to. \n\nIt's not hard to see why. After building themselves a nice reputation on 
the back of their 'proper' debut, Surfer Rosa, it was Doolittle that took them from being fawned over in 
Melody Maker into the actual charts to become one of 4AD's biggest successes of that time. With the key 
singles Monkey Gone To Heaven and Here Comes Your Man, Black Francis had distilled death, horror, whores, 
biblical imagery and undersea myths into a 
 successi
 on of short sharp chunks of immense catchiness. The unearthly howls of Debaser and Dead; the calm dead-eyed 
destroyer of Wave Of Mutilation; the warped southern soul of Hey; the controlled abandon and angles that Joey 
Santiago coaxed from his guitar throughout. Even drummer David Lovering got a song with La La Love You. And 
that's not to mention that the very presence of Kim Deal \u2013 a year away from inventing The Breeders - on 
this album consolidated her position as one of the coolest women on Earth. \n\nThere is little flab or room 
for negotiation with Doolittle, its 15 tracks could be released now and still wipe the floor of many of late 
noughties efforts. It's as perfect today as it was back then. Genuinely 
amazing.","strMood":"Gritty","strTheme":null,"strSpeed":"","strLocation":null,"strMusicBrainzID":"1aa41b19-5a72-341b-bd91-4cf61d1dab6b","strMusicBrainzArtistID":"b6b2bb8d-54a9-491f-9607-7b546023b433","strAllMusicID":"mw0000653196","strBBCReviewID":"g9jw","strRateYo
 urMusicI
 
D":"doolittle","strDiscogsID":"16764","strWikidataID":"Q909006","strWikipediaID":"Doolittle_(album)","strGeniusID":null,"strLyricWikiID":null,"strMusicMozID":null,"strItunesID":null,"strAmazonID":null,"strLocked":"unlocked"}]}
diff --git a/tests/lua-factory/sources/data/theaudiodb_radiohead_nevermind.txt 
b/tests/lua-factory/sources/data/theaudiodb_radiohead_nevermind.txt
new file mode 100644
index 00000000..c1b801da
--- /dev/null
+++ b/tests/lua-factory/sources/data/theaudiodb_radiohead_nevermind.txt
@@ -0,0 +1 @@
+{"album":[{"idAlbum":"2110839","idArtist":"111319","idLabel":null,"strAlbum":"Nevermind","strAlbumStripped":"Nevermind","strArtist":"Nirvana","strArtistStripped":"Nirvana","intYearReleased":"1991","strStyle":"Rock/Pop","strGenre":"Grunge","strLabel":null,"strReleaseFormat":"Album","intSales":"30000000","strAlbumThumb":"https://www.theaudiodb.com/images/media/album/thumb/nevermind-4dcdd240da9e2.jpg","strAlbumThumbHQ":null,"strAlbumThumbBack":null,"strAlbumCDart":"https://www.theaudiodb.com/images/media/album/cdart/nevermind-5232416c46820.png","strAlbumSpine":null,"strAlbum3DCase":null,"strAlbum3DFlat":null,"strAlbum3DFace":null,"strAlbum3DThumb":null,"strDescriptionEN":"Nevermind
 is the second studio album by the American rock band Nirvana, released on September 24, 1991. Produced by 
Butch Vig, Nevermind was the group's first release on DGC Records. Frontman Kurt Cobain sought to make music 
outside the restrictive confines of the Seattle grunge scene, drawing influence from g
 roups su
 ch as the Pixies and their use of song volume dynamics.\nDespite low commercial expectations by the band and 
its record label, Nevermind became a surprise success in late 1991, largely due to the popularity of its 
first single, \"Smells Like Teen Spirit\". The album also produced three other hit singles, \"Come as You 
Are\", \"Lithium\" and \"In Bloom\". By January 1992, it had replaced Michael Jackson's album Dangerous at 
number one on the Billboard charts. The Recording Industry Association of America has certified the album 
Diamond (over 10 million copies shipped), and the album has sold over 30 million copies worldwide. Nevermind 
was responsible for bringing alternative rock to a large mainstream audience, and critics subsequently 
regarded it as one of the best albums of all time.","strDescriptionDE":null,"strDescriptionFR":"Nevermind est 
le deuxi\u00e8me album studio du groupe am\u00e9ricain de grunge Nirvana, sorti le 24 septembre 1991 par le 
label DGC Records. Kurt Co
 bain \u0
 0e9crit et compose seul quasiment toutes les chansons de l'album et le groupe commence \u00e0 enregistrer en 
avril 1990 avec le producteur Butch Vig mais la session est interrompue pr\u00e9matur\u00e9ment. Le batteur 
Chad Channing quitte ensuite le groupe et est remplac\u00e9 par Dave Grohl. Le groupe change \u00e9galement 
de label et reprend l'enregistrement de l'album en mai 1991 avec de nouvelles chansons, dont Smells Like Teen 
Spirit et Come as You Are.\n\nL'album ne b\u00e9n\u00e9ficie pas d'une promotion particuli\u00e8re mais la 
surprenante popularit\u00e9 de son premier single, Smells Like Teen Spirit, fait de lui un succ\u00e8s 
commercial inattendu \u00e0 la fois pour le groupe et pour le label. Il atteint notamment la premi\u00e8re 
place des classements musicaux de ventes d'albums aux \u00c9tats-Unis, en France et au Canada et est 
\u00e9galement pl\u00e9biscit\u00e9 par la critique. Nevermind s'est vendu depuis \u00e0 plus de 30 millions 
d'exemplaires \u00e0 traver
 s le mon
 de.\n\nL'album est domin\u00e9 par un puissant son punk rock parsem\u00e9 de m\u00e9lodies pop accrocheuses 
et le sens des paroles des chansons est souvent difficile \u00e0 interpr\u00e9ter. Il fait sortir de l'ombre 
la sc\u00e8ne grunge de Seattle et est un facteur d\u00e9terminant de la popularisation du rock alternatif 
dans le monde entier. V\u00e9ritable ph\u00e9nom\u00e8ne des ann\u00e9es 1990, il marque le retour des 
guitares satur\u00e9es dans la musique pour toute la d\u00e9cennie et laisse sa trace sur toute une 
g\u00e9n\u00e9ration. En 2011, il est r\u00e9\u00e9dit\u00e9 dans une \u00e9dition sp\u00e9ciale pour les 
vingt ans de sa 
sortie.","strDescriptionCN":null,"strDescriptionIT":null,"strDescriptionJP":null,"strDescriptionRU":null,"strDescriptionES":"Nevermind
 es el segundo \u00e1lbum de estudio de la banda estadounidense Nirvana, publicado el 24 de septiembre de 
1991. Producido por Butch Vig, Nevermind fue el primer lanzamiento de la banda con DGC Records. El l
 \u00edde
 r de la agrupaci\u00f3n, Kurt Cobain, trat\u00f3 de hacer m\u00fasica fuera de los l\u00edmites restrictivos 
de la escena grunge de Seattle, aprovechando la influencia de grupos como los Pixies y su uso de la 
din\u00e1mica de canciones ruidosas y calmadas.\n\nPese a las escasas esperanzas comerciales por parte de la 
banda y del sello discogr\u00e1fico, Nevermind se convirti\u00f3 en un sorprendente \u00e9xito a finales de 
1991, en gran parte debido a su primer sencillo, \u00abSmells Like Teen Spirit\u00bb. En enero de 1992 
hab\u00eda desbancado al \u00e1lbum de Michael Jackson Dangerous del n\u00famero uno del Billboard. La RIAA 
certific\u00f3 el \u00e1lbum con disco de diamante (10 millones de copias vendidas). Nevermind fue el 
responsable de dar a conocer el rock alternativo al gran p\u00fablico y la cr\u00edtica lo calific\u00f3 como 
uno de los mejores \u00e1lbumes de todos los tiempos. Ha vendido 30 millones de copias en todo el mundo. Fue 
clasificado en el #17 en la lis
 ta de Lo
 s 500 mejores albumes de la historia seg\u00fan Rolling Stone.","strDescriptionPT":"Nevermind \u00e9 o 
segundo \u00e1lbum de est\u00fadio da banda de rock norte-americana Nirvana, lan\u00e7ado em 1991. Assim que 
foi lan\u00e7ado, conquistou aclama\u00e7\u00e3o da cr\u00edtica e sucesso de p\u00fablico, vendendo em torno 
de 30 milh\u00f5es, 11,5 milh\u00f5es nos Estados Unidos segundo a RIAA. Este \u00e1lbum consagrou o Nirvana 
no mundo todo, famoso pela sua variada sonoridade e principalmente pela sua capa, com uma foto do beb\u00ea 
Spencer Elden nadando atr\u00e1s de uma nota de 1 d\u00f3lar presa num anzol, eleita pela revista Rolling 
Stone como a melhor capa de todos os tempos. Este \u00e1lbum est\u00e1 na lista dos 200 \u00e1lbuns 
definitivos no Rock and Roll Hall of Fame, ficando na 10\u00aa coloca\u00e7\u00e3o, sendo o \u00fanico 
\u00e1lbum da d\u00e9cada de 90, no Top 10.\n\nMesmo lan\u00e7ado h\u00e1 20 anos, Nevermind ainda continua 
sendo um dos trabalhos mais influ
 entes do
  cen\u00e1rio musical. Recentemente, o canal de TV norte-americano VH1, elegeu Nevermind como o segundo 
melhor \u00e1lbum de rock da hist\u00f3ria, apenas atr\u00e1s de Revolver, dos 
Beatles.","strDescriptionSE":null,"strDescriptionNL":null,"strDescriptionHU":null,"strDescriptionNO":null,"strDescriptionIL":null,"strDescriptionPL":null,"intLoved":null,"intScore":"9","intScoreVotes":"6","strReview":"Before
 its September 1991 release, Geffen Records were hoping to sell 250,000 copies of Nevermind. But Nirvana's 
second album went on to shift 100 times that amount; and, since the suicide of frontman Kurt Cobain in April 
1994, its surprise success has been acknowledged as a factor in its primary songwriter\u2019s tragic 
demise.\nWith hindsight it is easy to work out why Cobain struggled with the LP after its completion and 
release. In Utero, Nirvana's third and final studio album of 1993, was a difficult, abrasive record; compared 
to its predecessor, it's clearly the product of a 
 mind pus
 hed beyond its limit. Cobain would dismiss Nevermind, the follow-up to 1989's scrappy debut Bleach, as 
\u201ca Motley Crue record\u201d\u009d rather than the punk album that may have been initially intended.\nThe 
tunes are still ace, but there is an unquestionable MTV sheen plastered over the bulk of them. The band 
enlisted Butch Vig to produce the record and trusted him behind the desk. But when mixing went awry, Slayer 
mixer Andy Wallace was brought in to tweak the final mixes. While Wallace used less studio trickery than the 
average pop producer, Kurt was right: what now sits on 26 million shelves is definitely not punk.\nInstead, 
it\u2019s an awesome mainstream rock record. Its four standalone cuts, including Smells Like Teen Spirit and 
Come As You, Are are exemplary, soaring rock singles which quickly became angst-ridden anthems for 
disaffected teens across the world. The quiet/loud formula that Nirvana made their own was stolen from the 
Pixies, as Kurt freely admitted;
  but Fra
 nk Black\u2019s merry crew never managed to hook listeners like Nevermind did.\nThe guitars are all 
crunched, phased and compressed to within an inch of their six strings, and the drum sounds are predictably 
accountant-tight and brickie-tough. Lyrically, aside from Polly, Nevermind rarely goes beyond woe-is-me or 
the cryptic: witness On A Plain\u2019s \"The black sheep got / blackmailed again / forgot to put / on a zip 
code\".\nBut even the occasional piece of nonsensical wordplay couldn\u2019t hide the beguiling, revelatory 
side of Cobain's writing. The aforementioned Polly is about a rapist, while Kurt said Something in the Way 
was about sleeping rough - although friends of his have since denied he ever did.\nAnd there were Kurt\u2019s 
vocals. By turns haunted and hurting, caged and desperate, it\u2019s his scuffed, torn diary of a voice that 
you remember after the guitars have faded. Ultimately it's his fraying presence that ensures that Nevermind 
is a flawed classic, but
  a class
 ic just the 
same.","strMood":"Sad","strTheme":null,"strSpeed":"Medium","strLocation":null,"strMusicBrainzID":"1b022e01-4da6-387b-8658-8678046e4cef","strMusicBrainzArtistID":"5b11f4ce-a62d-471e-81fc-a69a8278c7da","strAllMusicID":"mw0000185616","strBBCReviewID":"f8dp","strRateYourMusicID":"nevermind","strDiscogsID":"13814","strWikidataID":"Q17444","strWikipediaID":"Nevermind","strGeniusID":"Nevermind","strLyricWikiID":null,"strMusicMozID":"Nevermind","strItunesID":null,"strAmazonID":null,"strLocked":"unlocked"},{"idAlbum":"2270453","idArtist":"111319","idLabel":null,"strAlbum":"Nevermind,
 It's An Interview","strAlbumStripped":"Nevermind Its An 
Interview","strArtist":"Nirvana","strArtistStripped":"Nirvana","intYearReleased":"1992","strStyle":"Rock/Pop","strGenre":"Grunge","strLabel":null,"strReleaseFormat":"Interview","intSales":"0","strAlbumThumb":"https://www.theaudiodb.com/images/media/album/thumb/qvvspr1476099265.jpg","strAlbumThumbHQ":null,"strAlbumThumbBack":null,"strAlbu
 mCDart":
 
"","strAlbumSpine":null,"strAlbum3DCase":null,"strAlbum3DFlat":null,"strAlbum3DFace":null,"strAlbum3DThumb":null,"strDescription":null,"strDescriptionDE":null,"strDescriptionFR":null,"strDescriptionCN":null,"strDescriptionIT":null,"strDescriptionJP":null,"strDescriptionRU":null,"strDescriptionES":null,"strDescriptionPT":null,"strDescriptionSE":null,"strDescriptionNL":null,"strDescriptionHU":null,"strDescriptionNO":null,"strDescriptionIL":null,"strDescriptionPL":null,"intLoved":null,"intScore":null,"intScoreVotes":null,"strReview":"","strMood":"Sad","strTheme":"","strSpeed":"Medium","strLocation":null,"strMusicBrainzID":"83d6f693-9545-377d-ab94-f5de03823eed","strMusicBrainzArtistID":"5b11f4ce-a62d-471e-81fc-a69a8278c7da","strAllMusicID":null,"strBBCReviewID":null,"strRateYourMusicID":null,"strDiscogsID":null,"strWikidataID":null,"strWikipediaID":null,"strGeniusID":null,"strLyricWikiID":null,"strMusicMozID":null,"strItunesID":null,"strAmazonID":null,"strLocked":"unlocked"}]}
diff --git a/tests/lua-factory/sources/meson.build b/tests/lua-factory/sources/meson.build
index c2166640..929b6d72 100644
--- a/tests/lua-factory/sources/meson.build
+++ b/tests/lua-factory/sources/meson.build
@@ -10,6 +10,7 @@ acoustid_resources = gnome.compile_resources('acoustidresources',
     c_name: '_grl_lua_acoustid')
 
 source_tests = [
+    'test_lua_theaudiodb'
 ]
 
 if chromaprint_enabled
diff --git a/tests/lua-factory/sources/test_lua_theaudiodb.c b/tests/lua-factory/sources/test_lua_theaudiodb.c
new file mode 100644
index 00000000..c06eb2fc
--- /dev/null
+++ b/tests/lua-factory/sources/test_lua_theaudiodb.c
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2019 Grilo Project
+ *
+ * Author: Jean Felder <jfelder gnome org>
+ *
+ * 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 "test_lua_factory_utils.h"
+
+#define THEAUDIODB_ID  "grl-theaudiodb-cover"
+
+#define TEST_PLUGINS_PATH  LUA_FACTORY_PLUGIN_PATH
+#define TEST_PLUGINS_LOAD  LUA_FACTORY_ID
+
+#define THEAUDIODB_OPS GRL_OP_RESOLVE
+
+static void
+test_resolve_album_cover (void)
+{
+  guint i, expected_nr_thumbnails;
+  GList *keys;
+  GrlMedia *media;
+  GrlOperationOptions *options;
+  GrlSource *source;
+  GError *error = NULL;
+
+  struct {
+    gchar *artist;
+    gchar *album;
+    guint nr_thumbnails;
+    gchar *first_thumbnail;
+    gchar *second_thumbnail;
+  } audios[] = {
+   { "pixies", "doolittle",
+     2,
+     "https://www.theaudiodb.com/images/media/album/thumb/doolittle-4e3a8a18cb017.jpg";,
+     "https://www.theaudiodb.com/images/media/album/cdart/doolittle-4e73926514e07.png";
+   },
+   {
+     "nirvana", "nevermind",
+     2,
+     "https://www.theaudiodb.com/images/media/album/thumb/nevermind-4dcdd240da9e2.jpg";,
+     "https://www.theaudiodb.com/images/media/album/cdart/nevermind-5232416c46820.png";
+   },
+  };
+
+  source = test_lua_factory_get_source (THEAUDIODB_ID, THEAUDIODB_OPS);
+
+  keys = grl_metadata_key_list_new (GRL_METADATA_KEY_THUMBNAIL);
+  options = grl_operation_options_new (NULL);
+  grl_operation_options_set_resolution_flags (options, GRL_RESOLVE_NORMAL);
+
+  for (i = 0; i < G_N_ELEMENTS (audios); i++) {
+    media = grl_media_audio_new ();
+    grl_media_set_album (media, audios[i].album);
+    grl_media_set_artist (media, audios[i].artist);
+
+    grl_source_resolve_sync (source,
+                             GRL_MEDIA (media),
+                             keys,
+                             options,
+                             &error);
+    g_assert_no_error (error);
+
+    expected_nr_thumbnails = grl_data_length (GRL_DATA (media), GRL_METADATA_KEY_THUMBNAIL);
+    g_assert_cmpuint (expected_nr_thumbnails, ==, audios[i].nr_thumbnails);
+
+    g_assert_cmpstr (grl_media_get_thumbnail_nth (GRL_MEDIA (media), 0), ==, audios[i].first_thumbnail);
+    g_assert_cmpstr (grl_media_get_thumbnail_nth (GRL_MEDIA (media), 1), ==, audios[i].second_thumbnail);
+
+    g_object_unref (media);
+  }
+
+  g_list_free (keys);
+  g_object_unref (options);
+}
+
+static void
+test_theaudiodb_setup (gint *p_argc,
+                       gchar ***p_argv)
+{
+  GrlConfig *config;
+
+  g_setenv ("GRL_PLUGIN_PATH", TEST_PLUGINS_PATH, TRUE);
+  g_setenv ("GRL_PLUGIN_LIST", TEST_PLUGINS_LOAD, TRUE);
+  g_setenv ("GRL_LUA_SOURCES_PATH", LUA_FACTORY_SOURCES_PATH, TRUE);
+  g_setenv ("GRL_NET_MOCKED", LUA_FACTORY_SOURCES_DATA_PATH "config.ini", TRUE);
+
+  grl_init (p_argc, p_argv);
+  g_test_init (p_argc, p_argv, NULL);
+
+  config = grl_config_new (LUA_FACTORY_ID, THEAUDIODB_ID);
+  grl_config_set_api_key (config, "THEAUDIODB_TEST_MOCK_API_KEY");
+  test_lua_factory_setup (config);
+}
+
+gint
+main (gint argc, gchar **argv)
+{
+  test_theaudiodb_setup (&argc, &argv);
+
+  g_test_add_func ("/lua_factory/sources/theaudiodb/resolve/albumcover",
+                   test_resolve_album_cover);
+
+  gint result = g_test_run ();
+
+  test_lua_factory_shutdown ();
+  test_lua_factory_deinit ();
+
+  return result;
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]