async def test_method_registry_view(): registry = dispatcher.MethodRegistry() validator = validators.BaseValidator() validator_args = {'arg': 'value'} class MethodView(ViewMixin): @validator.validate(**validator_args) def method1(self): pass @validator.validate(**validator_args) async def method2(self, param1): assert param1 == 'param1' registry.view(MethodView, prefix='view') assert registry['view.method1'].validator == validator assert registry['view.method1'].validator_args == validator_args assert registry['view.method2'].validator == validator assert registry['view.method2'].validator_args == validator_args
def test_validation_exclude_error(dyn_method, exclude, params): validator = validators.BaseValidator() with pytest.raises(validators.ValidationError): validator.validate_method(dyn_method, params, exclude=exclude)
def test_validation_exclude_success(dyn_method, exclude, params): validator = validators.BaseValidator() validator.validate_method(dyn_method, params, exclude=exclude)
def test_validation_success(dyn_method, params): validator = validators.BaseValidator() validator.validate_method(dyn_method, params)