Пример #1
0
def test_get_syslog_facility_case_insensitive(monkeypatch):
    """WALE_SYSLOG_FACILITY is case insensitive"""
    for low_name in ['local' + str(n) for n in range(8)] + ['user']:
        monkeypatch.setenv('WALE_SYSLOG_FACILITY', low_name)
        out, valid_facility = log_help.get_syslog_facility()
        assert valid_facility is True

        monkeypatch.setenv('WALE_SYSLOG_FACILITY', low_name.upper())
        out, valid_facility = log_help.get_syslog_facility()
        assert valid_facility is True
Пример #2
0
def test_get_syslog_facility_case_insensitive():
    """WALE_SYSLOG_FACILITY is case insensitive"""
    for low_name in ['local' + unicode(n) for n in xrange(8)] + ['user']:
        os.environ['WALE_SYSLOG_FACILITY'] = low_name
        out, valid_facility = log_help.get_syslog_facility()
        assert valid_facility is True

        os.environ['WALE_SYSLOG_FACILITY'] = low_name.upper()
        out, valid_facility = log_help.get_syslog_facility()
        assert valid_facility is True
Пример #3
0
def test_get_syslog_facility_case_insensitive():
    """WALE_SYSLOG_FACILITY is case insensitive"""
    for low_name in ['local' + unicode(n) for n in xrange(8)] + ['user']:
        os.environ['WALE_SYSLOG_FACILITY'] = low_name
        out, valid_facility = log_help.get_syslog_facility()
        assert valid_facility is True

        os.environ['WALE_SYSLOG_FACILITY'] = low_name.upper()
        out, valid_facility = log_help.get_syslog_facility()
        assert valid_facility is True
Пример #4
0
def test_get_syslog_facility_case_insensitive(monkeypatch):
    """WALE_SYSLOG_FACILITY is case insensitive"""
    for low_name in ['local' + str(n) for n in range(8)] + ['user']:
        monkeypatch.setenv('WALE_SYSLOG_FACILITY', low_name)
        out, valid_facility = log_help.get_syslog_facility()
        assert valid_facility is True

        monkeypatch.setenv('WALE_SYSLOG_FACILITY', low_name.upper())
        out, valid_facility = log_help.get_syslog_facility()
        assert valid_facility is True
Пример #5
0
def test_get_syslog_facility_notempty():
    """WALE_SYSLOG_FACILITY is set"""
    os.environ['WALE_SYSLOG_FACILITY'] = 'local0'
    out, valid_facility = log_help.get_syslog_facility()

    assert valid_facility is True
    assert out == handlers.SysLogHandler.LOG_LOCAL0

    os.environ['WALE_SYSLOG_FACILITY'] = 'user'
    out, valid_facility = log_help.get_syslog_facility()

    assert valid_facility is True
    assert out == handlers.SysLogHandler.LOG_USER
Пример #6
0
def test_get_syslog_facility_notempty():
    """WALE_SYSLOG_FACILITY is set"""
    os.environ['WALE_SYSLOG_FACILITY'] = 'local0'
    out, valid_facility = log_help.get_syslog_facility()

    assert valid_facility is True
    assert out == handlers.SysLogHandler.LOG_LOCAL0

    os.environ['WALE_SYSLOG_FACILITY'] = 'user'
    out, valid_facility = log_help.get_syslog_facility()

    assert valid_facility is True
    assert out == handlers.SysLogHandler.LOG_USER
Пример #7
0
def test_get_syslog_facility_notempty(monkeypatch):
    """WALE_SYSLOG_FACILITY is set"""
    monkeypatch.setenv('WALE_SYSLOG_FACILITY', 'local0')
    out, valid_facility = log_help.get_syslog_facility()

    assert valid_facility is True
    assert out == handlers.SysLogHandler.LOG_LOCAL0

    monkeypatch.setenv('WALE_SYSLOG_FACILITY', 'user')
    out, valid_facility = log_help.get_syslog_facility()

    assert valid_facility is True
    assert out == handlers.SysLogHandler.LOG_USER
Пример #8
0
def test_get_syslog_facility_notempty(monkeypatch):
    """WALE_SYSLOG_FACILITY is set"""
    monkeypatch.setenv('WALE_SYSLOG_FACILITY', 'local0')
    out, valid_facility = log_help.get_syslog_facility()

    assert valid_facility is True
    assert out == handlers.SysLogHandler.LOG_LOCAL0

    monkeypatch.setenv('WALE_SYSLOG_FACILITY', 'user')
    out, valid_facility = log_help.get_syslog_facility()

    assert valid_facility is True
    assert out == handlers.SysLogHandler.LOG_USER
Пример #9
0
def test_malformed_destinations():
    """WALE_SYSLOG_FACILITY contains bogus values"""
    os.environ['WALE_SYSLOG_FACILITY'] = 'wat'
    out, valid_facility = log_help.get_syslog_facility()
    assert not valid_facility
    assert out == handlers.SysLogHandler.LOG_USER

    os.environ['WALE_SYSLOG_FACILITY'] = 'local0,wat'
    out, valid_facility = log_help.get_syslog_facility()
    assert not valid_facility
    assert out == handlers.SysLogHandler.LOG_USER

    os.environ['WALE_SYSLOG_FACILITY'] = ','
    out, valid_facility = log_help.get_syslog_facility()
    assert not valid_facility
    assert out == handlers.SysLogHandler.LOG_USER
Пример #10
0
def test_get_syslog_facility_empty():
    """WALE_SYSLOG_FACILITY is not set"""
    os.environ.clear()
    out, valid_facility = log_help.get_syslog_facility()

    assert valid_facility is True
    assert out == handlers.SysLogHandler.LOG_USER
Пример #11
0
def test_malformed_destinations():
    """WALE_SYSLOG_FACILITY contains bogus values"""
    os.environ['WALE_SYSLOG_FACILITY'] = 'wat'
    out, valid_facility = log_help.get_syslog_facility()
    assert not valid_facility
    assert out == handlers.SysLogHandler.LOG_USER

    os.environ['WALE_SYSLOG_FACILITY'] = 'local0,wat'
    out, valid_facility = log_help.get_syslog_facility()
    assert not valid_facility
    assert out == handlers.SysLogHandler.LOG_USER

    os.environ['WALE_SYSLOG_FACILITY'] = ','
    out, valid_facility = log_help.get_syslog_facility()
    assert not valid_facility
    assert out == handlers.SysLogHandler.LOG_USER
Пример #12
0
def test_get_syslog_facility_empty():
    """WALE_SYSLOG_FACILITY is not set"""
    os.environ.clear()
    out, valid_facility = log_help.get_syslog_facility()

    assert valid_facility is True
    assert out == handlers.SysLogHandler.LOG_USER
Пример #13
0
def test_malformed_destinations(monkeypatch):
    """WALE_SYSLOG_FACILITY contains bogus values"""
    monkeypatch.setenv('WALE_SYSLOG_FACILITY', 'wat')
    out, valid_facility = log_help.get_syslog_facility()
    assert not valid_facility
    assert out == handlers.SysLogHandler.LOG_USER

    monkeypatch.setenv('WALE_SYSLOG_FACILITY', 'local0,wat')
    out, valid_facility = log_help.get_syslog_facility()
    assert not valid_facility
    assert out == handlers.SysLogHandler.LOG_USER

    monkeypatch.setenv('WALE_SYSLOG_FACILITY', ',')
    out, valid_facility = log_help.get_syslog_facility()
    assert not valid_facility
    assert out == handlers.SysLogHandler.LOG_USER
Пример #14
0
def test_malformed_destinations(monkeypatch):
    """WALE_SYSLOG_FACILITY contains bogus values"""
    monkeypatch.setenv('WALE_SYSLOG_FACILITY', 'wat')
    out, valid_facility = log_help.get_syslog_facility()
    assert not valid_facility
    assert out == handlers.SysLogHandler.LOG_USER

    monkeypatch.setenv('WALE_SYSLOG_FACILITY', 'local0,wat')
    out, valid_facility = log_help.get_syslog_facility()
    assert not valid_facility
    assert out == handlers.SysLogHandler.LOG_USER

    monkeypatch.setenv('WALE_SYSLOG_FACILITY', ',')
    out, valid_facility = log_help.get_syslog_facility()
    assert not valid_facility
    assert out == handlers.SysLogHandler.LOG_USER
Пример #15
0
def test_get_syslog_facility_empty(monkeypatch):
    """WALE_SYSLOG_FACILITY is not set"""
    assert os.getenv('WALE_SYSLOG_FACILITY') is None
    out, valid_facility = log_help.get_syslog_facility()
    assert valid_facility is True
    assert out == handlers.SysLogHandler.LOG_USER
Пример #16
0
def test_get_syslog_facility_empty(monkeypatch):
    """WALE_SYSLOG_FACILITY is not set"""
    assert os.getenv('WALE_SYSLOG_FACILITY') is None
    out, valid_facility = log_help.get_syslog_facility()
    assert valid_facility is True
    assert out == handlers.SysLogHandler.LOG_USER