File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed
Filter options
src/test/java/org/kohsuke/github Expand file tree Collapse file tree 1 file changed +15
-8
lines changed
Original file line number Diff line number Diff line change @@ -58,22 +58,29 @@ public void testInviteUser() throws IOException {
58
58
// assertTrue(org.hasMember(user));
59
59
}
60
60
61
+ @ Before
62
+ public void cleanUpTeam () throws IOException {
63
+ // Cleanup is only needed when proxying
64
+ if (!mockGitHub .isUseProxy ()) {
65
+ return ;
66
+ }
67
+
68
+ GHTeam team = gitHubBeforeAfter .getOrganization (GITHUB_API_TEST_ORG ).
69
+ getTeamByName ("create-team-test" );
70
+ if (team != null ) {
71
+ team .delete ();
72
+ }
73
+ }
74
+
61
75
@ Test
62
76
public void testCreateTeamWithRepoAccess () throws IOException {
63
77
String REPO_NAME = "github-api" ;
64
- String TEAM_NAME = "create-team-test" ;
65
78
66
79
GHOrganization org = gitHub .getOrganization (GITHUB_API_TEST_ORG );
67
80
GHRepository repo = org .getRepository (REPO_NAME );
68
81
69
- // Clean up team if exists.
70
- GHTeam existingTeam = org .getTeamByName (TEAM_NAME );
71
- if (existingTeam != null ) {
72
- existingTeam .delete ();
73
- }
74
-
75
82
// Create team with access to repository. Check access was granted.
76
- GHTeam team = org .createTeam (TEAM_NAME , GHOrganization .Permission .PUSH , repo );
83
+ GHTeam team = org .createTeam ("create-team-test" , GHOrganization .Permission .PUSH , repo );
77
84
Assert .assertTrue (team .getRepositories ().containsKey (REPO_NAME ));
78
85
}
79
86
}
You can’t perform that action at this time.
0 commit comments