]> git.0d.be Git - empathy.git/blob - tests/check-empathy-chatroom-manager.c
fix leak in destroy_test_account
[empathy.git] / tests / check-empathy-chatroom-manager.c
1 #include <stdlib.h>
2 #include <stdio.h>
3 #include <string.h>
4 #include <glib/gstdio.h>
5
6 #include <gconf/gconf.h>
7 #include <gconf/gconf-client.h>
8 #include <check.h>
9 #include "check-helpers.h"
10 #include "check-libempathy.h"
11 #include "check-empathy-helpers.h"
12
13 #include <libempathy/empathy-chatroom-manager.h>
14
15 #define CHATROOM_SAMPLE "chatrooms-sample.xml"
16 #define CHATROOM_FILE "chatrooms.xml"
17
18 START_TEST (test_empathy_chatroom_manager_new)
19 {
20   EmpathyChatroomManager *mgr;
21   gchar *cmd;
22   gchar *file;
23   McAccount *account;
24
25   account = create_test_account ();
26
27   copy_xml_file (CHATROOM_SAMPLE, CHATROOM_FILE);
28
29   file = get_user_xml_file (CHATROOM_FILE);
30   /* change the chatrooms XML file to use the account we just created */
31   cmd = g_strdup_printf ("sed -i 's/CHANGE_ME/%s/' %s",
32       mc_account_get_unique_name (account), file);
33   system (cmd);
34   g_free (cmd);
35
36   mgr = empathy_chatroom_manager_new (file);
37
38   fail_if (empathy_chatroom_manager_get_count (mgr, account) != 2);
39
40   g_free (file);
41   g_object_unref (mgr);
42   destroy_test_account (account);
43 }
44 END_TEST
45
46 TCase *
47 make_empathy_chatroom_manager_tcase (void)
48 {
49     TCase *tc = tcase_create ("empathy-chatroom-manager");
50     tcase_add_test (tc, test_empathy_chatroom_manager_new);
51     return tc;
52 }