api_key is url parm for jira webhook

(imported from commit 24624a9fcd7e6fdc15d23c2874a04e1465c3f3cf)
This commit is contained in:
Steve Howell 2013-04-30 14:34:29 -04:00
parent 4491f7b1d8
commit fbad47ec28
3 changed files with 11 additions and 4 deletions

View File

@ -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'),
)

View File

@ -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",

View File

@ -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: