From 54562de120a7de96a4d151a7870ec133c9c96fdd Mon Sep 17 00:00:00 2001 From: Daniel Greenfeld Date: Mon, 10 Aug 2015 17:15:31 -0700 Subject: [PATCH] Got Webhooks working with the API --- eventbrite/apiv3_url_mapping.json | 18 ++++++++++++++++++ tests/integration/test_client.py | 19 +++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/eventbrite/apiv3_url_mapping.json b/eventbrite/apiv3_url_mapping.json index bfd1af4..b59ddfa 100644 --- a/eventbrite/apiv3_url_mapping.json +++ b/eventbrite/apiv3_url_mapping.json @@ -377,5 +377,23 @@ "response_type": "single_response", "serializer": "MobileDevice", "url_regexp": "^devices/me/$" + }, + { + "data_type": "serialized", + "response_type": "single_response", + "serializer": "Webhook", + "url_regexp": "^webhooks/$" + }, + { + "data_type": "serialized", + "response_type": "single_response", + "serializer": "Webhook", + "url_regexp": "^webhooks/(?P\\d+)/$" + }, + { + "data_type": "serialized", + "response_type": "single_response", + "serializer": "Webhook", + "url_regexp": "^webhooks/(?P\\d+)/delete/$" } ] diff --git a/tests/integration/test_client.py b/tests/integration/test_client.py index 1db601a..70870ae 100644 --- a/tests/integration/test_client.py +++ b/tests/integration/test_client.py @@ -133,3 +133,22 @@ def test_get_event_expansions(self): evbobject = self.eventbrite.get_event( '11260994939', expand='ticket_classes') self.assertTrue('ticket_classes' in evbobject) + + +class TestCRUDWebhooks(unittest.TestCase): + + def setUp(self): + self.eventbrite = Eventbrite(OAUTH_TOKEN) + + @unittest.skipIf( + condition=skip_integration_tests, + reason='Needs an OAUTH_TOKEN') + def test_basic_webhook(self): + data = dict( + endpoint_url='http://example.com', + actions='', + event_id='15562735561' + ) + response = self.eventbrite.post_webhooks(**data) + self.assertTrue(response.ok) + self.assertEqual(response['event_id'], '15562735561')