7df8ed4a60
Change SecScanAPI to use a uri creation func instead of test context Pass config provider through validator context Remove app config dependency for validators
20 lines
689 B
Python
20 lines
689 B
Python
import pytest
|
|
|
|
from util.config.validator import ValidatorContext
|
|
from util.config.validators import ConfigValidationException
|
|
from util.config.validators.validate_signer import SignerValidator
|
|
|
|
from test.fixtures import *
|
|
|
|
@pytest.mark.parametrize('unvalidated_config,expected', [
|
|
({}, None),
|
|
({'SIGNING_ENGINE': 'foobar'}, ConfigValidationException),
|
|
({'SIGNING_ENGINE': 'gpg2'}, Exception),
|
|
])
|
|
def test_validate_signer(unvalidated_config, expected, app):
|
|
validator = SignerValidator()
|
|
if expected is not None:
|
|
with pytest.raises(expected):
|
|
validator.validate(ValidatorContext(unvalidated_config))
|
|
else:
|
|
validator.validate(ValidatorContext(unvalidated_config))
|