- ModestConf *conf = NULL;
-
- g_type_init ();
-
- conf = modest_conf_new ();
- fail_unless (MODEST_IS_CONF (conf),
- "modest_conf_new failed");
-
- account_mgr = modest_account_mgr_new (conf);
- fail_unless (MODEST_IS_ACCOUNT_MGR (account_mgr),
- "modest_account_mgr_new failed");
-}
-
-static void
-fx_teardown_default_account_mgr ()
-{
- g_object_unref (account_mgr);
+ fail_unless (gtk_init_check (NULL, NULL));
+
+ fail_unless (g_setenv (MODEST_DIR_ENV, ".modesttest", TRUE));
+ fail_unless (g_setenv (MODEST_NAMESPACE_ENV, "/apps/modesttest", TRUE));
+ fail_unless (modest_init (0, NULL), "Failed running modest_init");
+
+ account_mgr = modest_runtime_get_account_mgr ();
+ fail_unless (MODEST_IS_ACCOUNT_MGR (account_mgr),
+ "modest_account_mgr_new failed");
+
+ /* cleanup old garbage (from previous runs)*/
+ if (modest_account_mgr_account_exists(account_mgr,
+ TEST_MODEST_ACCOUNT_NAME,
+ FALSE))
+ modest_account_mgr_remove_account (account_mgr,
+ TEST_MODEST_ACCOUNT_NAME);
+ if (modest_account_mgr_account_exists(account_mgr,
+ TEST_MODEST_ACCOUNT_NAME,
+ TRUE)) {
+ modest_account_mgr_remove_server_account (account_mgr,
+ TEST_MODEST_ACCOUNT_NAME);
+ }