Exemple #1
0
def test_parseLI_sys():
    alert = loginsightwebhookdemo.parseLI(json.loads(conftest.payloadLI_sys), {})
    assert alert['hookName'] == 'Log Insight'
    assert alert['color'] == 'red'
    assert alert['AlertName'] == 'Hello World'
    assert alert['info'] == 'hello world 1'
    # assert alert['Messages'] == '[{"text": "hello world 1","timestamp": 1451940578545,"fields": [{"name": "Field_1","content": "Content 1"}, { "name": "Field_2","content": "Content 2"}]'
    assert alert['url'] == ''
    assert alert['editurl'] == ''
    assert alert['HasMoreResults'] == False
    assert alert['NumHits'] == False
    assert alert['icon'] == 'http://blogs.vmware.com/management/files/2015/04/li-logo.png'
    assert alert['moreinfo'] == 'Hello World\n\nhello world 1'
Exemple #2
0
def test_parseLI_AQ():
    alert = loginsightwebhookdemo.parseLI(json.loads(conftest.payloadLI_AQ), {})
    assert alert['hookName'] == 'Log Insight'
    assert alert['color'] == 'red'
    assert alert['AlertName'] == 'Hello World'
    assert alert['info'] == 'This is an alert for all the Hello World messages'
    # assert alert['Messages'] == '[{"text": "hello world 1","timestamp": 1451940578545,"fields": [{"name": "Field_1","content": "Content 1"}, { "name": "Field_2","content": "Content 2"}]'
    assert alert['url'] == 'https://10.11.12.13/s/8pgzq6'
    assert alert['editurl'] == 'https://10.11.12.13/s/56monr'
    assert alert['HasMoreResults'] == 'True'
    assert alert['NumHits'] == '2'
    assert alert['icon'] == 'http://blogs.vmware.com/management/files/2015/04/li-logo.png'
    assert alert['moreinfo'] == 'Hello World\n\nThis is an alert for all the Hello World messages\n\n\
Exemple #3
0
def test_parseLI_sys():
    alert = loginsightwebhookdemo.parseLI(json.loads(conftest.payloadLI_sys),
                                          {})
    assert alert['hookName'] == 'Log Insight'
    assert alert['color'] == 'red'
    assert alert['AlertName'] == 'Hello World'
    assert alert['info'].startswith('hello world 1')
    # assert alert['Messages'] == '[{"text": "hello world 1","timestamp": 1451940578545,"fields": [{"name": "Field_1","content": "Content 1"}, { "name": "Field_2","content": "Content 2"}]'
    assert alert['url'] == ''
    assert alert['editurl'] == ''
    assert alert['HasMoreResults'] == False
    assert alert['NumHits'] == False
    assert alert[
        'icon'] == 'http://blogs.vmware.com/management/files/2015/04/li-logo.png'
    assert alert['moreinfo'].startswith('Alert Name')
Exemple #4
0
def test_parseLI_AQ():
    alert = loginsightwebhookdemo.parseLI(json.loads(conftest.payloadLI_AQ),
                                          {})
    assert alert['hookName'] == 'Log Insight'
    assert alert['color'] == 'red'
    assert alert['AlertName'] == 'Hello World'
    assert alert['info'] == 'This is an alert for all the Hello World messages'
    # assert alert['Messages'] == '[{"text": "hello world 1","timestamp": 1451940578545,"fields": [{"name": "Field_1","content": "Content 1"}, { "name": "Field_2","content": "Content 2"}]'
    assert alert['url'] == 'https://10.11.12.13/s/8pgzq6'
    assert alert['editurl'] == 'https://10.11.12.13/s/56monr'
    assert alert['HasMoreResults'] == 'True'
    assert alert['NumHits'] == '2'
    assert alert[
        'icon'] == 'http://blogs.vmware.com/management/files/2015/04/li-logo.png'
    assert alert['moreinfo'].startswith('Alert Name')
def test_parseLI_test():
    alert = loginsightwebhookdemo.parseLI(json.loads(conftest.payloadLI_test), {})
    assert alert['hookName'] == 'Log Insight'
    assert alert['color'] == 'red'
    assert alert['AlertName'] == 'Hello World'
    assert alert['info'] == 'hello world 1'
    assert alert['Messages'] == []
    '{"text": "hello world 1","timestamp": 1451940578545,"fields": [{"name": "Field_1","content": "Content 1"}, { "name": "Field_2","content": "Content 2"}]'
    assert alert['url'] == ''
    assert alert['editurl'] == ''
    'https://10.11.12.13/s/56monr'
    assert alert['HasMoreResults'] == 'False'
    assert alert['NumHits'] == '0'
    assert alert['icon'] == 'http://blogs.vmware.com/management/files/2015/04/li-logo.png'
    assert alert['moreinfo'].startswith('Hello from the webhook shim')
def test_parseLI_test():
    alert = loginsightwebhookdemo.parseLI(json.loads(conftest.payloadLI_test),
                                          {})
    assert alert['hookName'] == 'Log Insight'
    assert alert['color'] == 'red'
    assert alert['AlertName'] == 'Hello World'
    assert alert['info'] == 'hello world 1'
    assert alert['Messages'] == []
    '{"text": "hello world 1","timestamp": 1451940578545,"fields": [{"name": "Field_1","content": "Content 1"}, { "name": "Field_2","content": "Content 2"}]'
    assert alert['url'] == ''
    assert alert['editurl'] == ''
    'https://10.11.12.13/s/56monr'
    assert alert['HasMoreResults'] == 'False'
    assert alert['NumHits'] == '0'
    assert alert[
        'icon'] == 'http://blogs.vmware.com/management/files/2015/04/li-logo.png'
    assert alert['moreinfo'] == ("Hello from the webhook shim! This is a test webhook alert.\n\n") + \
        ("Alert Name: ") + alert['AlertName'] + \
        ("\nAlert Info: ") + alert['info']
Exemple #7
0
def test_parseLI_other():
    if loginsightwebhookdemo.parseLI('{}', None) is None:
        pass
Exemple #8
0
def test_parseLI_vrops():
    assert loginsightwebhookdemo.parseLI('{}', 'Hello world') == 'Hello world'
Exemple #9
0
def test_parseLI_other():
    if loginsightwebhookdemo.parseLI('{}', None) is None:
        pass
Exemple #10
0
def test_parseLI_vrops():
    assert loginsightwebhookdemo.parseLI('{}', 'Hello world') == 'Hello world'