mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 10:46:06 -04:00
Simplify the way the HomeServer
object caches its internal attributes. (#8565)
Changes `@cache_in_self` to use underscore-prefixed attributes.
This commit is contained in:
parent
a090b86209
commit
ca60822b34
11 changed files with 40 additions and 36 deletions
|
@ -52,7 +52,7 @@ class AuthTestCase(unittest.TestCase):
|
|||
self.fail("some_user was not in %s" % macaroon.inspect())
|
||||
|
||||
def test_macaroon_caveats(self):
|
||||
self.hs.clock.now = 5000
|
||||
self.hs.get_clock().now = 5000
|
||||
|
||||
token = self.macaroon_generator.generate_access_token("a_user")
|
||||
macaroon = pymacaroons.Macaroon.deserialize(token)
|
||||
|
@ -78,7 +78,7 @@ class AuthTestCase(unittest.TestCase):
|
|||
|
||||
@defer.inlineCallbacks
|
||||
def test_short_term_login_token_gives_user_id(self):
|
||||
self.hs.clock.now = 1000
|
||||
self.hs.get_clock().now = 1000
|
||||
|
||||
token = self.macaroon_generator.generate_short_term_login_token("a_user", 5000)
|
||||
user_id = yield defer.ensureDeferred(
|
||||
|
@ -87,7 +87,7 @@ class AuthTestCase(unittest.TestCase):
|
|||
self.assertEqual("a_user", user_id)
|
||||
|
||||
# when we advance the clock, the token should be rejected
|
||||
self.hs.clock.now = 6000
|
||||
self.hs.get_clock().now = 6000
|
||||
with self.assertRaises(synapse.api.errors.AuthError):
|
||||
yield defer.ensureDeferred(
|
||||
self.auth_handler.validate_short_term_login_token_and_get_user_id(token)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue