def test_user_activation_form_empty_activation_key(user_data, user): from regme.forms import UserActivationForm form = UserActivationForm({ 'username': user.username, 'activation_key': '', }) assert not bool(form.is_valid()) assert form.user is None assert form.save() is None
def test_user_activation_form(user_data, user): from regme.forms import UserActivationForm form = UserActivationForm({ 'username': user.username, 'activation_key': user.activation_key, }) assert bool(form.is_valid()) user = form.save() assert user.is_active
def test_user_activation_form_unknown_username(user_data, user): from regme.forms import UserActivationForm form = UserActivationForm({ 'username': user.username + 'test', 'activation_key': user.activation_key, }) assert not bool(form.is_valid()) assert form.user is None assert form.save() is None
def test_user_activation_form_already_activated(user_data, active_user): user = active_user from regme.forms import UserActivationForm form = UserActivationForm({ 'username': user.username, 'activation_key': user.activation_key, }) assert not bool(form.is_valid()) assert form.user is None assert form.save() is None