#NEWLINE# @ authenticated_user_fixtures #NEWLINE# def test_authenticated_user_does_not_invalidate_session_if_not_authenticated( authn_policy , get_user ) : #NEWLINE# #INDENT# "\n    If authenticated_userid is None it shouldn't invalidate the session.\n\n    Even though the user with id None obviously won't exist in the db.\n\n    This also tests that it doesn't raise a redirect in this case.\n\n    " #NEWLINE# request = testing . DummyRequest ( ) #NEWLINE# request . current_route_url = ( lambda : '/' ) #NEWLINE# request . session . invalidate = mock . Mock ( ) #NEWLINE# authn_policy . authenticated_userid . return_value = None #NEWLINE# get_user . return_value = None #NEWLINE# accounts . authenticated_user ( request ) #NEWLINE# assert ( not request . session . invalidate . called )