def test_sign_up_form_clear(): form = SignUpForm() form.cleaned_data = { 'password': '******', 'password2': 'password', 'phone': ''.join(i for i in FAKE.phone_number() if i.isdigit())[:10] } form.clean() form.save()
def test_sign_up_form_not_clear(): form = SignUpForm() form.errors['fake_error'] = 'fake' form.cleaned_data = { 'password': '******', 'password2': 'password', 'phone': ''.join(i for i in FAKE.phone_number() if i.isdigit())[:10] } form.clean() form.errors.pop('fake_error')
def test_sign_up_form_to_short_phone(): form = SignUpForm() form.cleaned_data = { 'password': '******', 'password2': 'password', 'phone': '2' } try: form.clean() except ValidationError: pass else: assert 2 == 1
def test_sign_up_form_wrong_phone(): form = SignUpForm() form.cleaned_data = { 'password': '******', 'password2': 'password', 'phone': FAKE.phone_number() } try: form.clean() except ValidationError: pass else: assert 2 == 1
def test_sign_up_form_wrong_password2(): form = SignUpForm() form.cleaned_data = { 'password': '******', 'password2': 'password2', 'phone': ''.join(i for i in FAKE.phone_number() if i.isdigit())[:10] } try: form.clean() except ValidationError: pass else: assert 2 == 1