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
716 B
25 lines
716 B
from atheneum.model import User
|
|
from atheneum.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
|