def test_trigger_creation_trigger_not_exists(self, mock_method):
     sensu_handler.ST2_API_BASE_URL = 'https://localhost/api/v1/'
     responses.add(
         responses.GET, 'https://localhost/api/v1/triggertypes/sensu.event_handler',
         json={}, status=404
     )
     sensu_handler._register_trigger_with_st2()
     self.assertTrue(mock_method.called)
 def test_trigger_creation_trigger_not_exists(self, mock_method):
     sensu_handler.ST2_API_BASE_URL = 'https://localhost/api/v1/'
     responses.add(
         responses.GET, 'https://localhost/api/v1/triggertypes/sensu.event_handler',
         json={}, status=404
     )
     sensu_handler._register_trigger_with_st2()
     self.assertTrue(mock_method.called)
 def test_get_trigger_type_trigger_exists(self, mock_method):
     sensu_handler.ST2_API_BASE_URL = 'https://localhost/api/v1/'
     responses.add(
         responses.GET, 'https://localhost/api/v1/triggertypes/sensu.event_handler',
         json={'type': 'sensu.event_handler'}, status=200
     )
     sensu_handler._register_trigger_with_st2()
     self.assertFalse(mock_method.called)
 def test_get_trigger_type_trigger_exists(self, mock_method):
     sensu_handler.ST2_API_BASE_URL = 'https://localhost/api/v1/'
     responses.add(
         responses.GET, 'https://localhost/api/v1/triggertypes/sensu.event_handler',
         json={'type': 'sensu.event_handler'}, status=200
     )
     sensu_handler._register_trigger_with_st2()
     self.assertFalse(mock_method.called)