remove unwanted tests and unwanted functionality
This commit is contained in:
parent
8f1c467001
commit
d4e14beb57
2 changed files with 3 additions and 58 deletions
|
|
@ -29,7 +29,6 @@ type EditOptions struct {
|
|||
Config func() (config.Config, error)
|
||||
|
||||
Edit func(string, string, string, *iostreams.IOStreams) (string, error)
|
||||
Add func(string, string, *iostreams.IOStreams) (string, error)
|
||||
Selector string
|
||||
EditFilename string
|
||||
AddFilename string
|
||||
|
|
@ -47,13 +46,6 @@ func NewCmdEdit(f *cmdutil.Factory, runF func(*EditOptions) error) *cobra.Comman
|
|||
defaultContent,
|
||||
io.In, io.Out, io.ErrOut, nil)
|
||||
},
|
||||
Add: func(editorCmd, filename string, io *iostreams.IOStreams) (string, error) {
|
||||
return surveyext.Edit(
|
||||
editorCmd,
|
||||
"*."+filename,
|
||||
"",
|
||||
io.In, io.Out, io.ErrOut, nil)
|
||||
},
|
||||
}
|
||||
|
||||
cmd := &cobra.Command{
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
fixtureFile = "../fixture.txt"
|
||||
fixtureFile = "../fixture.txt"
|
||||
)
|
||||
|
||||
func Test_getFilesToAdd(t *testing.T) {
|
||||
|
|
@ -243,7 +243,7 @@ func Test_editRun(t *testing.T) {
|
|||
wantStderr: "You do not own this gist.",
|
||||
},
|
||||
{
|
||||
name: "add file to existing gist with absolute path",
|
||||
name: "add file to existing gist",
|
||||
gist: &shared.Gist{
|
||||
ID: "1234",
|
||||
Files: map[string]*shared.GistFile{
|
||||
|
|
@ -260,50 +260,7 @@ func Test_editRun(t *testing.T) {
|
|||
httpmock.StatusStringResponse(201, "{}"))
|
||||
},
|
||||
opts: &EditOptions{
|
||||
AddFilename: "/Users/octocat/foo.txt",
|
||||
},
|
||||
wantParams: map[string]interface{}{
|
||||
"description": "",
|
||||
"updated_at": "0001-01-01T00:00:00Z",
|
||||
"public": false,
|
||||
"files": map[string]interface{}{
|
||||
"foo.txt": map[string]interface{}{
|
||||
"content": "new content to existing gist",
|
||||
"filename": "foo.txt",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "add file to existing gist with relative path",
|
||||
gist: &shared.Gist{
|
||||
ID: "1234",
|
||||
Files: map[string]*shared.GistFile{
|
||||
"sample.txt": {
|
||||
Filename: "sample.txt",
|
||||
Content: "bwhiizzzbwhuiiizzzz",
|
||||
Type: "text/plain",
|
||||
},
|
||||
},
|
||||
Owner: &shared.GistOwner{Login: "octocat"},
|
||||
},
|
||||
httpStubs: func(reg *httpmock.Registry) {
|
||||
reg.Register(httpmock.REST("POST", "gists/1234"),
|
||||
httpmock.StatusStringResponse(201, "{}"))
|
||||
},
|
||||
opts: &EditOptions{
|
||||
AddFilename: "../foo.txt",
|
||||
},
|
||||
wantParams: map[string]interface{}{
|
||||
"description": "",
|
||||
"updated_at": "0001-01-01T00:00:00Z",
|
||||
"public": false,
|
||||
"files": map[string]interface{}{
|
||||
"foo.txt": map[string]interface{}{
|
||||
"content": "new content to existing gist",
|
||||
"filename": "foo.txt",
|
||||
},
|
||||
},
|
||||
AddFilename: "../fixture.txt",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -338,10 +295,6 @@ func Test_editRun(t *testing.T) {
|
|||
return "new file content", nil
|
||||
}
|
||||
|
||||
tt.opts.Add = func(_, _ string, _ *iostreams.IOStreams) (string, error) {
|
||||
return "new content to existing gist", nil
|
||||
}
|
||||
|
||||
tt.opts.HttpClient = func() (*http.Client, error) {
|
||||
return &http.Client{Transport: reg}, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue