-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from fga-gpp-mds/devel
TS03-Validate
- Loading branch information
Showing
16 changed files
with
798 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
# CRM MESSAGES VALIDATION MESSAGES. | ||
CRM_SIZE = 'CRM must have 5 characters.' | ||
CRM_STATE_SIZE = 'CRM must have 2 characters.' | ||
CRM_FORMAT = 'CRM must contain /only numbers.' | ||
CRM_FORMAT = 'CRM must contain only numbers.' | ||
CRM_EXIST = 'CRM already exists' | ||
|
||
# UF FIELDS. | ||
|
@@ -51,19 +51,20 @@ | |
|
||
# NAME VALIDATION MESSAGES | ||
NAME_CHARACTERS = 'Name must not contain special characteres' | ||
NAME_FORMAT = 'Name must contain o nly letters' | ||
NAME_FORMAT = 'Name must contain only letters' | ||
NAME_SIZE = 'Name must be between 5 and 50 characteres' | ||
|
||
# EMAIL FIELDS | ||
EMAIL = "E-mail" | ||
EMAIL_FIELD_LENGTH = 50 | ||
EMAIL_MIN_LENGTH = 5 | ||
EMAIL_MIN_LENGTH = 6 | ||
EMAIL_MAX_LENGTH = 50 | ||
|
||
# EMAIL VALIDATION MESSAGES. | ||
EMAIL_FORMAT = "E-mail must be a valid e-mail. Example: [email protected]" | ||
EMAIL_SIZE = "E-mail must be between 5 and 50 characters" | ||
EMAIL_EXISTS = "Email already exists" | ||
EMAIL_EXISTS = "E-mail already exists" | ||
EMAIL_NONE = "Must have an E-mail" | ||
|
||
# EMAIL MESSAGES | ||
EMAIL_SUBJECT = 'Recuperação de sua senha' | ||
|
@@ -75,17 +76,19 @@ | |
# DATE_OF_BIRTH FIELDS. | ||
DATE_OF_BIRTH = "Date of birth" | ||
DATE_OF_BIRTH_MIN = 18 | ||
DATE_OF_BIRTH_MIN_PATIENT = 0 | ||
|
||
# DATE_OF_BIRTH VALIDATION MESSAGES. | ||
DATE_OF_BIRTH_FORMAT = "Date of birth must be in format: dd/mm/yyyy" | ||
DATE_OF_BIRTH_MIN_ERROR = "User must be 18 years" | ||
|
||
DATE_OF_BIRTH_MIN_PATIENT_ERROR = "User cannot be born in the future" | ||
# PHONE_NUMBER FIELDS. | ||
PHONE_NUMBER = "Phone number" | ||
PHONE_NUMBER_FIELD_LENGTH = 11 | ||
PHONE_NUMBER_FIELD_LENGTH_MAX = 11 | ||
PHONE_NUMBER_FIELD_LENGTH_MIN = 10 | ||
|
||
# PHONE_NUMBER VALIDATION MESSAGES. | ||
PHONE_NUMBER_SIZE = 'Phone number must contain a maximum of 11 characters' | ||
PHONE_NUMBER_SIZE = 'Phone number must be between 10 and 11 characters' | ||
PHONE_NUMBER_FORMAT = 'Phone number must contain only numbers' | ||
|
||
# SEX FIELDS. | ||
|
@@ -108,10 +111,8 @@ | |
# PASSWORD VALIDATION MESSAGES. | ||
PASSWORD_SIZE = 'Password must be between 6 and 12 characters.' | ||
PASSWORD_MATCH = 'Passwords do not match' | ||
|
||
# PASSWORD VALIDATION MESSAGES | ||
PASSWORD_SIZE = 'Password must be between 6 and 12 characteres.' | ||
PASSWORD_MATCH = 'Passwords do not match' | ||
PASSWORD_ERROR_ALNUM = 'Characteres must be alphanumeric' | ||
PASSWORD_FORMAT = 'Password must contain only alphanumeric characteres' | ||
|
||
# ID DOCUMENT FIELD. | ||
ID_DOCUMENT = 'Id Document' | ||
|
@@ -120,4 +121,5 @@ | |
ID_DOCUMENT_MAX_LENGTH = 32 | ||
|
||
# ID DOCUMENT FIELD VALIDATION MESSAGES. | ||
ID_DOCUMENT_SIZE = 'You id document must be between 10 and 32 characteres' | ||
ID_DOCUMENT_SIZE = 'Your id document must be between 10 and 32 characteres' | ||
ID_DOCUMENT_FORMAT = 'Id document must be only numbers' |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
medical_prescription/user/test/test_confirm_password_view.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from django.test import TestCase | ||
|
||
from user.models import User | ||
from django.test.client import RequestFactory, Client | ||
from user.views import ConfirmPasswordView | ||
|
||
|
||
class TestConfirmPasswordView(TestCase): | ||
|
||
def setUp(self): | ||
|
||
# Creating user in database. | ||
self.user = User() | ||
self.user.email = "[email protected]" | ||
self.user.password = "teste" | ||
self.user.save() | ||
|
||
self.factory = RequestFactory() | ||
self.my_view = ConfirmPasswordView() | ||
self.client = Client() | ||
|
||
# Testind method 'get'. | ||
def test_get(self): | ||
request = self.factory.get('user/reset_confirm/') | ||
response = self.my_view.get(request) | ||
|
||
self.assertEqual(response.status_code, 200) | ||
|
||
# Testing method 'post'. | ||
def test_post(self): | ||
response = self.client.post('/user/reset_confirm/', {'password_confirmation': 'teste', 'password': 'teste404'}) | ||
|
||
self.assertEqual(response.status_code, 404) | ||
|
||
# Testing method 'post'. | ||
def test_post_(self): | ||
response = self.client.post('/user/reset_confirm/', {'password_confirmation': 'teste', 'password': 'teste'}) | ||
|
||
self.assertEqual(response.status_code, 404) |
Oops, something went wrong.