@@ -259,3 +259,109 @@ def test_iter_gists(self):
259259h = next (self .g .iter_gists ())
260260expect (h ).isinstance (github3 .gists .Gist )
261261self .mock_assertions (* args ,** self .conf )
262+
263+ def test_iter_org_issues (self ):
264+ self .request .return_value = generate_response ('issue' ,_iter = True )
265+ args = ('get' ,'https://api.github.com/orgs/github3py/issues' )
266+ self .conf .update (params = {})
267+
268+ with expect .githuberror ():
269+ self .g .iter_org_issues ('github3py' )
270+
271+ self .login ()
272+ i = next (self .g .iter_org_issues ('github3py' ))
273+ expect (i ).isinstance (github3 .issues .Issue )
274+ self .mock_assertions (* args ,** self .conf )
275+
276+ params = {'filter' :'assigned' ,'state' :'closed' ,'labels' :'bug' ,
277+ 'sort' :'created' ,'direction' :'asc' ,
278+ 'since' :'2012-05-20T23:10:27Z' }
279+ self .conf .update (params = params )
280+ j = next (self .g .iter_org_issues ('github3py' ,** params ))
281+ expect (j ).isinstance (github3 .issues .Issue )
282+ self .mock_assertions (* args ,** self .conf )
283+
284+ def test_iter_issues (self ):
285+ self .request .return_value = generate_response ('issue' ,_iter = True )
286+ args = ('get' ,'https://api.github.com/issues' )
287+ self .conf .update (params = {})
288+
289+ with expect .githuberror ():
290+ self .g .iter_issues ()
291+
292+ self .login ()
293+ expect (next (self .g .iter_issues ())).isinstance (github3 .issues .Issue )
294+ self .mock_assertions (* args ,** self .conf )
295+
296+ params = {'filter' :'assigned' ,'state' :'closed' ,'labels' :'bug' ,
297+ 'sort' :'created' ,'direction' :'asc' ,
298+ 'since' :'2012-05-20T23:10:27Z' }
299+ self .conf .update (params = params )
300+ expect (next (self .g .iter_issues (** params ))).isinstance (
301+ github3 .issues .Issue )
302+ self .mock_assertions (* args ,** self .conf )
303+
304+ def test_iter_user_issues (self ):
305+ self .request .return_value = generate_response ('issue' ,_iter = True )
306+ args = ('get' ,'https://api.github.com/user/issues' )
307+ self .conf .update (params = {})
308+
309+ with expect .githuberror ():
310+ self .g .iter_user_issues ()
311+
312+ self .login ()
313+ expect (next (self .g .iter_user_issues ())).isinstance (
314+ github3 .issues .Issue )
315+ self .mock_assertions (* args ,** self .conf )
316+
317+ params = {'filter' :'assigned' ,'state' :'closed' ,'labels' :'bug' ,
318+ 'sort' :'created' ,'direction' :'asc' ,
319+ 'since' :'2012-05-20T23:10:27Z' }
320+ self .conf .update (params = params )
321+ expect (next (self .g .iter_user_issues (** params ))).isinstance (
322+ github3 .issues .Issue )
323+ self .mock_assertions (* args ,** self .conf )
324+
325+ def test_iter_keys (self ):
326+ self .request .return_value = generate_response ('key' ,_iter = True )
327+ args = ('get' ,'https://api.github.com/user/keys' )
328+ self .conf .update (params = None )
329+
330+ with expect .githuberror ():
331+ self .g .iter_keys ()
332+
333+ self .login ()
334+ expect (next (self .g .iter_keys ())).isinstance (github3 .users .Key )
335+ self .mock_assertions (* args ,** self .conf )
336+
337+ def test_iter_repos (self ):
338+ self .request .return_value = generate_response ('repo' ,_iter = True )
339+ args = ('get' ,'https://api.github.com/user/repos' )
340+ self .conf .update (params = {})
341+
342+ self .login ()
343+ expect (next (self .g .iter_repos ())).isinstance (github3 .repos .Repository )
344+ self .mock_assertions (* args ,** self .conf )
345+
346+ args = ('get' ,'https://api.github.com/users/sigmavirus24/repos' )
347+ expect (next (self .g .iter_repos ('sigmavirus24' ))).isinstance (
348+ github3 .repos .Repository )
349+ self .mock_assertions (* args ,** self .conf )
350+
351+ def test_iter_starred (self ):
352+ self .request .return_value = generate_response ('repo' ,_iter = True )
353+ args = ('get' ,'https://api.github.com/user/starred' )
354+ self .conf .update (params = None )
355+
356+ self .login ()
357+ expect (next (self .g .iter_starred ())).isinstance (
358+ github3 .repos .Repository )
359+ self .mock_assertions (* args ,** self .conf )
360+
361+ with patch .object (github3 .github .GitHub ,'user' )as user :
362+ user .return_value = github3 .users .User (load (path ('user' )))
363+ args = ('get' ,
364+ 'https://api.github.com/users/sigmavirus24/starred' )
365+ expect (next (self .g .iter_starred ('sigmavirus24' ))).isinstance (
366+ github3 .repos .Repository )
367+ self .mock_assertions (* args ,** self .conf )