Update tests to handle codec changes

This commit is contained in:
Clayton Coleman
2016-01-22 00:06:52 -05:00
parent 2fd38a7dc0
commit 33085c0cf2
34 changed files with 147 additions and 181 deletions

View File

@@ -212,7 +212,7 @@ func TestCreatePods(t *testing.T) {
Spec: controllerSpec.Spec.Template.Spec,
}
fakeHandler.ValidateRequest(t, testapi.Default.ResourcePath("pods", api.NamespaceDefault, ""), "POST", nil)
actualPod, err := client.Codec.Decode([]byte(fakeHandler.RequestBody))
actualPod, err := runtime.Decode(client.Codec, []byte(fakeHandler.RequestBody))
if err != nil {
t.Errorf("Unexpected error: %#v", err)
}

View File

@@ -275,8 +275,9 @@ func TestExampleObjects(t *testing.T) {
}
for name, scenario := range scenarios {
o := testclient.NewObjects(api.Scheme, api.Scheme)
if err := testclient.AddObjectsFromPath("../../../docs/user-guide/persistent-volumes/"+name, o, api.Scheme); err != nil {
codec := api.Codecs.UniversalDecoder()
o := testclient.NewObjects(api.Scheme, codec)
if err := testclient.AddObjectsFromPath("../../../docs/user-guide/persistent-volumes/"+name, o, codec); err != nil {
t.Fatal(err)
}
@@ -332,11 +333,12 @@ func TestExampleObjects(t *testing.T) {
}
func TestBindingWithExamples(t *testing.T) {
o := testclient.NewObjects(api.Scheme, api.Scheme)
if err := testclient.AddObjectsFromPath("../../../docs/user-guide/persistent-volumes/claims/claim-01.yaml", o, api.Scheme); err != nil {
codec := api.Codecs.UniversalDecoder()
o := testclient.NewObjects(api.Scheme, codec)
if err := testclient.AddObjectsFromPath("../../../docs/user-guide/persistent-volumes/claims/claim-01.yaml", o, codec); err != nil {
t.Fatal(err)
}
if err := testclient.AddObjectsFromPath("../../../docs/user-guide/persistent-volumes/volumes/local-01.yaml", o, api.Scheme); err != nil {
if err := testclient.AddObjectsFromPath("../../../docs/user-guide/persistent-volumes/volumes/local-01.yaml", o, codec); err != nil {
t.Fatal(err)
}