<s> from django . test import TestCase <EOL> from corehq . apps . users . models import WebUser <EOL> from corehq . apps . domain . models import Domain <EOL> from corehq . apps . hqwebapp . forms import EmailAuthenticationForm <EOL> class PasswordLockoutTest ( TestCase ) : <EOL> def setUp ( self ) : <EOL> self . domain = Domain . get_or_create_with_name ( '<STR_LIT>' , is_active = True ) <EOL> self . username = '<STR_LIT>' <EOL> self . password = '<STR_LIT>' <EOL> self . user = WebUser . create ( self . domain . name , self . username , self . password ) <EOL> def tearDown ( self ) : <EOL> self . user . delete ( ) <EOL> self . domain . delete ( ) <EOL> def test_login_lockout ( self ) : <EOL> form = EmailAuthenticationForm ( data = { '<STR_LIT:username>' : self . username , '<STR_LIT:password>' : self . password } ) <EOL> self . assertEqual ( form . is_valid ( ) , True ) <EOL> for i in range ( <NUM_LIT:5> ) : <EOL> form2 = EmailAuthenticationForm ( data = { '<STR_LIT:username>' : self . username , '<STR_LIT:password>' : '<STR_LIT>' } ) <EOL> form2 . is_valid ( ) <EOL> form3 = EmailAuthenticationForm ( data = { '<STR_LIT:username>' : self . username , '<STR_LIT:password>' : self . password } ) <EOL> self . assertEqual ( form3 . is_valid ( ) , False ) </s>
