mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-05 07:34:17 -04:00
Add create_requester
function
Wrap the `Requester` constructor with a function which provides sensible defaults, and use it throughout
This commit is contained in:
parent
33d7776473
commit
eb359eced4
11 changed files with 106 additions and 80 deletions
|
@ -14,17 +14,14 @@
|
|||
# limitations under the License.
|
||||
|
||||
"""Tests REST events for /profile paths."""
|
||||
from tests import unittest
|
||||
from mock import Mock
|
||||
from twisted.internet import defer
|
||||
|
||||
from mock import Mock
|
||||
|
||||
from ....utils import MockHttpResource, setup_test_homeserver
|
||||
|
||||
import synapse.types
|
||||
from synapse.api.errors import SynapseError, AuthError
|
||||
from synapse.types import Requester, UserID
|
||||
|
||||
from synapse.rest.client.v1 import profile
|
||||
from tests import unittest
|
||||
from ....utils import MockHttpResource, setup_test_homeserver
|
||||
|
||||
myid = "@1234ABCD:test"
|
||||
PATH_PREFIX = "/_matrix/client/api/v1"
|
||||
|
@ -52,7 +49,7 @@ class ProfileTestCase(unittest.TestCase):
|
|||
)
|
||||
|
||||
def _get_user_by_req(request=None, allow_guest=False):
|
||||
return Requester(UserID.from_string(myid), "", False)
|
||||
return synapse.types.create_requester(myid)
|
||||
|
||||
hs.get_v1auth().get_user_by_req = _get_user_by_req
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue