aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-10-13 15:54:25 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-10-13 15:54:25 +0800
commit7efe482b09cb2709fc82d777827c0043d0035406 (patch)
tree67f811e6f2072bf63864fe1256ff3426f16265c8
parent44352aaa83077ed3853a74b65c486116653d10ac (diff)
downloadgsoc2013-empathy-7efe482b09cb2709fc82d777827c0043d0035406.tar
gsoc2013-empathy-7efe482b09cb2709fc82d777827c0043d0035406.tar.gz
gsoc2013-empathy-7efe482b09cb2709fc82d777827c0043d0035406.tar.bz2
gsoc2013-empathy-7efe482b09cb2709fc82d777827c0043d0035406.tar.lz
gsoc2013-empathy-7efe482b09cb2709fc82d777827c0043d0035406.tar.xz
gsoc2013-empathy-7efe482b09cb2709fc82d777827c0043d0035406.tar.zst
gsoc2013-empathy-7efe482b09cb2709fc82d777827c0043d0035406.zip
factor out create_test_account
svn path=/trunk/; revision=1554
-rw-r--r--tests/check-empathy-chatroom-manager.c5
-rw-r--r--tests/check-empathy-chatroom.c6
-rw-r--r--tests/check-empathy-helpers.c14
-rw-r--r--tests/check-empathy-helpers.h1
4 files changed, 18 insertions, 8 deletions
diff --git a/tests/check-empathy-chatroom-manager.c b/tests/check-empathy-chatroom-manager.c
index 81b7e1c33..e340378ce 100644
--- a/tests/check-empathy-chatroom-manager.c
+++ b/tests/check-empathy-chatroom-manager.c
@@ -20,11 +20,9 @@ START_TEST (test_empathy_chatroom_manager_new)
EmpathyChatroomManager *mgr;
gchar *cmd;
gchar *file;
- McProfile *profile;
McAccount *account;
- profile = mc_profile_lookup ("test");
- account = mc_account_create (profile);
+ account = create_test_account ();
copy_xml_file (CHATROOM_SAMPLE, CHATROOM_FILE);
@@ -41,7 +39,6 @@ START_TEST (test_empathy_chatroom_manager_new)
g_free (file);
g_object_unref (mgr);
- g_object_unref (profile);
remove_account_from_gconf (account);
mc_account_delete (account);
g_object_unref (account);
diff --git a/tests/check-empathy-chatroom.c b/tests/check-empathy-chatroom.c
index 1e426b552..f68803122 100644
--- a/tests/check-empathy-chatroom.c
+++ b/tests/check-empathy-chatroom.c
@@ -5,18 +5,17 @@
#include <check.h>
#include "check-helpers.h"
#include "check-libempathy.h"
+#include "check-empathy-helpers.h"
#include <libempathy/empathy-chatroom.h>
static EmpathyChatroom *
create_chatroom (void)
{
- McProfile *profile;
McAccount *account;
EmpathyChatroom *chatroom;
- profile = mc_profile_lookup ("test");
- account = mc_account_create (profile);
+ account = create_test_account ();
chatroom = empathy_chatroom_new (account);
fail_if (chatroom == NULL);
@@ -24,7 +23,6 @@ create_chatroom (void)
* configuration */
/* FIXME: the account is not really removed */
mc_account_delete (account);
- g_object_unref (profile);
g_object_unref (account);
return chatroom;
diff --git a/tests/check-empathy-helpers.c b/tests/check-empathy-helpers.c
index 0f9678bbd..e67483d0d 100644
--- a/tests/check-empathy-helpers.c
+++ b/tests/check-empathy-helpers.c
@@ -63,6 +63,20 @@ copy_xml_file (const gchar *orig,
g_free (buffer);
}
+McAccount *
+create_test_account (void)
+{
+ McProfile *profile;
+ McAccount *account;
+
+ profile = mc_profile_lookup ("test");
+ account = mc_account_create (profile);
+
+ g_object_unref (profile);
+
+ return account;
+}
+
void
remove_account_from_gconf (McAccount *account)
{
diff --git a/tests/check-empathy-helpers.h b/tests/check-empathy-helpers.h
index 086d00196..2434af14b 100644
--- a/tests/check-empathy-helpers.h
+++ b/tests/check-empathy-helpers.h
@@ -26,5 +26,6 @@ gchar * get_xml_file (const gchar *filename);
gchar * get_user_xml_file (const gchar *filename);
void copy_xml_file (const gchar *orig, const gchar *dest);
void remove_account_from_gconf (McAccount *account);
+McAccount * create_test_account (void);
#endif /* #ifndef __CHECK_EMPATHY_HELPERS_H__ */