(opts FindOptions)
| 642 | } |
| 643 | |
| 644 | func (m *mockFinder) Find(opts FindOptions) (*api.PullRequest, ghrepo.Interface, error) { |
| 645 | if m.err != nil { |
| 646 | return nil, nil, m.err |
| 647 | } |
| 648 | if m.expectSelector != opts.Selector { |
| 649 | return nil, nil, fmt.Errorf("mockFinder: expected selector %q, got %q", m.expectSelector, opts.Selector) |
| 650 | } |
| 651 | if len(m.expectFields) > 0 && !isEqualSet(m.expectFields, opts.Fields) { |
| 652 | return nil, nil, fmt.Errorf("mockFinder: expected fields %v, got %v", m.expectFields, opts.Fields) |
| 653 | } |
| 654 | if m.called { |
| 655 | return nil, nil, errors.New("mockFinder used more than once") |
| 656 | } |
| 657 | m.called = true |
| 658 | |
| 659 | if m.pr.HeadRepositoryOwner.Login == "" { |
| 660 | // pose as same-repo PR by default |
| 661 | m.pr.HeadRepositoryOwner.Login = m.repo.RepoOwner() |
| 662 | } |
| 663 | |
| 664 | return m.pr, m.repo, nil |
| 665 | } |
| 666 | |
| 667 | func (m *mockFinder) ExpectFields(fields []string) { |
| 668 | m.expectFields = fields |
nothing calls this directly
no test coverage detected