Use name from server when displaying create/update

Allows generated names from files to be displayed so users can
interact with them.
This commit is contained in:
Clayton Coleman
2015-02-06 11:57:52 -05:00
parent bb6b332a8b
commit 52c6c60b15
8 changed files with 82 additions and 42 deletions

View File

@@ -26,6 +26,7 @@ import (
func TestCreateObject(t *testing.T) {
pods, _ := testData()
pods.Items[0].Name = "redis-master"
f, tf, codec := NewAPIFactory()
tf.Printer = &testPrinter{}
@@ -81,13 +82,15 @@ func TestCreateMultipleObject(t *testing.T) {
cmd.Flags().Set("filename", "../../../examples/guestbook/frontend-service.json")
cmd.Run(cmd, []string{})
if buf.String() != "redis-master\nfrontend\n" {
// Names should come from the REST response, NOT the files
if buf.String() != "foo\nbaz\n" {
t.Errorf("unexpected output: %s", buf.String())
}
}
func TestCreateDirectory(t *testing.T) {
pods, svc := testData()
pods.Items[0].Name = "redis-master"
f, tf, codec := NewAPIFactory()
tf.Printer = &testPrinter{}
@@ -114,7 +117,7 @@ func TestCreateDirectory(t *testing.T) {
cmd.Flags().Set("filename", "../../../examples/guestbook")
cmd.Run(cmd, []string{})
if buf.String() != "frontend-controller\nfrontend\nredis-master\nredis-master\nredis-slave-controller\nredisslave\n" {
if buf.String() != "baz\nbaz\nbaz\nredis-master\nbaz\nbaz\n" {
t.Errorf("unexpected output: %s", buf.String())
}
}