def test_invalid_inputs(self): with self.assertRaises(exceptions.InvalidOptions): self.actor = alerts.Create( 'Create an AlertSpec', { 'array': 'unittestarray', 'condition': '<', 'description': 'test alert', 'duration': 500, 'file': '/test', 'threshold': '500', 'variable': 'tx', 'name': 'newunitarray', 'vote_type': 'foobar-bad-value' })
def integration_02b_create_second_alert(self): actor = alerts.Create( 'Create alert: %s' % self.test_alert_name, {'array': self.template_array, 'strict_array': False, 'condition': '>', 'description': 'Second alert, same name', 'duration': 180, 'vote_tag': 'test', 'vote_type': 'grow', 'file': 'interface/if_octets-eth0', 'name': self.test_alert_name, 'threshold': '300000000', 'variable': 'rx' }) ret = yield actor.execute() self.assertEquals(ret, None)
def setUp(self, *args, **kwargs): super(TestCreateActor, self).setUp() base.TOKEN = 'unittest' # Create the actor self.actor = alerts.Create( 'Create an AlertSpec', { 'array': 'unittestarray', 'condition': '<', 'description': 'test alert', 'duration': 500, 'escalation_name': 'critical', 'file': '/test', 'threshold': '500', 'variable': 'tx', 'name': 'newunitarray' }) # Patch the actor so that we use the client mock self.client_mock = mock.MagicMock() self.actor._client = self.client_mock