Merge pull request #41 from mozilla/issues/18-2
Issue #18. Add support for passing labels to GitHub.
This commit is contained in:
Коммит
b7761a8be3
|
@ -38,11 +38,12 @@ def new_issue():
|
|||
"""
|
||||
|
||||
body = request.form.get('body')
|
||||
title = request.form.get('title')
|
||||
labels = request.form.get('labels')
|
||||
screenshot = request.form.get('screenshot')
|
||||
title = request.form.get('title')
|
||||
|
||||
if valid_issue_request(body, title):
|
||||
rv = create_issue(body, title)
|
||||
rv = create_issue(body, title, labels)
|
||||
if rv.status_code == 201:
|
||||
if has_valid_screenshot(screenshot):
|
||||
issue_number = rv.json().get('number')
|
||||
|
|
|
@ -34,10 +34,12 @@ s3 = boto3.client(
|
|||
)
|
||||
|
||||
|
||||
def create_issue(body, title):
|
||||
def create_issue(body, title, labels):
|
||||
"""Helper method to create a new issue on GitHub."""
|
||||
uri = 'https://api.github.com/repos/{0}/issues'.format(REPO)
|
||||
payload = {"body": body, "title": title}
|
||||
if labels and isinstance(labels, list):
|
||||
payload['labels'] = labels
|
||||
return requests.post(uri, data=json.dumps(payload), headers=HEADERS)
|
||||
|
||||
|
||||
|
|
|
@ -65,6 +65,10 @@ class TestEndpoints(unittest.TestCase):
|
|||
'/new', data=dict(title='hi', body='dude')
|
||||
)
|
||||
self.assertEqual(rv.status_code, 201)
|
||||
rv = self.app.post(
|
||||
'/new', data=dict(title='hi', body='dude', labels=['wow'])
|
||||
)
|
||||
self.assertEqual(rv.status_code, 201)
|
||||
|
||||
@responses.activate
|
||||
def test_create_issue_good_screenshot(self):
|
||||
|
|
Загрузка…
Ссылка в новой задаче