Skip to content

Commit

Permalink
Increase coverage of alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
y0urself committed May 20, 2021
1 parent 96c7c01 commit 28db732
Showing 1 changed file with 152 additions and 0 deletions.
152 changes: 152 additions & 0 deletions tests/protocols/gmpv208/entities/alerts/test_create_alert.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,94 @@ def test_invalid_method_for_secinfo(self):
method=AlertMethod.HTTP_GET,
)

with self.assertRaises(InvalidArgument):
self.gmp.create_alert(
name='foo',
condition=AlertCondition.ALWAYS,
event=AlertEvent.UPDATED_SECINFO_ARRIVED,
method=AlertMethod.ALEMBA_VFIRE,
)

with self.assertRaises(InvalidArgument):
self.gmp.create_alert(
name='foo',
condition=AlertCondition.ALWAYS,
event=AlertEvent.UPDATED_SECINFO_ARRIVED,
method=AlertMethod.SOURCEFIRE_CONNECTOR,
)

with self.assertRaises(InvalidArgument):
self.gmp.create_alert(
name='foo',
condition=AlertCondition.ALWAYS,
event=AlertEvent.UPDATED_SECINFO_ARRIVED,
method=AlertMethod.START_TASK,
)

with self.assertRaises(InvalidArgument):
self.gmp.create_alert(
name='foo',
condition=AlertCondition.ALWAYS,
event=AlertEvent.UPDATED_SECINFO_ARRIVED,
method=AlertMethod.TIPPINGPOINT_SMS,
)

with self.assertRaises(InvalidArgument):
self.gmp.create_alert(
name='foo',
condition=AlertCondition.ALWAYS,
event=AlertEvent.UPDATED_SECINFO_ARRIVED,
method=AlertMethod.VERINICE_CONNECTOR,
)

with self.assertRaises(InvalidArgument):
self.gmp.create_alert(
name='foo',
condition=AlertCondition.ALWAYS,
event=AlertEvent.NEW_SECINFO_ARRIVED,
method=AlertMethod.HTTP_GET,
)

with self.assertRaises(InvalidArgument):
self.gmp.create_alert(
name='foo',
condition=AlertCondition.ALWAYS,
event=AlertEvent.NEW_SECINFO_ARRIVED,
method=AlertMethod.ALEMBA_VFIRE,
)

with self.assertRaises(InvalidArgument):
self.gmp.create_alert(
name='foo',
condition=AlertCondition.ALWAYS,
event=AlertEvent.NEW_SECINFO_ARRIVED,
method=AlertMethod.SOURCEFIRE_CONNECTOR,
)

with self.assertRaises(InvalidArgument):
self.gmp.create_alert(
name='foo',
condition=AlertCondition.ALWAYS,
event=AlertEvent.NEW_SECINFO_ARRIVED,
method=AlertMethod.START_TASK,
)

with self.assertRaises(InvalidArgument):
self.gmp.create_alert(
name='foo',
condition=AlertCondition.ALWAYS,
event=AlertEvent.NEW_SECINFO_ARRIVED,
method=AlertMethod.TIPPINGPOINT_SMS,
)

with self.assertRaises(InvalidArgument):
self.gmp.create_alert(
name='foo',
condition=AlertCondition.ALWAYS,
event=AlertEvent.NEW_SECINFO_ARRIVED,
method=AlertMethod.VERINICE_CONNECTOR,
)

def test_missing_method_for_ticket_received(self):
with self.assertRaises(RequiredArgument):
self.gmp.create_alert(
Expand Down Expand Up @@ -144,6 +232,70 @@ def test_invalid_method_for_ticket_received(self):
method=AlertMethod.HTTP_GET,
)

with self.assertRaises(InvalidArgument):
self.gmp.create_alert(
name='foo',
condition=AlertCondition.ALWAYS,
event=AlertEvent.TICKET_RECEIVED,
method=AlertMethod.SCP,
)

with self.assertRaises(InvalidArgument):
self.gmp.create_alert(
name='foo',
condition=AlertCondition.ALWAYS,
event=AlertEvent.TICKET_RECEIVED,
method=AlertMethod.SEND,
)

with self.assertRaises(InvalidArgument):
self.gmp.create_alert(
name='foo',
condition=AlertCondition.ALWAYS,
event=AlertEvent.TICKET_RECEIVED,
method=AlertMethod.SMB,
)

with self.assertRaises(InvalidArgument):
self.gmp.create_alert(
name='foo',
condition=AlertCondition.ALWAYS,
event=AlertEvent.TICKET_RECEIVED,
method=AlertMethod.SNMP,
)

with self.assertRaises(InvalidArgument):
self.gmp.create_alert(
name='foo',
condition=AlertCondition.ALWAYS,
event=AlertEvent.TICKET_RECEIVED,
method=AlertMethod.ALEMBA_VFIRE,
)

with self.assertRaises(InvalidArgument):
self.gmp.create_alert(
name='foo',
condition=AlertCondition.ALWAYS,
event=AlertEvent.TICKET_RECEIVED,
method=AlertMethod.VERINICE_CONNECTOR,
)

with self.assertRaises(InvalidArgument):
self.gmp.create_alert(
name='foo',
condition=AlertCondition.ALWAYS,
event=AlertEvent.TICKET_RECEIVED,
method=AlertMethod.TIPPINGPOINT_SMS,
)

with self.assertRaises(InvalidArgument):
self.gmp.create_alert(
name='foo',
condition=AlertCondition.ALWAYS,
event=AlertEvent.TICKET_RECEIVED,
method=AlertMethod.SOURCEFIRE_CONNECTOR,
)

def test_invalid_condition_for_task_run_status_changed(self):
with self.assertRaises(InvalidArgument):
self.gmp.create_alert(
Expand Down

0 comments on commit 28db732

Please sign in to comment.