def test_parse_vROps60_test():
    alert = loginsightwebhookdemo.parsevROps(json.loads(conftest.payloadvROps60), {})
    assert alert['hookName'] == 'vRealize Operations Manager'
    assert alert['color'] == 'green'
    assert alert['AlertName'] == '<None>'
    assert alert['info'] == 'sample-info'
    assert alert['criticality'] == 'ALERT_CRITICALITY_LEVEL_WARNING'
    assert alert['status'] == 'INACTIVE'
    assert alert['type'] == 'ALERT_TYPE_APPLICATION_PROBLEM'
    assert alert['subType'] == 'ALERT_SUBTYPE_AVAILABILITY_PROBLEM'
    assert alert['Risk'] == '<None>'
    assert alert['Efficiency'] == '<None>'
    assert alert['Health'] == '<None>'
    assert alert['resourceName'] == 'sample-object-name'
    assert alert['adapterKind'] == 'sample-adapter-type'
    assert alert['icon'] == 'http://blogs.vmware.com/management/files/2016/09/vrops-256.png'
    assert alert['moreinfo'].startswith('Hello from the webhook shim')
Example #2
0
def test_parse_vROps60_test():
    alert = loginsightwebhookdemo.parsevROps(
        json.loads(conftest.payloadvROps60), {})
    assert alert['hookName'] == 'vRealize Operations Manager'
    assert alert['color'] == 'green'
    assert alert['AlertName'] == '<None>'
    assert alert['info'] == 'sample-info'
    assert alert['criticality'] == 'ALERT_CRITICALITY_LEVEL_WARNING'
    assert alert['status'] == 'INACTIVE'
    assert alert['type'] == 'ALERT_TYPE_APPLICATION_PROBLEM'
    assert alert['subType'] == 'ALERT_SUBTYPE_AVAILABILITY_PROBLEM'
    assert alert['Risk'] == '<None>'
    assert alert['Efficiency'] == '<None>'
    assert alert['Health'] == '<None>'
    assert alert['resourceName'] == 'sample-object-name'
    assert alert['adapterKind'] == 'sample-adapter-type'
    assert alert[
        'icon'] == 'http://blogs.vmware.com/management/files/2016/09/vrops-256.png'
    assert alert['moreinfo'].startswith('Hello from the webhook shim')
Example #3
0
def test_parsevROps62_test():
    alert = loginsightwebhookdemo.parsevROps(json.loads(conftest.payloadvROps62), {})
    assert alert['hookName'] == 'vRealize Operations Manager'
    assert alert['color'] == 'yellow'
    assert alert['AlertName'] == 'Invalid IP Address for connected Leaf Switch'
    assert alert['info'] == 'sample-info'
    assert alert['criticality'] == 'ALERT_CRITICALITY_LEVEL_WARNING'
    assert alert['status'] == 'ACTIVE'
    assert alert['type'] == 'ALERT_TYPE_APPLICATION_PROBLEM'
    assert alert['subType'] == 'ALERT_SUBTYPE_AVAILABILITY_PROBLEM'
    assert alert['Risk'] == 4.0
    assert alert['Efficiency'] == 1.0
    assert alert['Health'] == 1.0
    assert alert['resourceName'] == 'sample-object-name'
    assert alert['adapterKind'] == 'sample-adapter-type'
    assert alert['icon'] == 'http://blogs.vmware.com/management/files/2016/09/vrops-256.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']
Example #4
0
def test_parsevROps62_test():
    alert = loginsightwebhookdemo.parsevROps(
        json.loads(conftest.payloadvROps62), {})
    assert alert['hookName'] == 'vRealize Operations Manager'
    assert alert['color'] == 'yellow'
    assert alert['AlertName'] == 'Invalid IP Address for connected Leaf Switch'
    assert alert['info'] == 'sample-info'
    assert alert['criticality'] == 'ALERT_CRITICALITY_LEVEL_WARNING'
    assert alert['status'] == 'ACTIVE'
    assert alert['type'] == 'ALERT_TYPE_APPLICATION_PROBLEM'
    assert alert['subType'] == 'ALERT_SUBTYPE_AVAILABILITY_PROBLEM'
    assert alert['Risk'] == 4.0
    assert alert['Efficiency'] == 1.0
    assert alert['Health'] == 1.0
    assert alert['resourceName'] == 'sample-object-name'
    assert alert['adapterKind'] == 'sample-adapter-type'
    assert alert[
        'icon'] == 'http://blogs.vmware.com/management/files/2016/09/vrops-256.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']
Example #5
0
def test_parsevROps_LI():
    alert = loginsightwebhookdemo.parsevROps(
        json.loads(conftest.payloadLI_sys), {})
    assert alert == {}
Example #6
0
def test_parsevROps_LI():
    alert = loginsightwebhookdemo.parsevROps(json.loads(conftest.payloadLI_sys), {})
    assert alert == {}