def test_should_refresh_if_supported_and_necessary(self): session = _Session( flask_session={'last_authenticated': time.time() - 11 }, # authenticated too far in the past session_refresh_interval_seconds=10) assert session.should_refresh()
def test_should_not_refresh_if_authenticated_within_refresh_interval(self): session = _Session( flask_session={'last_authenticated': time.time() + 5}, session_refresh_interval_seconds=10) assert not session.should_refresh()
def test_authenticated_session(self): session = _Session(flask_session={'last_authenticated': 1234}, session_refresh_interval_seconds=None) assert session.is_authenticated()
def test_should_not_refresh_if_not_supported(self): session = _Session(flask_session={}, session_refresh_interval_seconds=None) assert not session.should_refresh()
def test_unauthenticated_session(self): session = _Session(flask_session={}, session_refresh_interval_seconds=None) assert not session.is_authenticated()