** LEGACY TESTS **/
(rt http.RoundTripper, remotes context.Remotes, branch string, cli string, baseRepo ghrepo.Interface)
| 854 | /** LEGACY TESTS **/ |
| 855 | |
| 856 | func runCommand(rt http.RoundTripper, remotes context.Remotes, branch string, cli string, baseRepo ghrepo.Interface) (*test.CmdOut, error) { |
| 857 | ios, _, stdout, stderr := iostreams.Test() |
| 858 | |
| 859 | factory := &cmdutil.Factory{ |
| 860 | IOStreams: ios, |
| 861 | HttpClient: func() (*http.Client, error) { |
| 862 | return &http.Client{Transport: rt}, nil |
| 863 | }, |
| 864 | Config: func() (gh.Config, error) { |
| 865 | return config.NewMockConfig(), nil |
| 866 | }, |
| 867 | Remotes: func() (context.Remotes, error) { |
| 868 | if remotes == nil { |
| 869 | return context.Remotes{ |
| 870 | { |
| 871 | Remote: &git.Remote{Name: "origin"}, |
| 872 | Repo: ghrepo.New("OWNER", "REPO"), |
| 873 | }, |
| 874 | }, nil |
| 875 | } |
| 876 | return remotes, nil |
| 877 | }, |
| 878 | Branch: func() (string, error) { |
| 879 | return branch, nil |
| 880 | }, |
| 881 | GitClient: &git.Client{ |
| 882 | GhPath: "some/path/gh", |
| 883 | GitPath: "some/path/git", |
| 884 | }, |
| 885 | BaseRepo: func() (ghrepo.Interface, error) { |
| 886 | return baseRepo, nil |
| 887 | }, |
| 888 | } |
| 889 | |
| 890 | cmd := NewCmdCheckout(factory, nil) |
| 891 | |
| 892 | argv, err := shlex.Split(cli) |
| 893 | if err != nil { |
| 894 | return nil, err |
| 895 | } |
| 896 | cmd.SetArgs(argv) |
| 897 | |
| 898 | cmd.SetIn(&bytes.Buffer{}) |
| 899 | cmd.SetOut(io.Discard) |
| 900 | cmd.SetErr(io.Discard) |
| 901 | |
| 902 | _, err = cmd.ExecuteC() |
| 903 | return &test.CmdOut{ |
| 904 | OutBuf: stdout, |
| 905 | ErrBuf: stderr, |
| 906 | }, err |
| 907 | } |
| 908 | |
| 909 | func TestPRCheckout_sameRepo(t *testing.T) { |
| 910 | http := &httpmock.Registry{} |
no test coverage detected