Add '-o name' to mutations

This commit is contained in:
Janet Kuo
2015-07-01 15:47:43 -07:00
parent a171d2e4fb
commit 0e42d0699a
27 changed files with 241 additions and 56 deletions

View File

@@ -59,10 +59,11 @@ func TestCreateObject(t *testing.T) {
cmd := NewCmdCreate(f, buf)
cmd.Flags().Set("filename", "../../../examples/guestbook/redis-master-controller.yaml")
cmd.Flags().Set("output", "name")
cmd.Run(cmd, []string{})
// uses the name from the file, not the response
if buf.String() != "replicationcontrollers/redis-master-controller\n" {
if buf.String() != "replicationcontroller/redis-master-controller\n" {
t.Errorf("unexpected output: %s", buf.String())
}
}
@@ -92,10 +93,11 @@ func TestCreateMultipleObject(t *testing.T) {
cmd := NewCmdCreate(f, buf)
cmd.Flags().Set("filename", "../../../examples/guestbook/redis-master-controller.yaml")
cmd.Flags().Set("filename", "../../../examples/guestbook/frontend-service.yaml")
cmd.Flags().Set("output", "name")
cmd.Run(cmd, []string{})
// Names should come from the REST response, NOT the files
if buf.String() != "replicationcontrollers/rc1\nservices/baz\n" {
if buf.String() != "replicationcontroller/rc1\nservice/baz\n" {
t.Errorf("unexpected output: %s", buf.String())
}
}
@@ -125,9 +127,10 @@ func TestCreateDirectory(t *testing.T) {
cmd := NewCmdCreate(f, buf)
cmd.Flags().Set("filename", "../../../examples/guestbook")
cmd.Flags().Set("output", "name")
cmd.Run(cmd, []string{})
if buf.String() != "replicationcontrollers/name\nservices/baz\nreplicationcontrollers/name\nservices/baz\nreplicationcontrollers/name\nservices/baz\n" {
if buf.String() != "replicationcontroller/name\nservice/baz\nreplicationcontroller/name\nservice/baz\nreplicationcontroller/name\nservice/baz\n" {
t.Errorf("unexpected output: %s", buf.String())
}
}