Route the human-session tests through the real code path
This commit is contained in:
parent
9ce8da7573
commit
a59e668ca2
@ -82,23 +82,19 @@ class TestHumanSessions(Base):
|
|||||||
|
|
||||||
def test_view_session_cannot_be_minted_with_write_scope(self):
|
def test_view_session_cannot_be_minted_with_write_scope(self):
|
||||||
with self.assertRaises(errors.ScopeDenied):
|
with self.assertRaises(errors.ScopeDenied):
|
||||||
sessions.issue_view_session(
|
self.issue("bigpickle", scopes=["view:read", "view:write"])
|
||||||
self.store, "bigpickle", scopes=["view:read", "view:write"]
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_view_session_cannot_be_minted_with_agent_act_scope(self):
|
def test_view_session_cannot_be_minted_with_agent_act_scope(self):
|
||||||
with self.assertRaises(errors.ScopeDenied):
|
with self.assertRaises(errors.ScopeDenied):
|
||||||
sessions.issue_view_session(
|
self.issue("bigpickle", scopes=["agent:act"])
|
||||||
self.store, "bigpickle", scopes=["agent:act"]
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_long_session_grants_no_extra_capability(self):
|
def test_long_session_grants_no_extra_capability(self):
|
||||||
"""Expiry and authority are separate axes."""
|
"""Expiry and authority are separate axes."""
|
||||||
short = self.issue("bigpickle")
|
short = self.issue("bigpickle")
|
||||||
short_session = viewcodes.redeem_code(self.store, short["code"])
|
short_session = viewcodes.redeem_code(self.store, short["code"])
|
||||||
long_session = sessions.issue_view_session(
|
# 24 hours of access, redeemed the same way a 5-minute code would be.
|
||||||
self.store, "bigpickle", ttl=86400
|
long_issued = self.issue("bigpickle", code_ttl=300, view_ttl=86400)
|
||||||
)
|
long_session = viewcodes.redeem_code(self.store, long_issued["code"])
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
sorted(sessions.resolve(self.store, short_session["token"])["scopes"]),
|
sorted(sessions.resolve(self.store, short_session["token"])["scopes"]),
|
||||||
sorted(sessions.resolve(self.store, long_session["token"])["scopes"]),
|
sorted(sessions.resolve(self.store, long_session["token"])["scopes"]),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user