<s> from social . tests . models import User <EOL> from social . tests . actions . actions import BaseActionTest <EOL> class LoginActionTest ( BaseActionTest ) : <EOL> def test_login ( self ) : <EOL> self . do_login ( ) <EOL> def test_login_with_partial_pipeline ( self ) : <EOL> self . do_login_with_partial_pipeline ( ) <EOL> def test_fields_stored_in_session ( self ) : <EOL> self . strategy . set_settings ( { <EOL> '<STR_LIT>' : [ '<STR_LIT:foo>' , '<STR_LIT:bar>' ] <EOL> } ) <EOL> self . strategy . set_request_data ( { '<STR_LIT:foo>' : '<STR_LIT:1>' , '<STR_LIT:bar>' : '<STR_LIT:2>' } , self . backend ) <EOL> self . do_login ( ) <EOL> self . assertEqual ( self . strategy . session_get ( '<STR_LIT:foo>' ) , '<STR_LIT:1>' ) <EOL> self . assertEqual ( self . strategy . session_get ( '<STR_LIT:bar>' ) , '<STR_LIT:2>' ) <EOL> def test_redirect_value ( self ) : <EOL> self . strategy . set_request_data ( { '<STR_LIT>' : '<STR_LIT>' } , self . backend ) <EOL> redirect = self . do_login ( after_complete_checks = False ) <EOL> self . assertEqual ( redirect . url , '<STR_LIT>' ) <EOL> def test_login_with_invalid_partial_pipeline ( self ) : <EOL> def before_complete ( ) : <EOL> partial = self . strategy . session_get ( '<STR_LIT>' ) <EOL> partial [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> self . strategy . session_set ( '<STR_LIT>' , partial ) <EOL> self . do_login_with_partial_pipeline ( before_complete ) <EOL> def test_new_user ( self ) : <EOL> self . strategy . set_settings ( { <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } ) <EOL> redirect = self . do_login ( after_complete_checks = False ) <EOL> self . assertEqual ( redirect . url , '<STR_LIT>' ) <EOL> def test_inactive_user ( self ) : <EOL> self . strategy . set_settings ( { <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } ) <EOL> User . set_active ( False ) <EOL> redirect = self . do_login ( after_complete_checks = False ) <EOL> self . assertEqual ( redirect . url , '<STR_LIT>' ) <EOL> def test_invalid_user ( self ) : <EOL> self . strategy . set_settings ( { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ) <EOL> } ) <EOL> redirect = self . do_login ( after_complete_checks = False ) <EOL> self . assertEqual ( redirect . url , '<STR_LIT>' ) </s>
