<s> from django . core . urlresolvers import reverse <EOL> from django . test import TestCase <EOL> from django . contrib . auth . models import Group <EOL> from django . contrib . auth import get_user_model <EOL> User = get_user_model ( ) <EOL> class TestAccountViews ( TestCase ) : <EOL> def setUp ( self ) : <EOL> password = '<STR_LIT>' <EOL> self . user = User . objects . create_superuser ( email = '<STR_LIT>' , password = password , first_name = '<STR_LIT>' ) <EOL> self . user_john = User . objects . create_superuser ( email = '<STR_LIT>' , password = password , first_name = '<STR_LIT>' ) <EOL> self . client . login ( email = self . user . email , password = password ) <EOL> def test_accounts_user_change ( self ) : <EOL> g = Group . objects . get ( name = '<STR_LIT>' ) <EOL> view = reverse ( '<STR_LIT>' , args = ( self . user . pk , ) ) <EOL> get_response = self . client . get ( view ) <EOL> self . assertTrue ( get_response . status_code , <NUM_LIT:200> ) <EOL> post_response = self . client . post ( view , { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:email>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : g . pk <EOL> } ) <EOL> u = User . objects . get ( pk = self . user . pk ) <EOL> self . assertEqual ( u . first_name , '<STR_LIT>' ) <EOL> def test_accounts_user_change ( self ) : <EOL> self . assertEqual ( User . objects . all ( ) . count ( ) , <NUM_LIT:2> ) <EOL> view = reverse ( '<STR_LIT>' , args = ( self . user_john . pk , ) ) <EOL> post_response = self . client . post ( view ) <EOL> self . assertTrue ( post_response . status_code , <NUM_LIT> ) <EOL> self . assertEqual ( User . objects . all ( ) . count ( ) , <NUM_LIT:1> ) <EOL> def test_accounts_user_view ( self ) : <EOL> view = reverse ( '<STR_LIT>' , args = ( self . user_john . pk , ) ) <EOL> get_response = self . client . get ( view ) <EOL> self . assertTrue ( get_response . status_code , <NUM_LIT:200> ) <EOL> self . assertTrue ( '<STR_LIT>' in get_response . context ) <EOL> self . assertEqual ( len ( get_response . context [ '<STR_LIT>' ] . data ) , <NUM_LIT:0> ) </s>
