Ejemplo n.º 1
0
    def test_subscribe_to_newsleter(self):
        data = {
            'username': '******',
            'email': '*****@*****.**',
            'password1': '123123asd',
            'password2': '123123asd',
            'subscribe_newsletter': True,
        }

        form = UserCreationForm(data)
        assert form.is_valid() is True
        user = form.save()

        assert NewsletterSubscriber.objects.filter(user=user).exists()
Ejemplo n.º 2
0
    def test_subscribe_to_newsleter(self):
        data = {
            "username": "******",
            "email": "*****@*****.**",
            "password1": "123123asd",
            "password2": "123123asd",
            "subscribe_newsletter": True,
        }

        form = UserCreationForm(data)
        assert form.is_valid() is True
        user = form.save()

        assert NewsletterSubscriber.objects.filter(user=user).exists()
Ejemplo n.º 3
0
    def test_force_lower_for_username(self):
        passwd = 'verygoodpassword'
        data = {
            'username': '******',
            'email': '*****@*****.**',
            'password1': passwd,
            'password2': passwd,
        }

        form = UserCreationForm(data)
        assert form.is_valid() is True
        user = form.save()
        user.refresh_from_db()

        assert 'foo' == user.username
Ejemplo n.º 4
0
    def test_force_lower_for_username(self):
        passwd = "verygoodpassword"
        data = {
            "username": "******",
            "email": "*****@*****.**",
            "password1": passwd,
            "password2": passwd,
        }

        form = UserCreationForm(data)
        assert form.is_valid() is True
        user = form.save()
        user.refresh_from_db()

        assert "foo" == user.username
Ejemplo n.º 5
0
    def test_create_user(self):
        passwd = 'qweasdzxc'
        data = {
            'username': '******',
            'email': '*****@*****.**',
            'password1': passwd,
            'password2': passwd,
        }

        form = UserCreationForm(data)
        assert form.is_valid() is True
        user = form.save()

        assert data['username'] == user.username
        assert data['email'] == user.email
        assert user.check_password(passwd) is True
        assert not NewsletterSubscriber.objects.filter(user=user).exists()
Ejemplo n.º 6
0
    def test_create_user(self):
        passwd = "verygoodpassword"
        data = {
            "username": "******",
            "email": "*****@*****.**",
            "password1": passwd,
            "password2": passwd,
        }

        form = UserCreationForm(data)
        assert form.is_valid() is True
        user = form.save()

        assert data["username"] == user.username
        assert data["email"] == user.email
        assert user.check_password(passwd) is True
        assert not NewsletterSubscriber.objects.filter(user=user).exists()