<s> from __future__ import unicode_literals <EOL> from django . contrib . auth . models import User <EOL> from django . test import TestCase <EOL> from rest_framework . test import APIClient <EOL> class DropdownWithAuthTests ( TestCase ) : <EOL> """<STR_LIT>""" <EOL> urls = '<STR_LIT>' <EOL> def setUp ( self ) : <EOL> self . client = APIClient ( enforce_csrf_checks = True ) <EOL> self . username = '<STR_LIT>' <EOL> self . email = '<STR_LIT>' <EOL> self . password = '<STR_LIT:password>' <EOL> self . user = User . objects . create_user ( self . username , self . email , self . password ) <EOL> def tearDown ( self ) : <EOL> self . client . logout ( ) <EOL> def test_name_shown_when_logged_in ( self ) : <EOL> self . client . login ( username = self . username , password = self . password ) <EOL> response = self . client . get ( '<STR_LIT:/>' ) <EOL> self . assertContains ( response , '<STR_LIT>' ) <EOL> def test_logout_shown_when_logged_in ( self ) : <EOL> self . client . login ( username = self . username , password = self . password ) <EOL> response = self . client . get ( '<STR_LIT:/>' ) <EOL> self . assertContains ( response , '<STR_LIT>' ) <EOL> def test_login_shown_when_logged_out ( self ) : <EOL> response = self . client . get ( '<STR_LIT:/>' ) <EOL> self . assertContains ( response , '<STR_LIT>' ) <EOL> class NoDropdownWithoutAuthTests ( TestCase ) : <EOL> """<STR_LIT>""" <EOL> urls = '<STR_LIT>' <EOL> def setUp ( self ) : <EOL> self . client = APIClient ( enforce_csrf_checks = True ) <EOL> self . username = '<STR_LIT>' <EOL> self . email = '<STR_LIT>' <EOL> self . password = '<STR_LIT:password>' <EOL> self . user = User . objects . create_user ( self . username , self . email , self . password ) <EOL> def tearDown ( self ) : <EOL> self . client . logout ( ) <EOL> def test_name_shown_when_logged_in ( self ) : <EOL> self . client . login ( username = self . username , password = self . password ) <EOL> response = self . client . get ( '<STR_LIT:/>' ) <EOL> self . assertContains ( response , '<STR_LIT>' ) <EOL> def test_dropdown_not_shown_when_logged_in ( self ) : <EOL> self . client . login ( username = self . username , password = self . password ) <EOL> response = self . client . get ( '<STR_LIT:/>' ) <EOL> self . assertNotContains ( response , '<STR_LIT>' ) <EOL> def test_dropdown_not_shown_when_logged_out ( self ) : <EOL> response = self . client . get ( '<STR_LIT:/>' ) <EOL> self . assertNotContains ( response , '<STR_LIT>' ) </s>
