forked from drone/go-scm
-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
188 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package fake | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/jenkins-x/go-scm/scm" | ||
) | ||
|
||
type pullService struct { | ||
client *wrapper | ||
data *Data | ||
} | ||
|
||
func (s *pullService) Find(context.Context, string, int) (*scm.PullRequest, *scm.Response, error) { | ||
panic("implement me") | ||
} | ||
|
||
func (s *pullService) FindComment(context.Context, string, int, int) (*scm.Comment, *scm.Response, error) { | ||
panic("implement me") | ||
} | ||
|
||
func (s *pullService) List(context.Context, string, scm.PullRequestListOptions) ([]*scm.PullRequest, *scm.Response, error) { | ||
panic("implement me") | ||
} | ||
|
||
func (s *pullService) ListChanges(ctx context.Context, repo string, number int, opts scm.ListOptions) ([]*scm.Change, *scm.Response, error) { | ||
f := s.data | ||
return f.PullRequestChanges[number], nil, nil | ||
} | ||
|
||
func (s *pullService) ListComments(ctx context.Context, repo string, number int, opts scm.ListOptions) ([]*scm.Comment, *scm.Response, error) { | ||
f := s.data | ||
return append([]*scm.Comment{}, f.PullRequestComments[number]...), nil, nil | ||
} | ||
|
||
func (s *pullService) Merge(context.Context, string, int) (*scm.Response, error) { | ||
panic("implement me") | ||
} | ||
|
||
func (s *pullService) Close(context.Context, string, int) (*scm.Response, error) { | ||
panic("implement me") | ||
} | ||
|
||
func (s *pullService) CreateComment(context.Context, string, int, *scm.CommentInput) (*scm.Comment, *scm.Response, error) { | ||
panic("implement me") | ||
} | ||
|
||
func (s *pullService) DeleteComment(context.Context, string, int, int) (*scm.Response, error) { | ||
panic("implement me") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package fake | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/jenkins-x/go-scm/scm" | ||
) | ||
|
||
type reviewService struct { | ||
client *wrapper | ||
data *Data | ||
} | ||
|
||
func (s *reviewService) Find(ctx context.Context, repo string, number int, reviewID int) (*scm.Review, *scm.Response, error) { | ||
reviews, r, err := s.List(ctx, repo, number, scm.ListOptions{}) | ||
if err != nil { | ||
return nil, r, err | ||
} | ||
for _, review := range reviews { | ||
if review.ID == reviewID { | ||
return review, nil, nil | ||
} | ||
} | ||
return nil, r, err | ||
} | ||
|
||
func (s *reviewService) List(ctx context.Context, repo string, number int, opt scm.ListOptions) ([]*scm.Review, *scm.Response, error) { | ||
f := s.data | ||
return append([]*scm.Review{}, f.Reviews[number]...), nil, nil | ||
} | ||
|
||
func (s *reviewService) Create(ctx context.Context, repo string, number int, input *scm.ReviewInput) (*scm.Review, *scm.Response, error) { | ||
f := s.data | ||
review := &scm.Review{ | ||
ID: f.ReviewID, | ||
Author: scm.User{Login: botName}, | ||
Body: input.Body, | ||
} | ||
f.Reviews[number] = append(f.Reviews[number], review) | ||
f.ReviewID++ | ||
return review, nil, nil | ||
} | ||
|
||
func (s *reviewService) Delete(context.Context, string, int, int) (*scm.Response, error) { | ||
panic("implement me") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters