diff --git a/tests/api/test_auth.py b/tests/api/test_auth.py
index 2e2d0c428a..c96273480d 100644
--- a/tests/api/test_auth.py
+++ b/tests/api/test_auth.py
@@ -146,17 +146,17 @@ class AuthTestCase(unittest.TestCase):
return_value={"name": "@baldrick:matrix.org"}
)
- user = "@baldrick:matrix.org"
+ user_id = "@baldrick:matrix.org"
macaroon = pymacaroons.Macaroon(
location=self.hs.config.server_name,
identifier="key",
key=self.hs.config.macaroon_secret_key)
macaroon.add_first_party_caveat("gen = 1")
macaroon.add_first_party_caveat("type = access")
- macaroon.add_first_party_caveat("user_id = %s" % (user,))
+ macaroon.add_first_party_caveat("user_id = %s" % (user_id,))
user_info = yield self.auth._get_user_from_macaroon(macaroon.serialize())
- user_id = user_info["user_id"]
- self.assertEqual(UserID.from_string(user), user_id)
+ user = user_info["user"]
+ self.assertEqual(UserID.from_string(user_id), user)
@defer.inlineCallbacks
def test_get_user_from_macaroon_user_db_mismatch(self):
diff --git a/tests/rest/client/v1/test_presence.py b/tests/rest/client/v1/test_presence.py
index d8d1416f59..2ee3da0b34 100644
--- a/tests/rest/client/v1/test_presence.py
+++ b/tests/rest/client/v1/test_presence.py
@@ -72,7 +72,7 @@ class PresenceStateTestCase(unittest.TestCase):
def _get_user_by_access_token(token=None):
return {
- "user_id": UserID.from_string(myid),
+ "user": UserID.from_string(myid),
"token_id": 1,
}
@@ -159,7 +159,7 @@ class PresenceListTestCase(unittest.TestCase):
def _get_user_by_access_token(token=None):
return {
- "user_id": UserID.from_string(myid),
+ "user": UserID.from_string(myid),
"token_id": 1,
}
diff --git a/tests/rest/client/v1/test_rooms.py b/tests/rest/client/v1/test_rooms.py
index be1d52f720..9fb2bfb315 100644
--- a/tests/rest/client/v1/test_rooms.py
+++ b/tests/rest/client/v1/test_rooms.py
@@ -56,7 +56,7 @@ class RoomPermissionsTestCase(RestTestCase):
def _get_user_by_access_token(token=None):
return {
- "user_id": UserID.from_string(self.auth_user_id),
+ "user": UserID.from_string(self.auth_user_id),
"token_id": 1,
}
hs.get_v1auth()._get_user_by_access_token = _get_user_by_access_token
@@ -441,7 +441,7 @@ class RoomsMemberListTestCase(RestTestCase):
def _get_user_by_access_token(token=None):
return {
- "user_id": UserID.from_string(self.auth_user_id),
+ "user": UserID.from_string(self.auth_user_id),
"token_id": 1,
}
hs.get_v1auth()._get_user_by_access_token = _get_user_by_access_token
@@ -519,7 +519,7 @@ class RoomsCreateTestCase(RestTestCase):
def _get_user_by_access_token(token=None):
return {
- "user_id": UserID.from_string(self.auth_user_id),
+ "user": UserID.from_string(self.auth_user_id),
"token_id": 1,
}
hs.get_v1auth()._get_user_by_access_token = _get_user_by_access_token
@@ -610,7 +610,7 @@ class RoomTopicTestCase(RestTestCase):
def _get_user_by_access_token(token=None):
return {
- "user_id": UserID.from_string(self.auth_user_id),
+ "user": UserID.from_string(self.auth_user_id),
"token_id": 1,
}
@@ -715,7 +715,7 @@ class RoomMemberStateTestCase(RestTestCase):
def _get_user_by_access_token(token=None):
return {
- "user_id": UserID.from_string(self.auth_user_id),
+ "user": UserID.from_string(self.auth_user_id),
"token_id": 1,
}
hs.get_v1auth()._get_user_by_access_token = _get_user_by_access_token
@@ -840,7 +840,7 @@ class RoomMessagesTestCase(RestTestCase):
def _get_user_by_access_token(token=None):
return {
- "user_id": UserID.from_string(self.auth_user_id),
+ "user": UserID.from_string(self.auth_user_id),
"token_id": 1,
}
hs.get_v1auth()._get_user_by_access_token = _get_user_by_access_token
@@ -935,7 +935,7 @@ class RoomInitialSyncTestCase(RestTestCase):
def _get_user_by_access_token(token=None):
return {
- "user_id": UserID.from_string(self.auth_user_id),
+ "user": UserID.from_string(self.auth_user_id),
"token_id": 1,
}
hs.get_v1auth()._get_user_by_access_token = _get_user_by_access_token
diff --git a/tests/rest/client/v1/test_typing.py b/tests/rest/client/v1/test_typing.py
index da6fc975f7..6395ce79db 100644
--- a/tests/rest/client/v1/test_typing.py
+++ b/tests/rest/client/v1/test_typing.py
@@ -63,7 +63,7 @@ class RoomTypingTestCase(RestTestCase):
def _get_user_by_access_token(token=None):
return {
- "user_id": UserID.from_string(self.auth_user_id),
+ "user": UserID.from_string(self.auth_user_id),
"token_id": 1,
}
diff --git a/tests/rest/client/v2_alpha/__init__.py b/tests/rest/client/v2_alpha/__init__.py
index 7d0f77a3ee..f45570a1c0 100644
--- a/tests/rest/client/v2_alpha/__init__.py
+++ b/tests/rest/client/v2_alpha/__init__.py
@@ -45,7 +45,7 @@ class V2AlphaRestTestCase(unittest.TestCase):
def _get_user_by_access_token(token=None):
return {
- "user_id": UserID.from_string(self.USER_ID),
+ "user": UserID.from_string(self.USER_ID),
"token_id": 1,
}
hs.get_auth()._get_user_by_access_token = _get_user_by_access_token
|