예제 #1
0
def test_is_valid_system_flag_sanity():
    validator = IncidentFieldValidator('temp_file', check_git=False)
    validator.current_incident_field = {
        'system': False,
        'content': True,
    }

    assert validator.is_valid_system_flag()
    assert validator.is_valid()

    validator.current_incident_field = {
        'content': True,
    }
    assert validator.is_valid_system_flag()
    assert validator.is_valid()
예제 #2
0
def test_is_valid_content_flag_invalid_values():
    validator = IncidentFieldValidator('temp_file', check_git=False)
    validator.current_incident_field = {
        'content': False
    }

    assert not validator.is_valid_content_flag()
    assert not validator.is_valid()

    validator.current_incident_field = {
        'something': True
    }

    assert not validator.is_valid_content_flag()
    assert not validator.is_valid()
예제 #3
0
def test_is_valid_name_bad_name():
    validator = IncidentFieldValidator('temp_file', check_git=False)
    validator.current_incident_field = {
        'cliName': 'sanity name',
        'name': 'Incident',
        'content': True,
    }

    assert not validator.is_valid_name()
    assert not validator.is_valid()

    validator.current_incident_field = {
        'cliName': 'sanity name',
        'name': 'case',
        'content': True,
    }
    assert not validator.is_valid_name()
    assert not validator.is_valid()

    validator.current_incident_field = {
        'cliName': 'sanity name',
        'name': 'Playbook',
        'content': True,
    }
    assert not validator.is_valid_name()
    assert not validator.is_valid()

    validator.current_incident_field = {
        'cliName': 'sanity name',
        'name': 'Alerting feature',
        'content': True,
    }
    assert not validator.is_valid_name()
    assert not validator.is_valid()

    validator.current_incident_field = {
        'cliName': 'sanity name',
        'name': 'INciDeNts',
        'content': True,
    }
    assert not validator.is_valid_name()
    assert not validator.is_valid()
예제 #4
0
def test_is_valid_name_sanity():
    validator = IncidentFieldValidator('temp_file', check_git=False)
    validator.current_incident_field = {
        'cliName': 'sanity name',
        'name': 'sanity name',
        'id': 'incident',
        'content': True,
    }

    assert validator.is_valid_name()
    assert validator.is_valid()