@@ -1295,6 +1295,85 @@ def test_repositories_by_with_type(self):
12951295 )
12961296
12971297
1298+ class TestGitHubSearchIterators (helper .UnitSearchIteratorHelper ):
1299+
1300+ """Test GitHub methods that return search iterators."""
1301+
1302+ described_class = GitHub
1303+ example_data = None
1304+
1305+ def test_search_code (self ):
1306+ """Verify the request to search for code."""
1307+ i = self .instance .search_code (
1308+ 'addClass in:file language:js repo:jquery/jquery' )
1309+ self .get_next (i )
1310+
1311+ self .session .get .assert_called_once_with (
1312+ url_for ('search/code' ),
1313+ params = {'per_page' :100 ,
1314+ 'q' :'addClass in:file language:js repo:jquery/jquery' },
1315+ headers = {}
1316+ )
1317+
1318+ def test_search_commits (self ):
1319+ """Verify the request to search for commits."""
1320+ i = self .instance .search_commits (
1321+ 'css repo:octocat/Spoon-Knife' )
1322+ self .get_next (i )
1323+
1324+ self .session .get .assert_called_once_with (
1325+ url_for ('search/commits' ),
1326+ params = {'per_page' :100 ,
1327+ 'q' :'css repo:octocat/Spoon-Knife' },
1328+ headers = {'Accept' :'application/vnd.github.cloak-preview' }
1329+ )
1330+
1331+ def test_search_issues (self ):
1332+ """Verify the request to search for issues."""
1333+ i = self .instance .search_issues (
1334+ 'windows label:bug language:python state:open' ,
1335+ sort = 'created' ,order = 'asc' )
1336+ self .get_next (i )
1337+
1338+ self .session .get .assert_called_once_with (
1339+ url_for ('search/issues' ),
1340+ params = {'order' :'asc' ,
1341+ 'per_page' :100 ,
1342+ 'q' :'windows label:bug language:python state:open' ,
1343+ 'sort' :'created' },
1344+ headers = {}
1345+ )
1346+
1347+ def test_search_repositories (self ):
1348+ """Verify the request to search for repositories."""
1349+ i = self .instance .search_repositories (
1350+ 'tetris language:assembly' ,
1351+ sort = 'stars' ,order = 'asc' )
1352+ self .get_next (i )
1353+
1354+ self .session .get .assert_called_once_with (
1355+ url_for ('search/repositories' ),
1356+ params = {'order' :'asc' ,
1357+ 'per_page' :100 ,
1358+ 'q' :'tetris language:assembly' ,
1359+ 'sort' :'stars' },
1360+ headers = {}
1361+ )
1362+
1363+ def test_search_users (self ):
1364+ """Verify the request to search for users."""
1365+ i = self .instance .search_users (
1366+ 'tom repos:>42 followers:>1000' )
1367+ self .get_next (i )
1368+
1369+ self .session .get .assert_called_once_with (
1370+ url_for ('search/users' ),
1371+ params = {'per_page' :100 ,
1372+ 'q' :'tom repos:>42 followers:>1000' },
1373+ headers = {}
1374+ )
1375+
1376+
12981377class TestGitHubRequiresAuthentication (
12991378helper .UnitRequiresAuthenticationHelper ):
13001379