From fbad47ec28ff6e51434f8fb1428915d7985aeb46 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Tue, 30 Apr 2013 14:34:29 -0400 Subject: [PATCH] api_key is url parm for jira webhook (imported from commit 24624a9fcd7e6fdc15d23c2874a04e1465c3f3cf) --- humbug/urls.py | 2 +- zephyr/tests.py | 6 ++++-- zephyr/views.py | 7 ++++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/humbug/urls.py b/humbug/urls.py index c59129ddb9..80ce85f578 100644 --- a/humbug/urls.py +++ b/humbug/urls.py @@ -147,7 +147,7 @@ urlpatterns += patterns('zephyr.views', # These are integration-specific web hook callbacks url(r'^api/v1/external/github$', 'api_github_landing'), - url(r'^api/v1/external/jira/(\w+)/?$', 'api_jira_webhook'), + url(r'^api/v1/external/jira$', 'api_jira_webhook'), url(r'^api/v1/external/beanstalk$', 'api_beanstalk_webhook'), url(r'^api/v1/external/pivotal$', 'api_pivotal_webhook'), ) diff --git a/zephyr/tests.py b/zephyr/tests.py index b115b36cf2..88d0eb404f 100644 --- a/zephyr/tests.py +++ b/zephyr/tests.py @@ -2529,7 +2529,9 @@ class JiraHookTests(AuthedTestCase): def send_jira_message(self, action): email = "hamlet@humbughq.com" api_key = self.get_api_key(email) - return self.send_json_payload(email, "/api/v1/external/jira/%s/" % api_key, + url = "/api/v1/external/jira?api_key=%s" % api_key + return self.send_json_payload(email, + url, self.fixture_data('jira', action), stream_name="jira", content_type="application/json") @@ -2538,7 +2540,7 @@ class JiraHookTests(AuthedTestCase): email = "hamlet@humbughq.com" api_key = self.get_api_key(email) action = 'created' - url = "/api/v1/external/jira/%s/?stream=jira_custom" % api_key + url = "/api/v1/external/jira?api_key=%s&stream=jira_custom" % api_key msg = self.send_json_payload(email, url, self.fixture_data('jira', action), stream_name="jira_custom", diff --git a/zephyr/views.py b/zephyr/views.py index 67d60c5a22..b246b6345b 100644 --- a/zephyr/views.py +++ b/zephyr/views.py @@ -1509,7 +1509,12 @@ def elide_subject(subject): return subject @csrf_exempt -def api_jira_webhook(request, api_key): +def api_jira_webhook(request): + try: + api_key = request.GET['api_key'] + except (AttributeError, KeyError): + return json_error("Missing api_key parameter.") + payload = simplejson.loads(request.body) try: