@@ -115,39 +115,41 @@ public void testPullRequestsPrepareToCreateWhenNoDockerfileFound() throws Except
115
115
eq (gitHubContentToProcess ), anyList (), eq (gitForkBranch ),eq (rateLimiter ));
116
116
}
117
117
118
- // @Test
119
- // public void testPullRequestsPrepareSkipsSendingPRIfRepoOnboardedToRenovate() throws Exception {
120
- // Map<String, Object> nsMap = ImmutableMap.of(Constants.IMG,
121
- // "image", Constants.TAG,
122
- // "tag", Constants.STORE,
123
- // "store", Constants.SKIP_PR_CREATION,
124
- // false, Constants.CHECK_FOR_RENOVATE, true);
125
- // Namespace ns = new Namespace(nsMap);
126
- // PullRequests pullRequests = new PullRequests();
127
- // GitHubPullRequestSender pullRequestSender = mock(GitHubPullRequestSender.class);
128
- // PagedSearchIterable<GHContent> contentsFoundWithImage = mock(PagedSearchIterable.class);
129
- // GitForkBranch gitForkBranch = mock(GitForkBranch.class);
130
- // DockerfileGitHubUtil dockerfileGitHubUtil = mock(DockerfileGitHubUtil.class);
131
- // GithubAppCheck githubAppCheck = mock(GithubAppCheck.class);
132
- // RateLimiter rateLimiter = Mockito.spy(new RateLimiter());
133
- // Multimap<String, GitHubContentToProcess> pathToDockerfilesInParentRepo = ArrayListMultimap.create();
134
- // GitHubContentToProcess gitHubContentToProcess = mock(GitHubContentToProcess.class);
135
- // GHRepository ghRepository = mock(GHRepository.class);
136
- // pathToDockerfilesInParentRepo.put("repo1", gitHubContentToProcess);
137
-
138
- // when(pullRequestSender.forkRepositoriesFoundAndGetPathToDockerfiles(contentsFoundWithImage, gitForkBranch)).thenReturn(pathToDockerfilesInParentRepo);
139
- // when(gitHubContentToProcess.getParent()).thenReturn(ghRepository);
140
- // when(ghRepository.getFullName()).thenReturn("repo");
141
- // when(githubAppCheck.isGithubAppEnabledOnRepository(anyString())).thenReturn(true);
142
-
143
- // pullRequests.prepareToCreate(ns, pullRequestSender, contentsFoundWithImage,
144
- // gitForkBranch, dockerfileGitHubUtil, rateLimiter);
145
-
146
- // verify(dockerfileGitHubUtil, times(0)).changeDockerfiles(eq(ns),
147
- // eq(pathToDockerfilesInParentRepo),
148
- // eq(gitHubContentToProcess), anyList(), eq(gitForkBranch),
149
- // eq(rateLimiter));
150
- // }
118
+ @ Test
119
+ public void testPullRequestsPrepareSkipsSendingPRIfRepoOnboardedToRenovate () throws Exception {
120
+ Map <String , Object > nsMap = ImmutableMap .of (Constants .IMG ,
121
+ "image" , Constants .TAG ,
122
+ "tag" , Constants .STORE ,
123
+ "store" , Constants .SKIP_PR_CREATION ,
124
+ false , Constants .CHECK_FOR_RENOVATE , true );
125
+ Namespace ns = new Namespace (nsMap );
126
+ PullRequests pullRequests = new PullRequests ();
127
+ GitHubPullRequestSender pullRequestSender = mock (GitHubPullRequestSender .class );
128
+ PagedSearchIterable <GHContent > contentsFoundWithImage = mock (PagedSearchIterable .class );
129
+ GitForkBranch gitForkBranch = mock (GitForkBranch .class );
130
+ GithubAppCheck githubAppCheck = mock (GithubAppCheck .class );
131
+ RateLimiter rateLimiter = Mockito .spy (new RateLimiter ());
132
+ DockerfileGitHubUtil dockerfileGitHubUtil = mock (DockerfileGitHubUtil .class );
133
+ Multimap <String , GitHubContentToProcess > pathToDockerfilesInParentRepo = mock (Multimap .class );
134
+ GitHubContentToProcess gitHubContentToProcess = mock (GitHubContentToProcess .class );
135
+ GHRepository ghRepository = mock (GHRepository .class );
136
+
137
+ when (pullRequestSender .forkRepositoriesFoundAndGetPathToDockerfiles (contentsFoundWithImage , gitForkBranch )).thenReturn (pathToDockerfilesInParentRepo );
138
+ Set <String > currUsers = new HashSet <>();
139
+ currUsers .add ("repo1" );
140
+ when (pathToDockerfilesInParentRepo .keySet ()).thenReturn (currUsers );
141
+ when (gitHubContentToProcess .getParent ()).thenReturn (ghRepository );
142
+ when (ghRepository .getFullName ()).thenReturn ("repoParent" );
143
+ when (githubAppCheck .isGithubAppEnabledOnRepository (anyString ())).thenReturn (true );
144
+
145
+ pullRequests .prepareToCreate (ns , pullRequestSender , contentsFoundWithImage ,
146
+ gitForkBranch , dockerfileGitHubUtil , rateLimiter );
147
+
148
+ verify (dockerfileGitHubUtil , times (0 )).changeDockerfiles (eq (ns ),
149
+ eq (pathToDockerfilesInParentRepo ),
150
+ eq (gitHubContentToProcess ), anyList (), eq (gitForkBranch ),
151
+ eq (rateLimiter ));
152
+ }
151
153
152
154
@ Test
153
155
public void testisRenovateEnabledReturnsFalseIfRenovateConfigFileNotFound () throws IOException {
0 commit comments