[libhttpseverywhere] Add test for Updater.update



commit 70b9d78a1fb090971c87e0cb420eebb890d0407d
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Tue Jan 8 08:32:49 2019 +0100

    Add test for Updater.update

 test/main.vala | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
---
diff --git a/test/main.vala b/test/main.vala
index e70c0a2..9448249 100644
--- a/test/main.vala
+++ b/test/main.vala
@@ -28,6 +28,7 @@ namespace HTTPSEverywhereTest {
             Test.init(ref args);
             ContextTest.add_tests();
             RulesetTest.add_tests();
+            UpdaterTest.add_tests();
             Test.run();
             return 0;
         }
@@ -167,4 +168,32 @@ namespace HTTPSEverywhereTest {
             });
         }
     }
+
+    class UpdaterTest {
+        public static void add_tests () {
+            Test.add_func("/httpseverywhere/updater/update", () => {
+                var context = new Context();
+                context.init.begin(null, (obj, res) => {
+                    try {
+                        context.init.end(res);
+                    } catch (Error e) {
+                        GLib.assert_not_reached();
+                    }
+                });
+                var updater = new Updater(context);
+                var m = new MainLoop();
+                updater.update.begin(null, (obj, res) => {
+                    try {
+                        updater.update.end(res);
+                        m.quit();
+                    } catch (UpdateError.NO_UPDATE_AVAILABLE e) {
+                        m.quit();
+                    } catch (Error e) {
+                        GLib.assert_not_reached();
+                    }
+                });
+                m.run();
+            });
+        }
+    }
 }


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