Exemple #1
0
 def test_error_messages_of_password_more_than_255(self):
     # case:
     self.contact_data.update({
         'password': get_password_data().get('invalid_more_than_255'),
         'password_check': get_password_data().get('invalid_more_than_255')
     })
     response = Client().post(reverse('signup'), data=self.contact_data)
     self.assertEqual(response.status_code, 200, msg="We don't stay on page to see the error messages.")
     self.assertFormError(response, 'form', 'password', 'Ensure this value has at most 255 characters (it has 300).')
Exemple #2
0
    def test_error_messages_of_password_without_digit(self):

        # case:
        self.contact_data.update({
            'password': get_password_data().get('invalid_without_digit'),
            'password_check': get_password_data().get('invalid_without_digit')
        })
        response = Client().post(reverse('signup'), data=self.contact_data)
        self.assertEqual(response.status_code, 200, msg="We don't stay on page to see the error messages.")
        self.assertFormError(response, 'form', 'password', 'Password must have at least one digit')
Exemple #3
0
    def test_error_messages_of_password_without_upper(self):
        """
            Tests if the validator fires the right error messages on all cases.
        """

        # case:
        self.contact_data.update({
            'password': get_password_data().get('invalid_without_upper'),
            'password_check': get_password_data().get('invalid_without_upper')
        })
        response = Client().post(reverse('signup'), data=self.contact_data)
        self.assertEqual(response.status_code, 200, msg="We don't stay on page to see the error messages.")
        self.assertFormError(response, 'form', 'password', 'Password must have at least one Uppercase letter')
Exemple #4
0
 def setUp(self):
     self.contact_data = get_contact_data()
     self.password_data = get_password_data()
Exemple #5
0
import os
import random

from celery import states
from django.contrib.auth.hashers import make_password
from django_celery_results.models import TaskResult
from model_bakery import seq
from model_bakery.recipe import Recipe, foreign_key, related
from structure.models import Organization, PublishRequest, GroupInvitationRequest
from structure.models import MrMapUser, MrMapGroup
from structure.settings import SUPERUSER_GROUP_NAME, PUBLIC_GROUP_NAME
from tests.test_data import get_password_data

salt = str(os.urandom(25).hex())
PASSWORD = get_password_data().get('valid')
EMAIL = "*****@*****.**"

god_user = Recipe(
    MrMapUser,
    username="******",
    email="*****@*****.**",
    salt=salt,
    password=make_password("354Dez25!"),
    is_active=True,
)

superadmin_orga = Recipe(Organization,
                         organization_name=seq("SuperOrganization"),
                         is_auto_generated=False)

superadmin_group = Recipe(MrMapGroup,