Fixes get --show-all

This commit is contained in:
Fabiano Franz
2015-12-03 17:32:22 -02:00
parent a45c87864e
commit 717896eae3
5 changed files with 126 additions and 21 deletions

View File

@@ -589,6 +589,29 @@ func TestGetMultipleTypeObjectsWithDirectReference(t *testing.T) {
t.Errorf("unexpected empty output")
}
}
func TestGetByNameForcesFlag(t *testing.T) {
pods, _, _ := testData()
f, tf, codec := NewAPIFactory()
tf.Printer = &testPrinter{}
tf.Client = &fake.RESTClient{
Codec: codec,
Resp: &http.Response{StatusCode: 200, Body: objBody(codec, &pods.Items[0])},
}
tf.Namespace = "test"
buf := bytes.NewBuffer([]byte{})
cmd := NewCmdGet(f, buf)
cmd.SetOutput(buf)
cmd.Run(cmd, []string{"pods", "foo"})
showAllFlag, _ := cmd.Flags().GetBool("show-all")
if !showAllFlag {
t.Errorf("expected showAll to be true when getting resource by name")
}
}
func watchTestData() ([]api.Pod, []watch.Event) {
pods := []api.Pod{
{