support editing before creating resource

This commit is contained in:
ymqytw
2016-09-21 16:41:07 -07:00
parent 192e18e2bb
commit c641834bb3
5 changed files with 117 additions and 30 deletions

View File

@@ -29,9 +29,10 @@ import (
func TestExtraArgsFail(t *testing.T) {
initTestErrorHandler(t)
buf := bytes.NewBuffer([]byte{})
errBuf := bytes.NewBuffer([]byte{})
f, _, _, _ := cmdtesting.NewAPIFactory()
c := NewCmdCreate(f, buf)
c := NewCmdCreate(f, buf, errBuf)
if ValidateArgs(c, []string{"rc"}) == nil {
t.Errorf("unexpected non-error")
}
@@ -59,8 +60,9 @@ func TestCreateObject(t *testing.T) {
}
tf.Namespace = "test"
buf := bytes.NewBuffer([]byte{})
errBuf := bytes.NewBuffer([]byte{})
cmd := NewCmdCreate(f, buf)
cmd := NewCmdCreate(f, buf, errBuf)
cmd.Flags().Set("filename", "../../../examples/guestbook/legacy/redis-master-controller.yaml")
cmd.Flags().Set("output", "name")
cmd.Run(cmd, []string{})
@@ -94,8 +96,9 @@ func TestCreateMultipleObject(t *testing.T) {
}
tf.Namespace = "test"
buf := bytes.NewBuffer([]byte{})
errBuf := bytes.NewBuffer([]byte{})
cmd := NewCmdCreate(f, buf)
cmd := NewCmdCreate(f, buf, errBuf)
cmd.Flags().Set("filename", "../../../examples/guestbook/legacy/redis-master-controller.yaml")
cmd.Flags().Set("filename", "../../../examples/guestbook/frontend-service.yaml")
cmd.Flags().Set("output", "name")
@@ -129,8 +132,9 @@ func TestCreateDirectory(t *testing.T) {
}
tf.Namespace = "test"
buf := bytes.NewBuffer([]byte{})
errBuf := bytes.NewBuffer([]byte{})
cmd := NewCmdCreate(f, buf)
cmd := NewCmdCreate(f, buf, errBuf)
cmd.Flags().Set("filename", "../../../examples/guestbook/legacy")
cmd.Flags().Set("output", "name")
cmd.Run(cmd, []string{})