[grilo-plugins] tests: thetvdb tests cache-only



commit 9b67d69d47392e7ee74d3cb28098aa8edb5215b9
Author: Victor Toso <me victortoso com>
Date:   Sat May 2 00:01:16 2015 +0200

    tests: thetvdb tests cache-only
    
    cache-only test with empty database and with filled database but without
    network
    
    https://bugzilla.gnome.org/show_bug.cgi?id=748422

 tests/thetvdb/test_thetvdb_resolve_shows.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/tests/thetvdb/test_thetvdb_resolve_shows.c b/tests/thetvdb/test_thetvdb_resolve_shows.c
index 73691b2..8a73844 100644
--- a/tests/thetvdb/test_thetvdb_resolve_shows.c
+++ b/tests/thetvdb/test_thetvdb_resolve_shows.c
@@ -254,6 +254,27 @@ test_shows_normal(void)
   test_shows (GRL_RESOLVE_NORMAL, FALSE);
 }
 
+static void
+test_shows_fast_only_empty_db(void)
+{
+  test_reset_thetvdb ();
+  test_shows (GRL_RESOLVE_FAST_ONLY, TRUE);
+}
+
+static void
+test_shows_fast_only_full_db(void)
+{
+  gchar *mock = g_strdup (g_getenv ("GRL_NET_MOCKED"));
+  test_reset_thetvdb ();
+  /* Fill database */
+  test_shows (GRL_RESOLVE_NORMAL, FALSE);
+  /* Fail all web requests for cache-only test */
+  g_setenv ("GRL_NET_MOCKED", "/does/not/exist/config.ini", TRUE);
+  test_shows (GRL_RESOLVE_FAST_ONLY, FALSE);
+  g_setenv ("GRL_NET_MOCKED", mock, TRUE);
+  g_free (mock);
+}
+
 gint
 main (gint argc, gchar **argv)
 {
@@ -271,6 +292,8 @@ main (gint argc, gchar **argv)
   test_setup_thetvdb ();
 
   g_test_add_func ("/thetvdb/resolve/normal/shows", test_shows_normal);
+  g_test_add_func ("/thetvdb/resolve/fast-only/empty-db/shows", test_shows_fast_only_empty_db);
+  g_test_add_func ("/thetvdb/resolve/fast-only/full-db/shows", test_shows_fast_only_full_db);
   g_test_add_func ("/thetvdb/resolve/fuzzy-name-shows", test_shows_fuzzy_name);
 
   gint result = g_test_run ();


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