kubectl describe <kind> work with no arguments

Add describe_resource_assert to test describe <kind> with no object arg
This commit is contained in:
feihujiang
2015-08-04 15:12:29 +08:00
parent 2bfa9a1f98
commit 73b694e6c1
6 changed files with 66 additions and 2 deletions

View File

@@ -81,3 +81,22 @@ func TestDescribeObject(t *testing.T) {
t.Errorf("unexpected output: %s", buf.String())
}
}
func TestDescribeListObjects(t *testing.T) {
pods, _, _ := testData()
f, tf, codec := NewAPIFactory()
d := &testDescriber{Output: "test output"}
tf.Describer = d
tf.Client = &client.FakeRESTClient{
Codec: codec,
Resp: &http.Response{StatusCode: 200, Body: objBody(codec, pods)},
}
tf.Namespace = "test"
buf := bytes.NewBuffer([]byte{})
cmd := NewCmdDescribe(f, buf)
cmd.Run(cmd, []string{"pods"})
if buf.String() != fmt.Sprintf("%s\n\n%s\n\n", d.Output, d.Output) {
t.Errorf("unexpected output: %s", buf.String())
}
}