mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-01 19:31:10 +00:00
Cover AuthenticatedUser.edit
This commit is contained in:
@@ -142,6 +142,49 @@ class AuthenticatedUser( TestCase ):
|
||||
self.assertEqual( self.u.type, "User" )
|
||||
self.assertEqual( self.u.url, "https://api.github.com/users/jacquev6" )
|
||||
|
||||
def testEditWithoutArguments( self ):
|
||||
self.u.edit()
|
||||
|
||||
def testEditWithAllArguments( self ):
|
||||
oldName = self.u.name
|
||||
newName = "Name edited by PyGithub"
|
||||
|
||||
oldEmail = self.u.email
|
||||
newEmail = "Email edited by PyGithub"
|
||||
|
||||
oldBlog = self.u.blog
|
||||
newBlog = "Blog edited by PyGithub"
|
||||
|
||||
oldCompany = self.u.company
|
||||
newCompany = "Company edited by PyGithub"
|
||||
|
||||
oldLocation = self.u.location
|
||||
newLocation = "Location edited by PyGithub"
|
||||
|
||||
oldHireable = self.u.hireable
|
||||
newHireable = not oldHireable
|
||||
|
||||
oldBio = self.u.bio
|
||||
newBio = "Bio edited by PyGithub"
|
||||
|
||||
self.u.edit( newName, newEmail, newBlog, newCompany, newLocation, newHireable, newBio )
|
||||
self.assertEqual( self.u.name, newName )
|
||||
self.assertEqual( self.u.email, newEmail )
|
||||
self.assertEqual( self.u.blog, newBlog )
|
||||
self.assertEqual( self.u.company, newCompany )
|
||||
self.assertEqual( self.u.location, newLocation )
|
||||
self.assertEqual( self.u.hireable, newHireable )
|
||||
self.assertEqual( self.u.bio, newBio )
|
||||
|
||||
self.u.edit( oldName, oldEmail, oldBlog, oldCompany, oldLocation, oldHireable, oldBio )
|
||||
self.assertEqual( self.u.name, oldName )
|
||||
self.assertEqual( self.u.email, oldEmail )
|
||||
self.assertEqual( self.u.blog, oldBlog )
|
||||
self.assertEqual( self.u.company, oldCompany )
|
||||
self.assertEqual( self.u.location, oldLocation )
|
||||
self.assertEqual( self.u.hireable, oldHireable )
|
||||
self.assertEqual( self.u.bio, oldBio )
|
||||
|
||||
if len( sys.argv ) > 1 and sys.argv[ 1 ] == "--record":
|
||||
for method in sys.argv[ 2 : ]:
|
||||
class_, method = method.split( "." )
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
GET /user {} 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', '"de86c6f4ddb4f540ee7eef9e15823351"'), ('date', 'Tue, 08 May 2012 10:04:55 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
{"private_gists":5,"type":"User","hireable":false,"following":24,"company":"Criteo","blog":"http://vincent-jacques.net","bio":"","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","total_private_repos":5,"public_repos":10,"url":"https://api.github.com/users/jacquev6","owned_private_repos":5,"login":"jacquev6","collaborators":0,"email":"vincent@vincent-jacques.net","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","disk_usage":16692,"plan":{"private_repos":5,"collaborators":1,"space":614400,"name":"micro"},"created_at":"2010-07-09T06:10:06Z","name":"Vincent Jacques","public_gists":1,"followers":13,"id":327146,"location":"Paris, France"}
|
||||
|
||||
PATCH /user {} {"bio": "Bio edited by PyGithub", "name": "Name edited by PyGithub", "company": "Company edited by PyGithub", "blog": "Blog edited by PyGithub", "location": "Location edited by PyGithub", "hireable": true, "email": "Email edited by PyGithub"}
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4998'), ('content-length', '858'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"4695e7d2dc3084a322fe83f342448a79"'), ('date', 'Tue, 08 May 2012 10:04:55 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
{"private_gists":5,"type":"User","hireable":true,"following":24,"company":"Company edited by PyGithub","blog":"Blog edited by PyGithub","bio":"Bio edited by PyGithub","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","total_private_repos":5,"public_repos":10,"url":"https://api.github.com/users/jacquev6","owned_private_repos":5,"login":"jacquev6","collaborators":0,"email":"Email edited by PyGithub","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","disk_usage":16692,"plan":{"private_repos":5,"collaborators":1,"space":614400,"name":"micro"},"created_at":"2010-07-09T06:10:06Z","name":"Name edited by PyGithub","public_gists":1,"followers":13,"id":327146,"location":"Location edited by PyGithub"}
|
||||
|
||||
PATCH /user {} {"bio": "", "name": "Vincent Jacques", "company": "Criteo", "blog": "http://vincent-jacques.net", "location": "Paris, France", "hireable": false, "email": "vincent@vincent-jacques.net"}
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4997'), ('content-length', '801'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"24e5c5dc98abb7a960c2e3e24791403d"'), ('date', 'Tue, 08 May 2012 10:04:56 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
{"public_gists":1,"type":"User","blog":"http://vincent-jacques.net","url":"https://api.github.com/users/jacquev6","public_repos":10,"followers":13,"gravatar_id":"b68de5ae38616c296fa345d2b9df2225","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","private_gists":5,"disk_usage":16692,"plan":{"private_repos":5,"space":614400,"name":"micro","collaborators":1},"html_url":"https://github.com/jacquev6","hireable":false,"login":"jacquev6","email":"vincent@vincent-jacques.net","bio":"","created_at":"2010-07-09T06:10:06Z","company":"Criteo","location":"Paris, France","total_private_repos":5,"following":24,"name":"Vincent Jacques","collaborators":0,"id":327146,"owned_private_repos":5}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
PATCH /user {} {}
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4996'), ('content-length', '801'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"811fb4d5df8bae5b1ef7d63537891a1c"'), ('date', 'Tue, 08 May 2012 10:05:35 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
{"private_gists":5,"collaborators":0,"type":"User","bio":"","url":"https://api.github.com/users/jacquev6","public_repos":10,"followers":13,"gravatar_id":"b68de5ae38616c296fa345d2b9df2225","total_private_repos":5,"disk_usage":16692,"plan":{"collaborators":1,"space":614400,"name":"micro","private_repos":5},"html_url":"https://github.com/jacquev6","owned_private_repos":5,"login":"jacquev6","blog":"http://vincent-jacques.net","email":"vincent@vincent-jacques.net","created_at":"2010-07-09T06:10:06Z","company":"Criteo","location":"Paris, France","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","following":24,"name":"Vincent Jacques","public_gists":1,"hireable":false,"id":327146}
|
||||
|
||||
Reference in New Issue
Block a user