You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
712 B
25 lines
712 B
from server.model import User
|
|
from server.service import role_service, validation_service
|
|
|
|
|
|
def test_successful_validation():
|
|
request_user = User()
|
|
request_user.role = role_service.Role.USER
|
|
|
|
user = User()
|
|
user.role = role_service.Role.USER
|
|
|
|
validation_result = validation_service.validate_model(request_user, user)
|
|
assert validation_result.success
|
|
|
|
|
|
def test_failed_validation():
|
|
request_user = User()
|
|
request_user.role = role_service.Role.ANONYMOUS
|
|
|
|
user = User()
|
|
user.role = role_service.Role.USER
|
|
|
|
validation_result = validation_service.validate_model(request_user, user)
|
|
assert validation_result.success is False
|
|
assert 'role' in validation_result.failed
|