Skip to content
Snippets Groups Projects
Commit 70e265e6 authored by Daniel Wagner-Hall's avatar Daniel Wagner-Hall
Browse files

Re-add whitespace around caveat operators

parent 7f08ebb7
No related branches found
No related tags found
No related merge requests found
...@@ -278,12 +278,12 @@ class RegistrationHandler(BaseHandler): ...@@ -278,12 +278,12 @@ class RegistrationHandler(BaseHandler):
location = self.hs.config.server_name, location = self.hs.config.server_name,
identifier = "key", identifier = "key",
key = self.hs.config.macaroon_secret_key) key = self.hs.config.macaroon_secret_key)
macaroon.add_first_party_caveat("gen=1") macaroon.add_first_party_caveat("gen = 1")
macaroon.add_first_party_caveat("user_id=%s" % (user_id,)) macaroon.add_first_party_caveat("user_id = %s" % (user_id,))
macaroon.add_first_party_caveat("type=access") macaroon.add_first_party_caveat("type = access")
now = self.hs.get_clock().time_msec() now = self.hs.get_clock().time_msec()
expiry = now + (60 * 60 * 1000) expiry = now + (60 * 60 * 1000)
macaroon.add_first_party_caveat("time<%d" % (expiry,)) macaroon.add_first_party_caveat("time < %d" % (expiry,))
return macaroon.serialize() return macaroon.serialize()
......
...@@ -51,16 +51,16 @@ class RegisterTestCase(unittest.TestCase): ...@@ -51,16 +51,16 @@ class RegisterTestCase(unittest.TestCase):
macaroon = pymacaroons.Macaroon.deserialize(token) macaroon = pymacaroons.Macaroon.deserialize(token)
def verify_gen(caveat): def verify_gen(caveat):
return caveat == "gen=1" return caveat == "gen = 1"
def verify_user(caveat): def verify_user(caveat):
return caveat == "user_id=a_user" return caveat == "user_id = a_user"
def verify_type(caveat): def verify_type(caveat):
return caveat == "type=access" return caveat == "type = access"
def verify_expiry(caveat): def verify_expiry(caveat):
return caveat == "time<8600000" return caveat == "time < 8600000"
v = pymacaroons.Verifier() v = pymacaroons.Verifier()
v.satisfy_general(verify_gen) v.satisfy_general(verify_gen)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment