diff src/test/test_plugin_misc_room_game.py @ 828:8f335c03eebb

plugins room_games, radiocol, libervia: small changes like refactorization to ease the maintenance
author souliane <souliane@mailoo.org>
date Fri, 17 Jan 2014 15:02:46 +0100
parents 1fe00f0c9a91
children 187d2443c82d
line wrap: on
line diff
--- a/src/test/test_plugin_misc_room_game.py	Thu Jan 16 11:44:14 2014 +0100
+++ b/src/test/test_plugin_misc_room_game.py	Fri Jan 17 15:02:46 2014 +0100
@@ -129,32 +129,32 @@
         self.init()
         self.initGame(0, 0)
         self.assertEqual(self.plugin.games[ROOM_JID_S]['players'], [])
-        self.plugin._updatePlayers(ROOM_JID_S, [], Const.PROFILE[0])
+        self.plugin._updatePlayers(ROOM_JID_S, [], True, Const.PROFILE[0])
         self.assertEqual(self.plugin.games[ROOM_JID_S]['players'], [])
-        self.plugin._updatePlayers(ROOM_JID_S, ["user1"], Const.PROFILE[0])
+        self.plugin._updatePlayers(ROOM_JID_S, ["user1"], True, Const.PROFILE[0])
         self.assertEqual(self.plugin.games[ROOM_JID_S]['players'], ["user1"])
-        self.plugin._updatePlayers(ROOM_JID_S, ["user2", "user3"], Const.PROFILE[0])
+        self.plugin._updatePlayers(ROOM_JID_S, ["user2", "user3"], True, Const.PROFILE[0])
         self.assertEqual(self.plugin.games[ROOM_JID_S]['players'], ["user1", "user2", "user3"])
-        self.plugin._updatePlayers(ROOM_JID_S, ["user2", "user3"], Const.PROFILE[0])  # should not be stored twice
+        self.plugin._updatePlayers(ROOM_JID_S, ["user2", "user3"], True, Const.PROFILE[0])  # should not be stored twice
         self.assertEqual(self.plugin.games[ROOM_JID_S]['players'], ["user1", "user2", "user3"])
 
-    def test_signalPlayers(self):
+    def test_synchronizeRoom(self):
         self.init()
         self.initGame(0, 0)
-        self.plugin._signalPlayers(ROOM_JID_S, [Const.MUC[0]], Const.PROFILE[0])
+        self.plugin._synchronizeRoom(ROOM_JID_S, [Const.MUC[0]], Const.PROFILE[0])
         self.assertEqual(self.host.getSentMessage(0, 0), self.expectedMessage(ROOM_JID_S, "groupchat", "players", []))
         self.plugin.games[ROOM_JID_S]['players'].append("test1")
-        self.plugin._signalPlayers(ROOM_JID_S, [Const.MUC[0]], Const.PROFILE[0])
+        self.plugin._synchronizeRoom(ROOM_JID_S, [Const.MUC[0]], Const.PROFILE[0])
         self.assertEqual(self.host.getSentMessage(1, 0), self.expectedMessage(ROOM_JID_S, "groupchat", "players", ["test1"]))
         self.plugin.games[ROOM_JID_S]['started'] = True
         self.plugin.games[ROOM_JID_S]['players'].append("test2")
-        self.plugin._signalPlayers(ROOM_JID_S, [Const.MUC[0]], Const.PROFILE[0])
+        self.plugin._synchronizeRoom(ROOM_JID_S, [Const.MUC[0]], Const.PROFILE[0])
         self.assertEqual(self.host.getSentMessage(2, 0), self.expectedMessage(ROOM_JID_S, "groupchat", "started", ["test1", "test2"]))
         self.plugin.games[ROOM_JID_S]['players'].append("test3")
         self.plugin.games[ROOM_JID_S]['players'].append("test4")
         user1 = JID(ROOM_JID_S + "/" + Const.JID[0].user)
         user2 = JID(ROOM_JID_S + "/" + Const.JID[1].user)
-        self.plugin._signalPlayers(ROOM_JID_S, [user1, user2], Const.PROFILE[0])
+        self.plugin._synchronizeRoom(ROOM_JID_S, [user1, user2], Const.PROFILE[0])
         self.assertEqualXML(self.host.getSentMessage(3, 0), self.expectedMessage(user1.full(), "normal", "started", ["test1", "test2", "test3", "test4"]))
         self.assertEqualXML(self.host.getSentMessage(4, 0), self.expectedMessage(user2.full(), "normal", "started", ["test1", "test2", "test3", "test4"]))