[discident-glib] test: Add test for failing EAN lookup
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [discident-glib] test: Add test for failing EAN lookup
- Date: Tue, 2 Apr 2013 13:49:38 +0000 (UTC)
commit edff8ebe361bc28b60c6473253ad0224e0ed5229
Author: Bastien Nocera <hadess hadess net>
Date: Tue Apr 2 15:42:11 2013 +0200
test: Add test for failing EAN lookup
discident-glib/test-diglib.c | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/discident-glib/test-diglib.c b/discident-glib/test-diglib.c
index 3fb7c18..45e31dd 100644
--- a/discident-glib/test-diglib.c
+++ b/discident-glib/test-diglib.c
@@ -105,6 +105,26 @@ test_ean (void)
}
static void
+test_ean_fail (void)
+{
+ DiscidentEan *ean;
+ char *title, *img_url;
+ GError *error = NULL;
+ gboolean ret;
+
+ ean = discident_ean_new ();
+
+ /* Ghost In The Shell, FR */
+ ret = discident_ean_lookup_sync (ean, "3388330031138", &title, &img_url, &error);
+ g_assert (ret == FALSE);
+ g_assert_cmpstr ("No response for requested barcode", ==, error->message);
+ g_error_free (error);
+ g_free (title);
+ g_free (img_url);
+ g_object_unref (ean);
+}
+
+static void
discident_title_print (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
@@ -292,6 +312,7 @@ int main (int argc, char **argv)
if (uris == NULL) {
g_test_add_func ("/discident/ean", test_ean);
+ g_test_add_func ("/discident/ean_fail", test_ean_fail);
g_test_add_func ("/discident/hash", test_hash);
g_test_add_func ("/discident/file_list", test_file_list);
g_test_add_func ("/discident/json", test_json);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]