def test_generate_validation_message_args(): """Test for static method to generate a ValidationMessage Test for a SimpleMessage message with some arg defaults """ message = { 'message': 'message', 'error': True, 'kind': 'SimpleMessage' } kwargs = { 'name': 'namename', 'source': 'testing', 'message': 'not this', 'error': False, 'documents': [] } expected = { 'message': 'message', 'error': True, 'kind': 'ValidationMessage', 'level': 'Error', 'source': 'testing', 'name': 'namename', 'documents': [], 'diagnostic': None } generated = ConfigdocsHelper._generate_validation_message(message, **kwargs) assert generated == expected
def test_generate_validation_message_args_full(): """Test for static method to generate a ValidationMessage Test for something that is already a validation message. """ message = { 'message': 'message', 'error': False, 'kind': 'ValidationMessage', 'level': 'Warning', 'source': 'testing', 'name': 'namename', 'documents': [] } kwargs = { 'message': 'not this', 'error': True } expected = { 'message': 'message', 'error': False, 'kind': 'ValidationMessage', 'level': 'Warning', 'source': 'testing', 'name': 'namename', 'documents': [], 'diagnostic': None } generated = ConfigdocsHelper._generate_validation_message(message, **kwargs) assert generated == expected
def test_generate_validation_message(): """Test for static method to generate a ValidationMessage Test for a basic message without a kind set. """ message = { 'message': 'message', 'error': False } expected = { 'message': 'message', 'error': False, 'kind': 'ValidationMessage', 'level': 'Info', 'documents': [], 'diagnostic': None, 'name': None, 'source': None } generated = ConfigdocsHelper._generate_validation_message(message) assert generated == expected