From a6fb9d6535c5ca0b6595cea0f4f7978fb135e56e Mon Sep 17 00:00:00 2001 From: Kevin McDermott Date: Wed, 22 Jan 2020 14:04:51 +0000 Subject: [PATCH] Record the create pull request in the fake driver. This updates the fake driver's PullRequests.Create method to record the newly created PullRequest, so that it can be fetched with the ID from the PullRequest that was created. The fake PRs also start with the number 1. --- scm/driver/fake/pr.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scm/driver/fake/pr.go b/scm/driver/fake/pr.go index 6f400c6ff..4f73e8618 100644 --- a/scm/driver/fake/pr.go +++ b/scm/driver/fake/pr.go @@ -127,6 +127,7 @@ func (s *pullService) DeleteComment(ctx context.Context, repo string, number int func (s *pullService) Create(ctx context.Context, repo string, input *scm.PullRequestInput) (*scm.PullRequest, *scm.Response, error) { f := s.data + f.PullRequestID++ answer := &scm.PullRequest{ Number: f.PullRequestID, Title: input.Title, @@ -139,6 +140,6 @@ func (s *pullService) Create(ctx context.Context, repo string, input *scm.PullRe }, } f.PullRequestsCreated[f.PullRequestID] = input - f.PullRequestID++ + f.PullRequests[f.PullRequestID] = answer return answer, nil, nil }