@@ -80,26 +80,26 @@ def test_create_repo(self):
8080
8181def test_delete_key (self ):
8282self .request .return_value = generate_response (None ,204 )
83- args = ('delete' ,'https://api.github.com/user/keys/10' )
8483
8584self .login ()
8685with patch .object (github3 .github .GitHub ,'key' )as key :
8786key .return_value = github3 .users .Key (load (path ('key' )),self .g )
8887assert self .g .delete_key (10 )is True
8988
90- self . mock_assertions ( * args , ** self .conf )
89+ assert self .request . called is True
9190
9291def test_follow (self ):
9392self .request .return_value = generate_response (None ,204 )
94- args = ('post' ,'https://api.github.com/user/following/sigmavirus24' )
93+ args = ('put' ,'https://api.github.com/user/following/sigmavirus24' )
94+ conf = dict (headers = {'Content-Length' :'0' },data = None )
9595
9696with expect .githuberror ():
9797self .g .follow ('sigmavirus24' )
9898
9999self .login ()
100100assert self .g .follow (None )is False
101101assert self .g .follow ('sigmavirus24' )is True
102- self .mock_assertions (* args ,** self . conf )
102+ self .mock_assertions (* args ,** conf )
103103
104104def test_gist (self ):
105105self .request .return_value = generate_response ('gist' ,200 )
@@ -138,12 +138,14 @@ def test_is_subscribed(self):
138138
139139def test_issue (self ):
140140self .request .return_value = generate_response ('issue' ,200 )
141- args = ('get' ,'https://api.github.com/repos/user/repo/issues/1' )
141+ args = ('get' ,
142+ 'https://api.github.com/repos/sigmavirus24/github3.py/issues/1'
143+ )
142144
143145assert self .g .issue (None ,None ,0 )is None
144146with patch .object (github3 .github .GitHub ,'repository' )as repo :
145147repo .return_value = github3 .repos .Repository (load (path ('repo' )))
146- i = self .g .issue (1 )
148+ i = self .g .issue ('user' , 'repo' , 1 )
147149
148150expect (i ).isinstance (github3 .issues .Issue )
149151self .mock_assertions (* args ,** self .conf )
@@ -166,7 +168,8 @@ def test_key(self):
166168def test_iter_authorizations (self ):
167169self .request .return_value = generate_response ('authorization' ,
168170_iter = True )
169- args = ('get' ,'https://api.github.com/user/authorizations' )
171+ args = ('get' ,'https://api.github.com/authorizations' )
172+ self .conf .update (params = None )
170173
171174with expect .githuberror ():
172175self .g .iter_authorizations ()
@@ -180,6 +183,7 @@ def test_iter_authorizations(self):
180183def test_iter_emails (self ):
181184self .request .return_value = generate_response ('emails' )
182185args = ('get' ,'https://api.github.com/user/emails' )
186+ self .conf .update (params = None )
183187
184188with expect .githuberror ():
185189self .g .iter_emails ()
@@ -193,6 +197,7 @@ def test_iter_emails(self):
193197def test_iter_events (self ):
194198self .request .return_value = generate_response ('event' ,_iter = True )
195199args = ('get' ,'https://api.github.com/events' )
200+ self .conf .update (params = None )
196201
197202event = next (self .g .iter_events ())
198203expect (event ).isinstance (github3 .events .Event )
@@ -201,44 +206,50 @@ def test_iter_events(self):
201206def test_iter_followers (self ):
202207self .request .return_value = generate_response ('user' ,_iter = True )
203208args = ('get' ,'https://api.github.com/users/sigmavirus24/followers' )
204-
205- u = next (self .g .iter_followers ('sigmavirus24' ))
206- expect (u ).isinstance (github3 .users .User )
207- assert self .request .called is True
208- self .mock_assertions (* args ,** self .conf )
209+ self .conf .update (params = None )
209210
210211with expect .githuberror ():
211- next (self .g .iter_followers ())
212-
213- self .login ()
214- v = next (self .g .iter_followers ())
215- expect (v ).isinstance (github3 .users .User )
216- args = (args [0 ],'https://api.github.com/user/followers' )
217- assert self .request .called is True
218- self .mock_assertions (* args ,** self .conf )
212+ self .g .iter_followers ()
213+
214+ with patch .object (github3 .github .GitHub ,'user' )as ghuser :
215+ ghuser .return_value = github3 .users .User (load (path ('user' )))
216+ u = next (self .g .iter_followers ('sigmavirus24' ))
217+ expect (u ).isinstance (github3 .users .User )
218+ assert self .request .called is True
219+ self .mock_assertions (* args ,** self .conf )
220+
221+ self .login ()
222+ v = next (self .g .iter_followers ())
223+ expect (v ).isinstance (github3 .users .User )
224+ args = (args [0 ],'https://api.github.com/user/followers' )
225+ assert self .request .called is True
226+ self .mock_assertions (* args ,** self .conf )
219227
220228def test_iter_following (self ):
221229self .request .return_value = generate_response ('user' ,_iter = True )
222- args = ('get' ,
223- 'https://api.github.com/users/sigmavirus24/followering' )
230+ args = ('get' ,'https://api.github.com/users/sigmavirus24/following' )
231+ self . conf . update ( params = None )
224232
225233with expect .githuberror ():
226234next (self .g .iter_following ())
227235assert self .request .called is False
228236
229- u = next (self .g .iter_following ('sigmavirus24' ))
230- expect (u ).isinstance (github3 .users .User )
231- self .mock_assertions (* args ,** self .conf )
237+ with patch .object (github3 .github .GitHub ,'user' )as ghuser :
238+ ghuser .return_value = github3 .users .User (load (path ('user' )))
239+ u = next (self .g .iter_following ('sigmavirus24' ))
240+ expect (u ).isinstance (github3 .users .User )
241+ self .mock_assertions (* args ,** self .conf )
232242
233- self .login ()
234- v = next (self .g .iter_following ())
235- expect (v ).isinstance (github3 .users .User )
236- args = (args [0 ],'https://api.github.com/user/following' )
237- self .mock_assertions (* args ,** self .conf )
243+ self .login ()
244+ v = next (self .g .iter_following ())
245+ expect (v ).isinstance (github3 .users .User )
246+ args = (args [0 ],'https://api.github.com/user/following' )
247+ self .mock_assertions (* args ,** self .conf )
238248
239249def test_iter_gists (self ):
240250self .request .return_value = generate_response ('gist' ,_iter = True )
241251args = ('get' ,'https://api.github.com/users/sigmavirus24/gists' )
252+ self .conf .update (params = None )
242253
243254g = next (self .g .iter_gists ('sigmavirus24' ))
244255expect (g ).isinstance (github3 .gists .Gist )