Commit 70b9d78a authored by Rico Tzschichholz's avatar Rico Tzschichholz

Add test for Updater.update

parent 9c43785f
......@@ -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();
});
}
}
}
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