def test_signup_form(self):
        invalid_data_dicts = [
            # Non-alphanumeric username.
            {'data': {'username': 'foo@bar',
                      'email': 'foo@example.com',
                      'password': 'foo',
                      'password2': 'foo',
                      'tos': 'on'},
             'error': ('username', [_('Username must contain only letters, numbers, dots and underscores.')])},
            # Password is not the same
            {'data': {'username': 'katy-',
                      'email': 'katy@newexample.com',
                      'password1': 'foo',
                      'password2': 'foo2',
                      'tos': 'on'},
             'error': ('__all__', [_('The two password fields didn\'t match.')])},

            # Already taken username
            {'data': {'username': 'john',
                      'email': 'john@newexample.com',
                      'password1': 'foo',
                      'password2': 'foo',
                      'tos': 'on'},
             'error': ('username', [_('This username is already taken.')])},

            # Forbidden username
            {'data': {'username': 'SignUp',
                      'email': 'foo@example.com',
                      'password': 'foo',
                      'password2': 'foo2',
                      'tos': 'on'},
             'error': ('username', [_('This username is not allowed.')])},

            # Already taken email
            {'data': {'username': 'alice',
                      'email': 'john@example.com',
                      'password': 'foo',
                      'password2': 'foo',
                      'tos': 'on'},
             'error': ('email', [_('This email is already in use. Please supply a different email.')])},
        ]

        # Override locale settings since we are checking for existence of error
        # messaged written in english. Note: it should not be necessasy but
        # we have experienced such locale issues during tests on Travis builds.
        # See: https://github.com/bread-and-pepper/django-userena/issues/446
        with override('en'):
            for invalid_dict in invalid_data_dicts:
                form = forms.SignupForm(data=invalid_dict['data'])
                self.assertFalse(form.is_valid())
                self.assertEqual(form.errors[invalid_dict['error'][0]],
                                 invalid_dict['error'][1])

        # And finally, a valid form.
        form = forms.SignupForm(data={'username': 'foo.bla',
                                      'email': 'foo@example.com',
                                      'password1': 'foo',
                                      'password2': 'foo',
                                      'tos': 'on'})

        self.assertTrue(form.is_valid())
Build out system to the organization level.
dataset/ETHPy150Open bread-and-pepper/django-userena/userena/tests/tests_forms.py/SignupFormTests.test_signup_form--crossover with--dataset/ETHPy150Open openlearningtools/opencompetencies/users/tests.py/UserViewTests.build_to_organizations