empathy r1554 - trunk/tests



Author: xclaesse
Date: Mon Oct 13 07:54:25 2008
New Revision: 1554
URL: http://svn.gnome.org/viewvc/empathy?rev=1554&view=rev

Log:
factor out create_test_account

Modified:
   trunk/tests/check-empathy-chatroom-manager.c
   trunk/tests/check-empathy-chatroom.c
   trunk/tests/check-empathy-helpers.c
   trunk/tests/check-empathy-helpers.h

Modified: trunk/tests/check-empathy-chatroom-manager.c
==============================================================================
--- trunk/tests/check-empathy-chatroom-manager.c	(original)
+++ trunk/tests/check-empathy-chatroom-manager.c	Mon Oct 13 07:54:25 2008
@@ -20,11 +20,9 @@
   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 @@
 
   g_free (file);
   g_object_unref (mgr);
-  g_object_unref (profile);
   remove_account_from_gconf (account);
   mc_account_delete (account);
   g_object_unref (account);

Modified: trunk/tests/check-empathy-chatroom.c
==============================================================================
--- trunk/tests/check-empathy-chatroom.c	(original)
+++ trunk/tests/check-empathy-chatroom.c	Mon Oct 13 07:54:25 2008
@@ -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 @@
    * configuration */
   /* FIXME: the account is not really removed */
   mc_account_delete (account);
-  g_object_unref (profile);
   g_object_unref (account);
 
   return chatroom;

Modified: trunk/tests/check-empathy-helpers.c
==============================================================================
--- trunk/tests/check-empathy-helpers.c	(original)
+++ trunk/tests/check-empathy-helpers.c	Mon Oct 13 07:54:25 2008
@@ -63,6 +63,20 @@
   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)
 {

Modified: trunk/tests/check-empathy-helpers.h
==============================================================================
--- trunk/tests/check-empathy-helpers.h	(original)
+++ trunk/tests/check-empathy-helpers.h	Mon Oct 13 07:54:25 2008
@@ -26,5 +26,6 @@
 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__ */



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