mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-02 11:51:10 +00:00
Structure parameters of Issue.edit
This commit is contained in:
@@ -689,9 +689,9 @@
|
||||
"optionalParameters": [
|
||||
{ "name": "title", "type": "string" },
|
||||
{ "name": "body", "type": "string" },
|
||||
{ "name": "assignee", "type": "string" },
|
||||
{ "name": "assignee", "type": "NamedUser" },
|
||||
{ "name": "state", "type": "string" },
|
||||
{ "name": "milestone", "type": "integer" },
|
||||
{ "name": "milestone", "type": "Milestone" },
|
||||
{ "name": "labels", "type": "list:string" }
|
||||
]
|
||||
},
|
||||
@@ -846,6 +846,9 @@
|
||||
"type": "Label",
|
||||
"getList": true
|
||||
}
|
||||
],
|
||||
"identity": [
|
||||
{ "type": "attribute", "value": [ "number" ] }
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -3932,9 +3932,9 @@
|
||||
},
|
||||
{
|
||||
"type": {
|
||||
"simple": true,
|
||||
"simple": false,
|
||||
"cardinality": "scalar",
|
||||
"name": "string"
|
||||
"name": "NamedUser"
|
||||
},
|
||||
"name": "assignee"
|
||||
},
|
||||
@@ -3948,9 +3948,9 @@
|
||||
},
|
||||
{
|
||||
"type": {
|
||||
"simple": true,
|
||||
"simple": false,
|
||||
"cardinality": "scalar",
|
||||
"name": "integer"
|
||||
"name": "Milestone"
|
||||
},
|
||||
"name": "milestone"
|
||||
},
|
||||
@@ -4735,6 +4735,14 @@
|
||||
],
|
||||
"isCompletable": true,
|
||||
"name": "Milestone",
|
||||
"identity": [
|
||||
{
|
||||
"type": "attribute",
|
||||
"value": [
|
||||
"number"
|
||||
]
|
||||
}
|
||||
],
|
||||
"methods": [
|
||||
{
|
||||
"group": "modification",
|
||||
|
||||
@@ -607,9 +607,9 @@ Modification
|
||||
* `edit( [title, body, assignee, state, milestone, labels] )`
|
||||
* `title`: string
|
||||
* `body`: string
|
||||
* `assignee`: string
|
||||
* `assignee`: `NamedUser`
|
||||
* `state`: string
|
||||
* `milestone`: integer
|
||||
* `milestone`: `Milestone`
|
||||
* `labels`: list of string
|
||||
|
||||
Class `IssueComment`
|
||||
|
||||
+4
-4
@@ -140,9 +140,9 @@ class Issue( GithubObject.GithubObject ):
|
||||
def edit( self, title = GithubObject.NotSet, body = GithubObject.NotSet, assignee = GithubObject.NotSet, state = GithubObject.NotSet, milestone = GithubObject.NotSet, labels = GithubObject.NotSet ):
|
||||
assert title is GithubObject.NotSet or isinstance( title, ( str, unicode ) ), title
|
||||
assert body is GithubObject.NotSet or isinstance( body, ( str, unicode ) ), body
|
||||
assert assignee is GithubObject.NotSet or isinstance( assignee, ( str, unicode ) ), assignee
|
||||
assert assignee is GithubObject.NotSet or isinstance( assignee, NamedUser.NamedUser ), assignee
|
||||
assert state is GithubObject.NotSet or isinstance( state, ( str, unicode ) ), state
|
||||
assert milestone is GithubObject.NotSet or isinstance( milestone, int ), milestone
|
||||
assert milestone is GithubObject.NotSet or isinstance( milestone, Milestone.Milestone ), milestone
|
||||
assert labels is GithubObject.NotSet or all( isinstance( element, ( str, unicode ) ) for element in labels ), labels
|
||||
post_parameters = dict()
|
||||
if title is not GithubObject.NotSet:
|
||||
@@ -150,11 +150,11 @@ class Issue( GithubObject.GithubObject ):
|
||||
if body is not GithubObject.NotSet:
|
||||
post_parameters[ "body" ] = body
|
||||
if assignee is not GithubObject.NotSet:
|
||||
post_parameters[ "assignee" ] = assignee
|
||||
post_parameters[ "assignee" ] = assignee._identity
|
||||
if state is not GithubObject.NotSet:
|
||||
post_parameters[ "state" ] = state
|
||||
if milestone is not GithubObject.NotSet:
|
||||
post_parameters[ "milestone" ] = milestone
|
||||
post_parameters[ "milestone" ] = milestone._identity
|
||||
if labels is not GithubObject.NotSet:
|
||||
post_parameters[ "labels" ] = labels
|
||||
status, headers, data = self._request(
|
||||
|
||||
@@ -110,6 +110,10 @@ class Milestone( GithubObject.GithubObject ):
|
||||
data
|
||||
)
|
||||
|
||||
@property
|
||||
def _identity( self ):
|
||||
return self.number
|
||||
|
||||
def _initAttributes( self ):
|
||||
self._closed_issues = GithubObject.NotSet
|
||||
self._created_at = GithubObject.NotSet
|
||||
|
||||
+3
-1
@@ -31,7 +31,9 @@ class Issue( Framework.TestCase ):
|
||||
self.issue.edit()
|
||||
|
||||
def testEditWithAllParameters( self ):
|
||||
self.issue.edit( "Title edited by PyGithub", "Body edited by PyGithub", "jacquev6", "open", 2, [ "Bug" ] )
|
||||
user = self.g.get_user( "jacquev6" )
|
||||
milestone = self.repo.get_milestone( 2 )
|
||||
self.issue.edit( "Title edited by PyGithub", "Body edited by PyGithub", user, "open", milestone, [ "Bug" ] )
|
||||
self.assertEqual( self.issue.assignee.login, "jacquev6" )
|
||||
self.assertEqual( self.issue.body, "Body edited by PyGithub" )
|
||||
self.assertEqual( self.issue.state, "open" )
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
GET /users/jacquev6 {'Authorization': 'Basic login_and_password_removed'} null
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4999'), ('content-length', '801'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"62c7a8cbbce2a245818e460643df01ea"'), ('date', 'Fri, 01 Jun 2012 18:53:23 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
{"public_gists":3,"type":"User","total_private_repos":5,"company":"Criteo","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","private_gists":5,"collaborators":0,"email":"vincent@vincent-jacques.net","owned_private_repos":5,"public_repos":10,"created_at":"2010-07-09T06:10:06Z","location":"Paris, France","url":"https://api.github.com/users/jacquev6","following":24,"blog":"http://vincent-jacques.net","disk_usage":16900,"name":"Vincent Jacques","hireable":false,"followers":13,"html_url":"https://github.com/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","id":327146,"plan":{"collaborators":1,"private_repos":5,"space":614400,"name":"micro"},"bio":""}
|
||||
|
||||
GET /repos/jacquev6/PyGithub/milestones/2 {'Authorization': 'Basic login_and_password_removed'} null
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4996'), ('content-length', '899'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"3a7652875cbbfe2a93b7307ab7a3deac"'), ('date', 'Fri, 01 Jun 2012 18:53:25 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
{"title":"Version 1.0: coherent public interface","creator":{"gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","url":"https://api.github.com/users/jacquev6","id":327146,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"closed_issues":13,"created_at":"2012-03-08T12:22:28Z","state":"open","description":"Heavy rewrite to have:\r\n* a fully coherent public interface\r\n* usable stack-traces in case of exception\r\n* more explicit exceptions\r\n* more readable code (for library exploration, auto-completion in IDEs, etc.)\r\n\r\nSee working branch https://github.com/jacquev6/PyGithub/tree/topic/RewriteWithGeneratedCode","url":"https://api.github.com/repos/jacquev6/PyGithub/milestones/2","due_on":"2012-06-04T07:00:00Z","open_issues":6,"number":2,"id":93547}
|
||||
|
||||
PATCH /repos/jacquev6/PyGithub/issues/28 {'Authorization': 'Basic login_and_password_removed'} {"body": "Body edited by PyGithub", "title": "Title edited by PyGithub", "labels": ["Bug"], "assignee": "jacquev6", "state": "open", "milestone": 2}
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4992'), ('content-length', '2034'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"98bbbf2b2187bf5cdd9aead53ecc2b97"'), ('date', 'Sat, 19 May 2012 10:42:26 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
|
||||
Reference in New Issue
Block a user