summary refs log tree commit diff
path: root/tests/handlers/test_presence.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/handlers/test_presence.py')
-rw-r--r--tests/handlers/test_presence.py38
1 files changed, 26 insertions, 12 deletions
diff --git a/tests/handlers/test_presence.py b/tests/handlers/test_presence.py
index e814357520..2299a2a7ba 100644
--- a/tests/handlers/test_presence.py
+++ b/tests/handlers/test_presence.py
@@ -1,4 +1,18 @@
 # -*- coding: utf-8 -*-
+# Copyright 2014 matrix.org
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 
 from twisted.trial import unittest
 from twisted.internet import defer
@@ -13,7 +27,7 @@ from synapse.handlers.presence import PresenceHandler, UserPresenceCache
 
 
 OFFLINE = PresenceState.OFFLINE
-BUSY = PresenceState.BUSY
+UNAVAILABLE = PresenceState.UNAVAILABLE
 ONLINE = PresenceState.ONLINE
 
 
@@ -135,12 +149,12 @@ class PresenceStateTestCase(unittest.TestCase):
 
         yield self.handler.set_state(
                 target_user=self.u_apple, auth_user=self.u_apple,
-                state={"state": BUSY, "status_msg": "Away"})
+                state={"state": UNAVAILABLE, "status_msg": "Away"})
 
         mocked_set.assert_called_with("apple",
-                {"state": 1, "status_msg": "Away"})
+                {"state": UNAVAILABLE, "status_msg": "Away"})
         self.mock_start.assert_called_with(self.u_apple,
-                state={"state": 1, "status_msg": "Away"})
+                state={"state": UNAVAILABLE, "status_msg": "Away"})
 
         yield self.handler.set_state(
                 target_user=self.u_apple, auth_user=self.u_apple,
@@ -541,7 +555,7 @@ class PresencePushTestCase(unittest.TestCase):
                     content={
                         "push": [
                             {"user_id": "@apple:test",
-                            "state": 2},
+                            "state": "online"},
                         ],
                     }),
                 call(
@@ -550,7 +564,7 @@ class PresencePushTestCase(unittest.TestCase):
                     content={
                         "push": [
                             {"user_id": "@apple:test",
-                             "state": 2},
+                             "state": "online"},
                         ],
                     })
         ], any_order=True)
@@ -568,7 +582,7 @@ class PresencePushTestCase(unittest.TestCase):
                 "remote", "m.presence", {
                     "push": [
                         {"user_id": "@potato:remote",
-                         "state": 2},
+                         "state": "online"},
                     ],
                 }
         )
@@ -632,7 +646,7 @@ class PresencePushTestCase(unittest.TestCase):
                     content={
                         "push": [
                             {"user_id": "@apple:test",
-                            "state": 2},
+                            "state": "online"},
                         ],
                     }),
                 call(
@@ -641,7 +655,7 @@ class PresencePushTestCase(unittest.TestCase):
                     content={
                         "push": [
                             {"user_id": "@banana:test",
-                            "state": 0},
+                            "state": "offline"},
                         ],
                     }),
         ], any_order=True)
@@ -652,7 +666,7 @@ class PresencePushTestCase(unittest.TestCase):
 
         self.handler._user_cachemap[self.u_clementine] = UserPresenceCache()
         self.handler._user_cachemap[self.u_clementine].update(
-                {"state": PresenceState.ONLINE}, self.u_clementine)
+                {"state": ONLINE}, self.u_clementine)
         self.room_members.append(self.u_potato)
 
         yield self.distributor.fire("user_joined_room", self.u_clementine,
@@ -666,7 +680,7 @@ class PresencePushTestCase(unittest.TestCase):
                     content={
                         "push": [
                             {"user_id": "@clementine:test",
-                            "state": 2},
+                            "state": "online"},
                         ],
                     }),
         )
@@ -868,7 +882,7 @@ class PresencePollingTestCase(unittest.TestCase):
                 content={
                     "push": [
                         {"user_id": "@banana:test",
-                         "state": 0,
+                         "state": "offline",
                          "status_msg": None},
                     ],
                 },