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