<s> from django . core . urlresolvers import reverse <EOL> from django . test import TestCase <EOL> from userena . tests . profiles . models import Profile <EOL> class PrivacyTests ( TestCase ) : <EOL> """<STR_LIT>""" <EOL> fixtures = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> reg_user = { '<STR_LIT:username>' : '<STR_LIT>' , <EOL> '<STR_LIT:password>' : '<STR_LIT>' } <EOL> super_user = { '<STR_LIT:username>' : '<STR_LIT>' , <EOL> '<STR_LIT:password>' : '<STR_LIT>' } <EOL> detail_profile_url = reverse ( '<STR_LIT>' , <EOL> kwargs = { '<STR_LIT:username>' : '<STR_LIT>' } ) <EOL> edit_profile_url = reverse ( '<STR_LIT>' , <EOL> kwargs = { '<STR_LIT:username>' : '<STR_LIT>' } ) <EOL> def _test_status_codes ( self , url , users_status ) : <EOL> """<STR_LIT>""" <EOL> for user , status in users_status : <EOL> if user : <EOL> self . client . login ( ** user ) <EOL> response = self . client . get ( url , follow = True ) <EOL> self . assertEqual ( response . status_code , status ) <EOL> def test_detail_open_profile_view ( self ) : <EOL> """<STR_LIT>""" <EOL> profile = Profile . objects . get ( pk = <NUM_LIT:1> ) <EOL> profile . privacy = '<STR_LIT>' <EOL> profile . save ( ) <EOL> users_status = ( <EOL> ( None , <NUM_LIT:200> ) , <EOL> ( self . reg_user , <NUM_LIT:200> ) , <EOL> ( self . super_user , <NUM_LIT:200> ) <EOL> ) <EOL> self . _test_status_codes ( self . detail_profile_url , users_status ) <EOL> def test_detail_registered_profile_view ( self ) : <EOL> """<STR_LIT>""" <EOL> profile = Profile . objects . get ( pk = <NUM_LIT:1> ) <EOL> profile . privacy = '<STR_LIT>' <EOL> profile . save ( ) <EOL> users_status = ( <EOL> ( None , <NUM_LIT> ) , <EOL> ( self . reg_user , <NUM_LIT:200> ) , <EOL> ( self . super_user , <NUM_LIT:200> ) <EOL> ) <EOL> self . _test_status_codes ( self . detail_profile_url , users_status ) <EOL> def test_detail_closed_profile_view ( self ) : <EOL> """<STR_LIT>""" <EOL> profile = Profile . objects . get ( pk = <NUM_LIT:1> ) <EOL> profile . privacy = '<STR_LIT>' <EOL> profile . save ( ) <EOL> users_status = ( <EOL> ( None , <NUM_LIT> ) , <EOL> ( self . reg_user , <NUM_LIT> ) , <EOL> ( self . super_user , <NUM_LIT:200> ) <EOL> ) <EOL> self . _test_status_codes ( self . detail_profile_url , users_status ) <EOL> def test_edit_profile_view ( self ) : <EOL> """<STR_LIT>""" <EOL> profile = Profile . objects . get ( pk = <NUM_LIT:1> ) <EOL> users_status = ( <EOL> ( None , <NUM_LIT> ) , <EOL> ( self . reg_user , <NUM_LIT> ) , <EOL> ( self . super_user , <NUM_LIT:200> ) <EOL> ) <EOL> self . _test_status_codes ( self . edit_profile_url , users_status ) </s>
