How to use the impostor.forms.BigAuthenticationForm function in Impostor

To help you get started, we’ve selected a few Impostor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github samastur / Impostor / tests / test_impostor.py View on Github external
def test_form(self):
        """
        test custom login form

        :return:
        """
        initial = {'username': user_username, 'password': user_pass}
        form = BigAuthenticationForm(data=initial)
        assert form.is_valid()
        assert form.cleaned_data['username'] == user_username
        assert form.cleaned_data['password'] == user_pass

        # Longer than contrib.auth default of 30 chars
        new_uname = '{} as {}'.format(admin_username, user_username)
        initial = {'username': new_uname, 'password': admin_pass}
        form = BigAuthenticationForm(data=initial)
        assert form.is_valid()
        assert form.cleaned_data['username'] == new_uname
        assert form.cleaned_data['password'] == admin_pass

        del initial['password']
        form = BigAuthenticationForm(data=initial)
        assert not form.is_valid()
github samastur / Impostor / tests / test_impostor.py View on Github external
initial = {'username': user_username, 'password': user_pass}
        form = BigAuthenticationForm(data=initial)
        assert form.is_valid()
        assert form.cleaned_data['username'] == user_username
        assert form.cleaned_data['password'] == user_pass

        # Longer than contrib.auth default of 30 chars
        new_uname = '{} as {}'.format(admin_username, user_username)
        initial = {'username': new_uname, 'password': admin_pass}
        form = BigAuthenticationForm(data=initial)
        assert form.is_valid()
        assert form.cleaned_data['username'] == new_uname
        assert form.cleaned_data['password'] == admin_pass

        del initial['password']
        form = BigAuthenticationForm(data=initial)
        assert not form.is_valid()