Drew Short
5 years ago
11 changed files with 373 additions and 150 deletions
-
7server/.gitignore
-
2server/Dockerfile
-
2server/Pipfile
-
4server/Pipfile.lock
-
5server/corvus/api/authentication_api.py
-
9server/corvus/api/model.py
-
140server/tests/api/test_authentication_api.py
-
19server/tests/api/test_health_api.py
-
31server/tests/api/test_user_api.py
-
6server/tests/conftest.py
-
38server/tests/service/test_authentication_service.py
@ -0,0 +1,7 @@ |
|||||
|
.idea/ |
||||
|
.mypy_cache |
||||
|
.pytest_cache |
||||
|
|
||||
|
.*_credentials |
||||
|
.coverage |
||||
|
*.iml |
@ -0,0 +1,19 @@ |
|||||
|
from datetime import datetime |
||||
|
|
||||
|
from flask.testing import FlaskClient |
||||
|
|
||||
|
from tests.conftest import AuthActions |
||||
|
|
||||
|
|
||||
|
def test_get_health_happy_path(auth: AuthActions, client: FlaskClient): |
||||
|
with auth: |
||||
|
auth_header = auth.get_authorization_header_token() |
||||
|
result = client.get( |
||||
|
'/health', |
||||
|
headers={ |
||||
|
auth_header[0]: auth_header[1] |
||||
|
}) |
||||
|
assert 200 == result.status_code |
||||
|
assert result.json is not None |
||||
|
assert result.json['message'] == 'Service is healthy' |
||||
|
assert result.json['success'] |
@ -0,0 +1,38 @@ |
|||||
|
import pytest |
||||
|
|
||||
|
from corvus import errors |
||||
|
from corvus.service import authentication_service |
||||
|
|
||||
|
|
||||
|
def test_validate_password_strength_good_password(): |
||||
|
proposed_good_password = 'AazZ1001' |
||||
|
assert proposed_good_password == authentication_service\ |
||||
|
.validate_password_strength(proposed_good_password) |
||||
|
|
||||
|
|
||||
|
def test_validate_password_strength_too_short(): |
||||
|
proposed_good_password = 'AazZ100' |
||||
|
with pytest.raises(errors.ValidationError) as error_info: |
||||
|
authentication_service.validate_password_strength( |
||||
|
proposed_good_password) |
||||
|
|
||||
|
|
||||
|
def test_validate_password_strength_missing_uppercase(): |
||||
|
proposed_good_password = 'aazz1001' |
||||
|
with pytest.raises(errors.ValidationError) as error_info: |
||||
|
authentication_service.validate_password_strength( |
||||
|
proposed_good_password) |
||||
|
|
||||
|
|
||||
|
def test_validate_password_strength_missing_lowercase(): |
||||
|
proposed_good_password = 'AAZZ1001' |
||||
|
with pytest.raises(errors.ValidationError) as error_info: |
||||
|
authentication_service.validate_password_strength( |
||||
|
proposed_good_password) |
||||
|
|
||||
|
|
||||
|
def test_validate_password_strength_missing_numbers(): |
||||
|
proposed_good_password = 'AAZZZZAA' |
||||
|
with pytest.raises(errors.ValidationError) as error_info: |
||||
|
authentication_service.validate_password_strength( |
||||
|
proposed_good_password) |
Write
Preview
Loading…
Cancel
Save
Reference in new issue