diff --git a/tests/rest/test_presence.py b/tests/rest/test_presence.py
index 3a2e86e5c4..7c54e067c9 100644
--- a/tests/rest/test_presence.py
+++ b/tests/rest/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.
+
"""Tests REST events for /presence paths."""
from twisted.trial import unittest
@@ -17,7 +31,7 @@ logging.getLogger().addHandler(logging.NullHandler())
OFFLINE = PresenceState.OFFLINE
-BUSY = PresenceState.BUSY
+UNAVAILABLE = PresenceState.UNAVAILABLE
ONLINE = PresenceState.ONLINE
@@ -55,7 +69,7 @@ class PresenceStateTestCase(unittest.TestCase):
def test_get_my_status(self):
mocked_get = self.mock_handler.get_state
mocked_get.return_value = defer.succeed(
- {"state": 2, "status_msg": "Available"})
+ {"state": ONLINE, "status_msg": "Available"})
(code, response) = yield self.mock_server.trigger("GET",
"/presence/%s/status" % (myid), None)
@@ -73,12 +87,12 @@ class PresenceStateTestCase(unittest.TestCase):
(code, response) = yield self.mock_server.trigger("PUT",
"/presence/%s/status" % (myid),
- '{"state": 1, "status_msg": "Away"}')
+ '{"state": "unavailable", "status_msg": "Away"}')
self.assertEquals(200, code)
mocked_set.assert_called_with(target_user=self.u_apple,
auth_user=self.u_apple,
- state={"state": 1, "status_msg": "Away"})
+ state={"state": UNAVAILABLE, "status_msg": "Away"})
class PresenceListTestCase(unittest.TestCase):
@@ -220,7 +234,7 @@ class PresenceEventStreamTestCase(unittest.TestCase):
# I'll already get my own presence state change
self.assertEquals({"start": "0", "end": "1", "chunk": [
{"type": "m.presence",
- "content": {"user_id": "@apple:test", "state": 2}},
+ "content": {"user_id": "@apple:test", "state": ONLINE}},
]}, response)
self.mock_datastore.set_presence_state.return_value = defer.succeed(
@@ -237,5 +251,5 @@ class PresenceEventStreamTestCase(unittest.TestCase):
self.assertEquals(200, code)
self.assertEquals({"start": "1", "end": "2", "chunk": [
{"type": "m.presence",
- "content": {"user_id": "@banana:test", "state": 2}},
+ "content": {"user_id": "@banana:test", "state": ONLINE}},
]}, response)
|