Skip to content
This repository has been archived by the owner on Mar 14, 2023. It is now read-only.

Modifying and testing add_labels #112

Merged
merged 2 commits into from
Mar 19, 2018
Merged

Conversation

davidalber
Copy link
Collaborator

This PR does two things:

  • Removes the try-except logic from add_labels. I'm doing this because the add labels request returns 200 on success. Thus, we don't need the "look for 201 status code logic" here.
  • Adds tests for add_labels.

I also verified the modified function manually.

>>> from newpr import add_labels
>>> add_labels(['a', 'b'], 'davidalber', 'highfive-test-repo', 2, 'davidalber', OAUTH_TOKEN)

>>> add_labels(['a', 'b'], 'davidalber', 'highfive-test-repo', 2, 'davidalber', FAKE_OAUTH_TOKEN)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "newpr.py", line 143, in add_labels
    api_req("POST", issue_labels_url % (owner, repo, issue), labels, user, token)
  File "newpr.py", line 86, in api_req
    f = urllib2.urlopen(req)
  File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ur
llib2.py", line 154, in urlopen
.
.
.
urllib2.HTTPError: HTTP Error 401: Unauthorized

This is probably going to conflict with #111, after it is merged, so I'll need to rebase one of them.

@nrc
Copy link
Member

nrc commented Mar 18, 2018

Looks good, you're right though, it does need a rebase.

This the labels endpoint returns 200 upon success and 4** upon
bad credentials or not found.
@davidalber
Copy link
Collaborator Author

Rebased! It doesn't seem to have kicked off a new build. 😕

@nrc nrc merged commit 66bd70c into rust-lang:master Mar 19, 2018
@nrc
Copy link
Member

nrc commented Mar 19, 2018

Thanks!

@davidalber davidalber deleted the test-add-labels branch March 19, 2018 04:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants