@@ -290,12 +290,11 @@ public void testRepoPermissions() throws Exception {
290290 assertFalse (r .hasAdminAccess ());
291291 }
292292
293- @ Ignore ("Needs mocking check" )
294293 @ Test
295294 public void testGetMyself () throws Exception {
296295 GHMyself me = gitHub .getMyself ();
297296 assertNotNull (me );
298- assertNotNull (gitHub .getUser ("kohsuke2 " ));
297+ assertNotNull (gitHub .getUser ("bitwiseman " ));
299298 PagedIterable <GHRepository > ghRepositories = me .listRepositories ();
300299 assertTrue (ghRepositories .iterator ().hasNext ());
301300 }
@@ -315,29 +314,25 @@ public void testOrgFork() throws Exception {
315314 gitHub .getRepository ("kohsuke/rubywm" ).forkTo (gitHub .getOrganization (GITHUB_API_TEST_ORG ));
316315 }
317316
318- @ Ignore ("Needs mocking check" )
319317 @ Test
320318 public void testGetTeamsForRepo () throws Exception {
321319 kohsuke ();
322320 // 'Core Developers' and 'Owners'
323321 assertEquals (2 , gitHub .getOrganization (GITHUB_API_TEST_ORG ).getRepository ("testGetTeamsForRepo" ).getTeams ().size ());
324322 }
325323
326- @ Ignore ("Needs mocking check" )
327324 @ Test
328325 public void testMembership () throws Exception {
329326 Set <String > members = gitHub .getOrganization (GITHUB_API_TEST_ORG ).getRepository ("jenkins" ).getCollaboratorNames ();
330327 System .out .println (members .contains ("kohsuke" ));
331328 }
332329
333- @ Ignore ("Needs mocking check" )
334330 @ Test
335331 public void testMemberOrgs () throws Exception {
336332 HashSet <GHOrganization > o = gitHub .getUser ("kohsuke" ).getOrganizations ();
337333 assertThat (o , hasItem (hasProperty ("name" , equalTo ("CloudBees" ))));
338334 }
339335
340- @ Ignore ("Needs mocking check" )
341336 @ Test
342337 public void testOrgTeams () throws Exception {
343338 kohsuke ();
@@ -349,23 +344,20 @@ public void testOrgTeams() throws Exception {
349344 assertTrue (sz < 100 );
350345 }
351346
352- @ Ignore ("Needs mocking check" )
353347 @ Test
354348 public void testOrgTeamByName () throws Exception {
355349 kohsuke ();
356350 GHTeam e = gitHub .getOrganization (GITHUB_API_TEST_ORG ).getTeamByName ("Core Developers" );
357351 assertNotNull (e );
358352 }
359353
360- @ Ignore ("Needs mocking check" )
361354 @ Test
362355 public void testOrgTeamBySlug () throws Exception {
363356 kohsuke ();
364357 GHTeam e = gitHub .getOrganization (GITHUB_API_TEST_ORG ).getTeamBySlug ("core-developers" );
365358 assertNotNull (e );
366359 }
367360
368- @ Ignore ("Needs mocking check" )
369361 @ Test
370362 public void testCommit () throws Exception {
371363 GHCommit commit = gitHub .getUser ("jenkinsci" ).getRepository ("jenkins" ).getCommit ("08c1c9970af4d609ae754fbe803e06186e3206f7" );
@@ -385,12 +377,10 @@ public void testCommit() throws Exception {
385377 assertNotNull (t .getEntry ("war" ).asTree ());
386378 }
387379
388- @ Ignore ("Needs mocking check" )
389380 @ Test
390381 public void testListCommits () throws Exception {
391382 List <String > sha1 = new ArrayList <String >();
392383 for (GHCommit c : gitHub .getUser ("kohsuke" ).getRepository ("empty-commit" ).listCommits ()) {
393- System .out .println (c .getSHA1 ());
394384 sha1 .add (c .getSHA1 ());
395385 }
396386 assertEquals ("fdfad6be4db6f96faea1f153fb447b479a7a9cb7" , sha1 .get (0 ));
@@ -416,7 +406,6 @@ public void testBranches() throws Exception {
416406 System .out .println (b );
417407 }
418408
419- @ Ignore ("Needs mocking check" )
420409 @ Test
421410 public void testCommitComment () throws Exception {
422411 GHRepository r = gitHub .getUser ("jenkinsci" ).getRepository ("jenkins" );
@@ -428,7 +417,6 @@ public void testCommitComment() throws Exception {
428417 }
429418 }
430419
431- @ Ignore ("Needs mocking check" )
432420 @ Test
433421 public void testCreateCommitComment () throws Exception {
434422 GHCommit commit = gitHub .getUser ("kohsuke" ).getRepository ("sandbox-ant" ).getCommit ("8ae38db0ea5837313ab5f39d43a6f73de3bd9000" );
@@ -439,7 +427,6 @@ public void testCreateCommitComment() throws Exception {
439427 c .delete ();
440428 }
441429
442- @ Ignore ("Needs mocking check" )
443430 @ Test
444431 public void tryHook () throws Exception {
445432 kohsuke ();
@@ -555,7 +542,6 @@ private void testPostCommitHook(GitHub gitHub) throws IOException {
555542 System .out .println (hooks );
556543 }
557544
558- @ Ignore ("Needs mocking check" )
559545 @ Test
560546 public void testOrgRepositories () throws IOException {
561547 kohsuke ();
@@ -566,7 +552,6 @@ public void testOrgRepositories() throws IOException {
566552 System .out .printf ("%d repositories in %dms\n " , repos .size (), end - start );
567553 }
568554
569- @ Ignore ("Needs mocking check" )
570555 @ Test
571556 public void testOrganization () throws IOException {
572557 kohsuke ();
@@ -578,7 +563,6 @@ public void testOrganization() throws IOException {
578563// t.add(labs.getRepository("xyz"));
579564 }
580565
581- @ Ignore ("Needs mocking check" )
582566 @ Test
583567 public void testCommitStatus () throws Exception {
584568 GHRepository r = gitHub .getRepository ("github-api/github-api" );
@@ -594,7 +578,6 @@ public void testCommitStatus() throws Exception {
594578 assertEquals ("http://kohsuke.org/" , state .getTargetUrl ());
595579 }
596580
597- @ Ignore ("Needs mocking check" )
598581 @ Test
599582 public void testCommitShortInfo () throws Exception {
600583 GHRepository r = gitHub .getRepository ("github-api/github-api" );
@@ -612,7 +595,6 @@ public void testPullRequestPopulate() throws Exception {
612595 assertNotNull (u .getName ());
613596 }
614597
615- @ Ignore ("Needs mocking check" )
616598 @ Test
617599 public void testCheckMembership () throws Exception {
618600 kohsuke ();
@@ -667,14 +649,12 @@ public void testCreateRelease() throws Exception {
667649 }
668650 }
669651
670- @ Ignore ("Needs mocking check" )
671652 @ Test
672653 public void testRef () throws IOException {
673654 GHRef masterRef = gitHub .getRepository ("jenkinsci/jenkins" ).getRef ("heads/master" );
674- assertEquals ("https://api.github.com /repos/jenkinsci/jenkins/git/refs/heads/master" , masterRef .getUrl ().toString ());
655+ assertEquals (mockGitHub . apiServer (). baseUrl () + " /repos/jenkinsci/jenkins/git/refs/heads/master" , masterRef .getUrl ().toString ());
675656 }
676657
677- @ Ignore ("Needs mocking check" )
678658 @ Test
679659 public void directoryListing () throws IOException {
680660 List <GHContent > children = gitHub .getRepository ("jenkinsci/jenkins" ).getDirectoryContent ("core" );
@@ -770,7 +750,6 @@ public void testTrees() throws IOException {
770750 assertTrue (foundReadme );
771751 }
772752
773- @ Ignore ("Needs mocking check" )
774753 @ Test
775754 public void testTreesRecursive () throws IOException {
776755 GHTree masterTree = gitHub .getRepository ("github-api/github-api" ).getTreeRecursive ("master" , 1 );
@@ -851,42 +830,32 @@ void cleanupLabel(String name) {
851830 }
852831 }
853832
854- @ Ignore ("Needs mocking check" )
855833 @ Test
856834 public void testSubscribers () throws IOException {
857- boolean kohsuke = false ;
858- GHRepository mr = gitHub .getRepository ("github-api /github-api" );
835+ boolean bitwiseman = false ;
836+ GHRepository mr = gitHub .getRepository ("bitwiseman /github-api" );
859837 for (GHUser u : mr .listSubscribers ()) {
860- System .out .println (u .getLogin ());
861- kohsuke |= u .getLogin ().equals ("kohsuke" );
838+ bitwiseman |= u .getLogin ().equals ("bitwiseman" );
862839 }
863- assertTrue (kohsuke );
864- System .out .println ("---" );
840+ assertTrue (bitwiseman );
865841
866- boolean githubApi = false ;
867- for (GHRepository r : gitHub .getUser ("kohsuke" ).listRepositories ()) {
868- System .out .println (r .getName ());
869- githubApi |= r .equals (mr );
842+ boolean githubApiFound = false ;
843+ for (GHRepository r : gitHub .getUser ("bitwiseman" ).listRepositories ()) {
844+ githubApiFound |= r .equals (mr );
870845 }
871- assertTrue (githubApi );
846+ assertTrue (githubApiFound );
872847 }
873848
874- @ Ignore ("Needs mocking check" )
875849 @ Test
876850 public void notifications () throws Exception {
877851 boolean found = false ;
878852 for (GHThread t : gitHub .listNotifications ().nonBlocking (true ).read (true )) {
879853 if (!found ) {
880854 found = true ;
881- t .markAsRead (); // test this by calling it once on old nofication
855+ t .markAsRead (); // test this by calling it once on old notfication
882856 }
883857 assertNotNull (t .getTitle ());
884858 assertNotNull (t .getReason ());
885-
886- System .out .println (t .getTitle ());
887- System .out .println (t .getLastReadAt ());
888- System .out .println (t .getType ());
889- System .out .println ();
890859 }
891860 assertTrue (found );
892861 gitHub .listNotifications ().markAsRead ();
@@ -905,7 +874,6 @@ public void checkToString() throws Exception {
905874 System .out .println (r .getIssue (1 ));
906875 }
907876
908- @ Ignore ("Needs mocking check" )
909877 @ Test
910878 public void reactions () throws Exception {
911879 GHIssue i = gitHub .getRepository ("github-api/github-api" ).getIssue (311 );
@@ -921,23 +889,16 @@ public void reactions() throws Exception {
921889 a .delete ();
922890 }
923891
924- @ Ignore ("Needs mocking check" )
925892 @ Test
926893 public void listOrgMemberships () throws Exception {
927894 GHMyself me = gitHub .getMyself ();
928895 for (GHMembership m : me .listOrgMemberships ()) {
929896 assertThat (m .getUser (), is ((GHUser ) me ));
930897 assertNotNull (m .getState ());
931898 assertNotNull (m .getRole ());
932-
933- System .out .printf ("%s %s %s\n " ,
934- m .getOrganization ().getLogin (),
935- m .getState (),
936- m .getRole ());
937899 }
938900 }
939901
940- @ Ignore ("Needs mocking check" )
941902 @ Test
942903 public void blob () throws Exception {
943904 GHRepository r = gitHub .getRepository ("github-api/github-api" );
0 commit comments