Merge pull request #218 from farrd/master

Can now specify assignee as a string
This commit is contained in:
Vincent Jacques
2013-12-23 19:27:00 -08:00
10 changed files with 288 additions and 20 deletions
+1
View File
@@ -86,3 +86,4 @@ from Issue140 import *
from Issue142 import *
from Issue158 import *
from Issue174 import *
from Issue214 import *
+69
View File
@@ -0,0 +1,69 @@
# -*- coding: utf-8 -*-
############################ Copyrights and license ############################
# #
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
# Copyright 2012 Zearin <zearin@gonk.net> #
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
# #
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
# #
# PyGithub is free software: you can redistribute it and/or modify it under #
# the terms of the GNU Lesser General Public License as published by the Free #
# Software Foundation, either version 3 of the License, or (at your option) #
# any later version. #
# #
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
# details. #
# #
# You should have received a copy of the GNU Lesser General Public License #
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
# #
################################################################################
import github
import Framework
class Issue214(Framework.TestCase): # https://github.com/jacquev6/PyGithub/issues/214
def setUp(self):
Framework.TestCase.setUp(self)
self.repo = self.g.get_user().get_repo("PyGithub")
self.issue = self.repo.get_issue(1)
def testAssignees(self):
self.assertTrue(self.repo.has_in_assignees('farrd'))
self.assertFalse(self.repo.has_in_assignees('fake'))
def testCollaborators(self):
self.assertTrue(self.repo.has_in_collaborators('farrd'))
self.assertFalse(self.repo.has_in_collaborators('fake'))
self.assertFalse(self.repo.has_in_collaborators('marcmenges'))
self.repo.add_to_collaborators('marcmenges')
self.assertTrue(self.repo.has_in_collaborators('marcmenges'))
self.repo.remove_from_collaborators('marcmenges')
self.assertFalse(self.repo.has_in_collaborators('marcmenges'))
def testEditIssue(self):
self.assertEqual(self.issue.assignee, None)
self.issue.edit(assignee='farrd')
self.assertEqual(self.issue.assignee.login, 'farrd')
self.issue.edit(assignee=None)
self.assertEqual(self.issue.assignee, None)
def testCreateIssue(self):
issue = self.repo.create_issue("Issue created by PyGithub", assignee='farrd')
self.assertEqual(issue.assignee.login, 'farrd')
def testGetIssues(self):
issues = self.repo.get_issues(assignee='farrd')
for issue in issues:
self.assertEqual(issue.assignee.login, 'farrd')
File diff suppressed because one or more lines are too long
@@ -0,0 +1,22 @@
https
GET
api.github.com
None
/repos/farrd/PyGithub/assignees/farrd
{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
null
204
[('status', '204 No Content'), ('x-ratelimit-remaining', '4838'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('access-control-expose-headers', 'ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', 'A99159CE:043C:7376C18:52AF9217'), ('vary', 'Accept-Encoding'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('access-control-allow-credentials', 'true'), ('date', 'Mon, 16 Dec 2013 23:51:51 GMT'), ('access-control-allow-origin', '*'), ('x-ratelimit-reset', '1387240227')]
https
GET
api.github.com
None
/repos/farrd/PyGithub/assignees/fake
{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
null
404
[('status', '404 Not Found'), ('x-ratelimit-remaining', '4837'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('access-control-expose-headers', 'ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', 'A99159CE:0438:2A76207:52AF9218'), ('content-length', '76'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('access-control-allow-credentials', 'true'), ('date', 'Mon, 16 Dec 2013 23:51:52 GMT'), ('access-control-allow-origin', '*'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1387240227')]
{"message":"Not Found","documentation_url":"http://developer.github.com/v3"}
@@ -0,0 +1,77 @@
https
GET
api.github.com
None
/repos/farrd/PyGithub/collaborators/farrd
{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
null
204
[('status', '204 No Content'), ('x-ratelimit-remaining', '4765'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('access-control-expose-headers', 'ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', 'A99159CE:6DAC:7BF4F10:52AF94DB'), ('vary', 'Accept-Encoding'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('access-control-allow-credentials', 'true'), ('date', 'Tue, 17 Dec 2013 00:03:40 GMT'), ('access-control-allow-origin', '*'), ('x-ratelimit-reset', '1387240227')]
https
GET
api.github.com
None
/repos/farrd/PyGithub/collaborators/fake
{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
null
404
[('status', '404 Not Found'), ('x-ratelimit-remaining', '4764'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('access-control-expose-headers', 'ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', 'A99159CE:6DAC:7BF4F8B:52AF94DC'), ('content-length', '76'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('access-control-allow-credentials', 'true'), ('date', 'Tue, 17 Dec 2013 00:03:40 GMT'), ('access-control-allow-origin', '*'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1387240227')]
{"message":"Not Found","documentation_url":"http://developer.github.com/v3"}
https
GET
api.github.com
None
/repos/farrd/PyGithub/collaborators/marcmenges
{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
null
404
[('status', '404 Not Found'), ('x-ratelimit-remaining', '4763'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('access-control-expose-headers', 'ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', 'A99159CE:6DAA:61929C1:52AF94DC'), ('content-length', '76'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('access-control-allow-credentials', 'true'), ('date', 'Tue, 17 Dec 2013 00:03:40 GMT'), ('access-control-allow-origin', '*'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1387240227')]
{"message":"Not Found","documentation_url":"http://developer.github.com/v3"}
https
PUT
api.github.com
None
/repos/farrd/PyGithub/collaborators/marcmenges
{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
null
204
[('status', '204 No Content'), ('x-ratelimit-remaining', '4762'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('access-control-expose-headers', 'ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', 'A99159CE:6DAA:6192A15:52AF94DC'), ('vary', 'Accept-Encoding'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('access-control-allow-credentials', 'true'), ('date', 'Tue, 17 Dec 2013 00:03:41 GMT'), ('access-control-allow-origin', '*'), ('x-ratelimit-reset', '1387240227')]
https
GET
api.github.com
None
/repos/farrd/PyGithub/collaborators/marcmenges
{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
null
204
[('status', '204 No Content'), ('x-ratelimit-remaining', '4761'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('access-control-expose-headers', 'ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', 'A99159CE:6DAB:78E7BE4:52AF94DD'), ('vary', 'Accept-Encoding'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('access-control-allow-credentials', 'true'), ('date', 'Tue, 17 Dec 2013 00:03:41 GMT'), ('access-control-allow-origin', '*'), ('x-ratelimit-reset', '1387240227')]
https
DELETE
api.github.com
None
/repos/farrd/PyGithub/collaborators/marcmenges
{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
null
204
[('status', '204 No Content'), ('x-ratelimit-remaining', '4760'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('access-control-expose-headers', 'ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', 'A99159CE:6DAC:7BF51C3:52AF94DD'), ('vary', 'Accept-Encoding'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('access-control-allow-credentials', 'true'), ('date', 'Tue, 17 Dec 2013 00:03:41 GMT'), ('access-control-allow-origin', '*'), ('x-ratelimit-reset', '1387240227')]
https
GET
api.github.com
None
/repos/farrd/PyGithub/collaborators/marcmenges
{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
null
404
[('status', '404 Not Found'), ('x-ratelimit-remaining', '4759'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('access-control-expose-headers', 'ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', 'A99159CE:6DA9:6920FB1:52AF94DE'), ('content-length', '76'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('access-control-allow-credentials', 'true'), ('date', 'Tue, 17 Dec 2013 00:03:42 GMT'), ('access-control-allow-origin', '*'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1387240227')]
{"message":"Not Found","documentation_url":"http://developer.github.com/v3"}
@@ -0,0 +1,11 @@
https
POST
api.github.com
None
/repos/farrd/PyGithub/issues
{'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
{"assignee": "farrd", "title": "Issue created by PyGithub"}
201
[('status', '201 Created'), ('x-ratelimit-remaining', '4828'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('access-control-expose-headers', 'ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', 'A99159CE:043B:6651E72:52AF921C'), ('access-control-allow-credentials', 'true'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP'), ('location', 'https://api.github.com/repos/farrd/PyGithub/issues/3'), ('content-length', '2592'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('etag', '"900018f8180df60c18df92fcab23cf23"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Mon, 16 Dec 2013 23:51:56 GMT'), ('access-control-allow-origin', '*'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1387240227')]
{"url":"https://api.github.com/repos/farrd/PyGithub/issues/3","labels_url":"https://api.github.com/repos/farrd/PyGithub/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/farrd/PyGithub/issues/3/comments","events_url":"https://api.github.com/repos/farrd/PyGithub/issues/3/events","html_url":"https://github.com/farrd/PyGithub/issues/3","id":24390063,"number":3,"title":"Issue created by PyGithub","user":{"login":"farrd","id":1387834,"avatar_url":"https://gravatar.com/avatar/3281acd8cd12337bfba7577736ae663e?d=https%3A%2F%2Fidenticons.github.com%2Fe57fcb2ce01df0e0a8305b6fff8070d8.png&r=x","gravatar_id":"3281acd8cd12337bfba7577736ae663e","url":"https://api.github.com/users/farrd","html_url":"https://github.com/farrd","followers_url":"https://api.github.com/users/farrd/followers","following_url":"https://api.github.com/users/farrd/following{/other_user}","gists_url":"https://api.github.com/users/farrd/gists{/gist_id}","starred_url":"https://api.github.com/users/farrd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/farrd/subscriptions","organizations_url":"https://api.github.com/users/farrd/orgs","repos_url":"https://api.github.com/users/farrd/repos","events_url":"https://api.github.com/users/farrd/events{/privacy}","received_events_url":"https://api.github.com/users/farrd/received_events","type":"User","site_admin":false},"labels":[],"state":"open","assignee":{"login":"farrd","id":1387834,"avatar_url":"https://gravatar.com/avatar/3281acd8cd12337bfba7577736ae663e?d=https%3A%2F%2Fidenticons.github.com%2Fe57fcb2ce01df0e0a8305b6fff8070d8.png&r=x","gravatar_id":"3281acd8cd12337bfba7577736ae663e","url":"https://api.github.com/users/farrd","html_url":"https://github.com/farrd","followers_url":"https://api.github.com/users/farrd/followers","following_url":"https://api.github.com/users/farrd/following{/other_user}","gists_url":"https://api.github.com/users/farrd/gists{/gist_id}","starred_url":"https://api.github.com/users/farrd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/farrd/subscriptions","organizations_url":"https://api.github.com/users/farrd/orgs","repos_url":"https://api.github.com/users/farrd/repos","events_url":"https://api.github.com/users/farrd/events{/privacy}","received_events_url":"https://api.github.com/users/farrd/received_events","type":"User","site_admin":false},"milestone":null,"comments":0,"created_at":"2013-12-16T23:51:56Z","updated_at":"2013-12-16T23:51:56Z","closed_at":null,"pull_request":{"html_url":null,"diff_url":null,"patch_url":null},"body":null,"closed_by":null}
@@ -0,0 +1,22 @@
https
PATCH
api.github.com
None
/repos/farrd/PyGithub/issues/1
{'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
{"assignee": "farrd"}
200
[('status', '200 OK'), ('x-ratelimit-remaining', '4824'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('access-control-expose-headers', 'ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', 'A99159CE:043C:7377930:52AF921D'), ('access-control-allow-credentials', 'true'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('content-length', '2575'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('etag', '"fa6d38417e4f455619cdfe179b7b1e40"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Mon, 16 Dec 2013 23:51:58 GMT'), ('access-control-allow-origin', '*'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1387240227')]
{"url":"https://api.github.com/repos/farrd/PyGithub/issues/1","labels_url":"https://api.github.com/repos/farrd/PyGithub/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/farrd/PyGithub/issues/1/comments","events_url":"https://api.github.com/repos/farrd/PyGithub/issues/1/events","html_url":"https://github.com/farrd/PyGithub/issues/1","id":24389294,"number":1,"title":"Test Issue","user":{"login":"farrd","id":1387834,"avatar_url":"https://gravatar.com/avatar/3281acd8cd12337bfba7577736ae663e?d=https%3A%2F%2Fidenticons.github.com%2Fe57fcb2ce01df0e0a8305b6fff8070d8.png&r=x","gravatar_id":"3281acd8cd12337bfba7577736ae663e","url":"https://api.github.com/users/farrd","html_url":"https://github.com/farrd","followers_url":"https://api.github.com/users/farrd/followers","following_url":"https://api.github.com/users/farrd/following{/other_user}","gists_url":"https://api.github.com/users/farrd/gists{/gist_id}","starred_url":"https://api.github.com/users/farrd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/farrd/subscriptions","organizations_url":"https://api.github.com/users/farrd/orgs","repos_url":"https://api.github.com/users/farrd/repos","events_url":"https://api.github.com/users/farrd/events{/privacy}","received_events_url":"https://api.github.com/users/farrd/received_events","type":"User","site_admin":false},"labels":[],"state":"open","assignee":{"login":"farrd","id":1387834,"avatar_url":"https://gravatar.com/avatar/3281acd8cd12337bfba7577736ae663e?d=https%3A%2F%2Fidenticons.github.com%2Fe57fcb2ce01df0e0a8305b6fff8070d8.png&r=x","gravatar_id":"3281acd8cd12337bfba7577736ae663e","url":"https://api.github.com/users/farrd","html_url":"https://github.com/farrd","followers_url":"https://api.github.com/users/farrd/followers","following_url":"https://api.github.com/users/farrd/following{/other_user}","gists_url":"https://api.github.com/users/farrd/gists{/gist_id}","starred_url":"https://api.github.com/users/farrd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/farrd/subscriptions","organizations_url":"https://api.github.com/users/farrd/orgs","repos_url":"https://api.github.com/users/farrd/repos","events_url":"https://api.github.com/users/farrd/events{/privacy}","received_events_url":"https://api.github.com/users/farrd/received_events","type":"User","site_admin":false},"milestone":null,"comments":0,"created_at":"2013-12-16T23:36:11Z","updated_at":"2013-12-16T23:51:58Z","closed_at":null,"pull_request":{"html_url":null,"diff_url":null,"patch_url":null},"body":"","closed_by":null}
https
PATCH
api.github.com
None
/repos/farrd/PyGithub/issues/1
{'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
{"assignee": ""}
200
[('status', '200 OK'), ('x-ratelimit-remaining', '4823'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('access-control-expose-headers', 'ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', 'A99159CE:043C:7377A01:52AF921E'), ('access-control-allow-credentials', 'true'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('content-length', '1621'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('etag', '"f6bb6e7859e5f62cdc99f6fc6cbe0c09"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Mon, 16 Dec 2013 23:51:58 GMT'), ('access-control-allow-origin', '*'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1387240227')]
{"url":"https://api.github.com/repos/farrd/PyGithub/issues/1","labels_url":"https://api.github.com/repos/farrd/PyGithub/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/farrd/PyGithub/issues/1/comments","events_url":"https://api.github.com/repos/farrd/PyGithub/issues/1/events","html_url":"https://github.com/farrd/PyGithub/issues/1","id":24389294,"number":1,"title":"Test Issue","user":{"login":"farrd","id":1387834,"avatar_url":"https://gravatar.com/avatar/3281acd8cd12337bfba7577736ae663e?d=https%3A%2F%2Fidenticons.github.com%2Fe57fcb2ce01df0e0a8305b6fff8070d8.png&r=x","gravatar_id":"3281acd8cd12337bfba7577736ae663e","url":"https://api.github.com/users/farrd","html_url":"https://github.com/farrd","followers_url":"https://api.github.com/users/farrd/followers","following_url":"https://api.github.com/users/farrd/following{/other_user}","gists_url":"https://api.github.com/users/farrd/gists{/gist_id}","starred_url":"https://api.github.com/users/farrd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/farrd/subscriptions","organizations_url":"https://api.github.com/users/farrd/orgs","repos_url":"https://api.github.com/users/farrd/repos","events_url":"https://api.github.com/users/farrd/events{/privacy}","received_events_url":"https://api.github.com/users/farrd/received_events","type":"User","site_admin":false},"labels":[],"state":"open","assignee":null,"milestone":null,"comments":0,"created_at":"2013-12-16T23:36:11Z","updated_at":"2013-12-16T23:51:58Z","closed_at":null,"pull_request":{"html_url":null,"diff_url":null,"patch_url":null},"body":"","closed_by":null}
File diff suppressed because one or more lines are too long