コード例 #1
0
ファイル: test_user_forms.py プロジェクト: webmaven/comport
    def test_validate_user_already_registered(self, user):
        # Enters username that is already registered
        form = RegisterForm(username=user.username, email='*****@*****.**',
            password='******', confirm='example', invite_code="bad")

        assert form.validate() is False
        assert 'Username already registered' in form.username.errors
コード例 #2
0
ファイル: test_user_forms.py プロジェクト: webmaven/comport
    def test_validate_email_already_registered(self, user):
        # enters email that is already registered
        form = RegisterForm(username='******', email=user.email,
            password='******', confirm='example', invite_code="bad")

        assert form.validate() is False
        assert 'Email already registered' in form.email.errors
コード例 #3
0
    def test_validate_invite_code_used_already(self, user):
        department = Department.create(name="dept", short_name="DPD", load_defaults=False)
        Invite_Code.create(department_id=department.id, code="code1", used=True)

        form = RegisterForm(username='******', email='*****@*****.**', password='******', confirm='example', invite_code="code1")
        assert form.validate() is False
        assert 'Invite Code has already been used.' in form.invite_code.errors
コード例 #4
0
ファイル: test_user_forms.py プロジェクト: webmaven/comport
 def test_validate_success(self, db):
     department = Department.create(name="dept", load_defaults=False)
     Invite_Code.create(department_id=department.id, code="code")
     form = RegisterForm(username='******', email='*****@*****.**',
         password='******', confirm='example', invite_code="code")
     assert form.validate() is True
コード例 #5
0
ファイル: test_user_forms.py プロジェクト: webmaven/comport
 def test_validate_invite_code_valid(self, user):
     form = RegisterForm(username='******', email='*****@*****.**',
         password='******', confirm='example', invite_code="bad")
     assert form.validate() is False
     assert 'Invite Code not recognized.' in form.invite_code.errors
コード例 #6
0
 def test_validate_user_already_registered(self, user):
     # Enters username that is already registered
     form = RegisterForm(username=user.username, email='*****@*****.**', password='******', confirm='example', invite_code="bad")
     assert form.validate() is False
     assert 'Username already registered' in form.username.errors
コード例 #7
0
 def test_validate_success(self, db):
     department = Department.create(name="dept", short_name="DPD", load_defaults=False)
     Invite_Code.create(department_id=department.id, code="code")
     form = RegisterForm(username='******', email='*****@*****.**', password='******', confirm='example', invite_code="code")
     assert form.validate() is True
コード例 #8
0
 def test_validate_invite_code_valid(self, user):
     form = RegisterForm(username='******', email='*****@*****.**', password='******', confirm='example', invite_code="bad")
     assert form.validate() is False
     assert 'Invite Code not recognized.' in form.invite_code.errors
コード例 #9
0
 def test_validate_email_already_registered(self, user):
     # enters email that is already registered
     form = RegisterForm(username='******', email=user.email, password='******', confirm='example', invite_code="bad")
     assert form.validate() is False
     assert 'Email already registered' in form.email.errors