summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/federation/test_federation.py15
-rw-r--r--tests/handlers/test_presence.py24
-rw-r--r--tests/handlers/test_presencelike.py12
-rw-r--r--tests/rest/test_presence.py12
4 files changed, 32 insertions, 31 deletions
diff --git a/tests/federation/test_federation.py b/tests/federation/test_federation.py
index 99b15b2268..f493ee253e 100644
--- a/tests/federation/test_federation.py
+++ b/tests/federation/test_federation.py
@@ -96,7 +96,7 @@ class FederationTestCase(unittest.TestCase):
 
         # Empty context initially
         (code, response) = yield self.mock_http_server.trigger("GET",
-                "/state/my-context/", None)
+                "/matrix/federation/v1/state/my-context/", None)
         self.assertEquals(200, code)
         self.assertFalse(response["pdus"])
 
@@ -121,7 +121,7 @@ class FederationTestCase(unittest.TestCase):
         )
 
         (code, response) = yield self.mock_http_server.trigger("GET",
-                "/state/my-context/", None)
+                "/matrix/federation/v1/state/my-context/", None)
         self.assertEquals(200, code)
         self.assertEquals(1, len(response["pdus"]))
 
@@ -132,7 +132,7 @@ class FederationTestCase(unittest.TestCase):
         )
 
         (code, response) = yield self.mock_http_server.trigger("GET",
-                "/pdu/red/abc123def456/", None)
+                "/matrix/federation/v1/pdu/red/abc123def456/", None)
         self.assertEquals(404, code)
 
         # Now insert such a PDU
@@ -151,7 +151,7 @@ class FederationTestCase(unittest.TestCase):
         )
 
         (code, response) = yield self.mock_http_server.trigger("GET",
-                "/pdu/red/abc123def456/", None)
+                "/matrix/federation/v1/pdu/red/abc123def456/", None)
         self.assertEquals(200, code)
         self.assertEquals(1, len(response["pdus"]))
         self.assertEquals("m.text", response["pdus"][0]["pdu_type"])
@@ -177,7 +177,7 @@ class FederationTestCase(unittest.TestCase):
 
         self.mock_http_client.put_json.assert_called_with(
                 "remote",
-                path="/send/1000000/",
+                path="/matrix/federation/v1/send/1000000/",
                 data={
                     "ts": 1000000,
                     "origin": "test",
@@ -212,7 +212,7 @@ class FederationTestCase(unittest.TestCase):
         # MockClock ensures we can guess these timestamps
         self.mock_http_client.put_json.assert_called_with(
                 "remote",
-                path="/send/1000000/",
+                path="/matrix/federation/v1/send/1000000/",
                 data={
                     "origin": "test",
                     "ts": 1000000,
@@ -234,7 +234,8 @@ class FederationTestCase(unittest.TestCase):
 
         self.federation.register_edu_handler("m.test", recv_observer)
 
-        yield self.mock_http_server.trigger("PUT", "/send/1001000/",
+        yield self.mock_http_server.trigger("PUT",
+                "/matrix/federation/v1/send/1001000/",
                 """{
                     "origin": "remote",
                     "ts": 1001000,
diff --git a/tests/handlers/test_presence.py b/tests/handlers/test_presence.py
index e7102e4ab0..2299a2a7ba 100644
--- a/tests/handlers/test_presence.py
+++ b/tests/handlers/test_presence.py
@@ -27,7 +27,7 @@ from synapse.handlers.presence import PresenceHandler, UserPresenceCache
 
 
 OFFLINE = PresenceState.OFFLINE
-BUSY = PresenceState.BUSY
+UNAVAILABLE = PresenceState.UNAVAILABLE
 ONLINE = PresenceState.ONLINE
 
 
@@ -149,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,
@@ -555,7 +555,7 @@ class PresencePushTestCase(unittest.TestCase):
                     content={
                         "push": [
                             {"user_id": "@apple:test",
-                            "state": 2},
+                            "state": "online"},
                         ],
                     }),
                 call(
@@ -564,7 +564,7 @@ class PresencePushTestCase(unittest.TestCase):
                     content={
                         "push": [
                             {"user_id": "@apple:test",
-                             "state": 2},
+                             "state": "online"},
                         ],
                     })
         ], any_order=True)
@@ -582,7 +582,7 @@ class PresencePushTestCase(unittest.TestCase):
                 "remote", "m.presence", {
                     "push": [
                         {"user_id": "@potato:remote",
-                         "state": 2},
+                         "state": "online"},
                     ],
                 }
         )
@@ -646,7 +646,7 @@ class PresencePushTestCase(unittest.TestCase):
                     content={
                         "push": [
                             {"user_id": "@apple:test",
-                            "state": 2},
+                            "state": "online"},
                         ],
                     }),
                 call(
@@ -655,7 +655,7 @@ class PresencePushTestCase(unittest.TestCase):
                     content={
                         "push": [
                             {"user_id": "@banana:test",
-                            "state": 0},
+                            "state": "offline"},
                         ],
                     }),
         ], any_order=True)
@@ -666,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,
@@ -680,7 +680,7 @@ class PresencePushTestCase(unittest.TestCase):
                     content={
                         "push": [
                             {"user_id": "@clementine:test",
-                            "state": 2},
+                            "state": "online"},
                         ],
                     }),
         )
@@ -882,7 +882,7 @@ class PresencePollingTestCase(unittest.TestCase):
                 content={
                     "push": [
                         {"user_id": "@banana:test",
-                         "state": 0,
+                         "state": "offline",
                          "status_msg": None},
                     ],
                 },
diff --git a/tests/handlers/test_presencelike.py b/tests/handlers/test_presencelike.py
index 12b7dca00d..224cf646f4 100644
--- a/tests/handlers/test_presencelike.py
+++ b/tests/handlers/test_presencelike.py
@@ -29,7 +29,7 @@ from synapse.handlers.profile import ProfileHandler
 
 
 OFFLINE = PresenceState.OFFLINE
-BUSY = PresenceState.BUSY
+UNAVAILABLE = PresenceState.UNAVAILABLE
 ONLINE = PresenceState.ONLINE
 
 
@@ -125,12 +125,12 @@ class PresenceProfilelikeDataTestCase(unittest.TestCase):
 
         yield self.handlers.presence_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",
                        "displayname": "Frank",
                        "avatar_url": "http://foo"})
 
@@ -220,7 +220,7 @@ class PresenceProfilelikeDataTestCase(unittest.TestCase):
                 content={
                     "push": [
                         {"user_id": "@apple:test",
-                         "state": 2,
+                         "state": "online",
                          "displayname": "Frank",
                          "avatar_url": "http://foo"},
                     ],
@@ -238,7 +238,7 @@ class PresenceProfilelikeDataTestCase(unittest.TestCase):
                 "remote", "m.presence", {
                     "push": [
                         {"user_id": "@potato:remote",
-                         "state": 2,
+                         "state": "online",
                          "displayname": "Frank",
                          "avatar_url": "http://foo"},
                     ],
diff --git a/tests/rest/test_presence.py b/tests/rest/test_presence.py
index 5b1e060c5f..7c54e067c9 100644
--- a/tests/rest/test_presence.py
+++ b/tests/rest/test_presence.py
@@ -31,7 +31,7 @@ logging.getLogger().addHandler(logging.NullHandler())
 
 
 OFFLINE = PresenceState.OFFLINE
-BUSY = PresenceState.BUSY
+UNAVAILABLE = PresenceState.UNAVAILABLE
 ONLINE = PresenceState.ONLINE
 
 
@@ -69,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)
@@ -87,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):
@@ -234,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(
@@ -251,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)