|
17 | 17 | import static org.testng.Assert.assertThrows; |
18 | 18 |
|
19 | 19 | public class PullRequestsTest { |
20 | | -// @Test |
21 | | -// public void testPullRequestsPrepareToCreateSuccessful() throws Exception { |
22 | | -// Map<String, Object> nsMap = ImmutableMap.of(Constants.IMG, |
23 | | -// "image", Constants.TAG, |
24 | | -// "tag", Constants.STORE, |
25 | | -// "store", Constants.SKIP_PR_CREATION, |
26 | | -// false, Constants.CHECK_FOR_RENOVATE, false); |
27 | | -// Namespace ns = new Namespace(nsMap); |
28 | | -// PullRequests pullRequests = new PullRequests(); |
29 | | -// GitHubPullRequestSender pullRequestSender = mock(GitHubPullRequestSender.class); |
30 | | -// PagedSearchIterable<GHContent> contentsFoundWithImage = mock(PagedSearchIterable.class); |
31 | | -// GitForkBranch gitForkBranch = mock(GitForkBranch.class); |
32 | | -// DockerfileGitHubUtil dockerfileGitHubUtil = mock(DockerfileGitHubUtil.class); |
33 | | -// RateLimiter rateLimiter = Mockito.spy(new RateLimiter()); |
34 | | -// Multimap<String, GitHubContentToProcess> pathToDockerfilesInParentRepo = ArrayListMultimap.create(); |
35 | | -// GitHubContentToProcess gitHubContentToProcess = mock(GitHubContentToProcess.class); |
36 | | -// pathToDockerfilesInParentRepo.put("repo1", gitHubContentToProcess); |
37 | | -// pathToDockerfilesInParentRepo.put("repo2", gitHubContentToProcess); |
38 | | -// when(pullRequestSender.forkRepositoriesFoundAndGetPathToDockerfiles(contentsFoundWithImage, gitForkBranch)).thenReturn(pathToDockerfilesInParentRepo); |
39 | | -// |
40 | | -// |
41 | | -// pullRequests.prepareToCreate(ns, pullRequestSender, contentsFoundWithImage, |
42 | | -// gitForkBranch, dockerfileGitHubUtil, rateLimiter); |
43 | | -// |
44 | | -// verify(dockerfileGitHubUtil, times(2)).changeDockerfiles(eq(ns), |
45 | | -// eq(pathToDockerfilesInParentRepo), |
46 | | -// eq(gitHubContentToProcess), anyList(), eq(gitForkBranch), |
47 | | -// eq(rateLimiter)); |
48 | | -// } |
| 20 | + @Test |
| 21 | + public void testPullRequestsPrepareToCreateSuccessful() throws Exception { |
| 22 | + Map<String, Object> nsMap = ImmutableMap.of(Constants.IMG, |
| 23 | + "image", Constants.TAG, |
| 24 | + "tag", Constants.STORE, |
| 25 | + "store", Constants.SKIP_PR_CREATION, |
| 26 | + false, Constants.CHECK_FOR_RENOVATE, false); |
| 27 | + Namespace ns = new Namespace(nsMap); |
| 28 | + PullRequests pullRequests = new PullRequests(); |
| 29 | + GitHubPullRequestSender pullRequestSender = mock(GitHubPullRequestSender.class); |
| 30 | + PagedSearchIterable<GHContent> contentsFoundWithImage = mock(PagedSearchIterable.class); |
| 31 | + GitForkBranch gitForkBranch = mock(GitForkBranch.class); |
| 32 | + DockerfileGitHubUtil dockerfileGitHubUtil = mock(DockerfileGitHubUtil.class); |
| 33 | + GithubAppCheck githubAppCheck = mock(GithubAppCheck.class); |
| 34 | + RateLimiter rateLimiter = Mockito.spy(new RateLimiter()); |
| 35 | + Multimap<String, GitHubContentToProcess> pathToDockerfilesInParentRepo = ArrayListMultimap.create(); |
| 36 | + GitHubContentToProcess gitHubContentToProcess = mock(GitHubContentToProcess.class); |
| 37 | + pathToDockerfilesInParentRepo.put("repo1", gitHubContentToProcess); |
| 38 | + pathToDockerfilesInParentRepo.put("repo2", gitHubContentToProcess); |
| 39 | + when(pullRequestSender.forkRepositoriesFoundAndGetPathToDockerfiles(contentsFoundWithImage, gitForkBranch)).thenReturn(pathToDockerfilesInParentRepo); |
| 40 | + |
| 41 | + pullRequests.prepareToCreate(ns, pullRequestSender, contentsFoundWithImage, |
| 42 | + gitForkBranch, dockerfileGitHubUtil, rateLimiter); |
| 43 | + |
| 44 | + verify(dockerfileGitHubUtil, times(2)).changeDockerfiles(eq(ns), |
| 45 | + eq(pathToDockerfilesInParentRepo), |
| 46 | + eq(gitHubContentToProcess), anyList(), eq(gitForkBranch), |
| 47 | + eq(rateLimiter)); |
| 48 | + } |
49 | 49 |
|
50 | 50 | // @Test(expectedExceptions = IOException.class) |
51 | 51 | // public void testPullRequestsPrepareThrowsException() throws Exception { |
|
0 commit comments