Updating unit tests for pkg/client so that they pass with v1beta3 api

This commit is contained in:
nikhiljindal
2015-03-24 16:40:18 -07:00
parent f584069573
commit ba3746172f
10 changed files with 780 additions and 581 deletions

View File

@@ -1,5 +1,5 @@
/*
Copyright 2014 Google Inc. All rights reserved.
Copyright 2015 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -32,19 +32,19 @@ func TestEventSearch(t *testing.T) {
c := &testClient{
Request: testRequest{
Method: "GET",
Path: "/events",
Path: testapi.ResourcePath("events", "baz", ""),
Query: url.Values{
"fields": []string{
"involvedObject.kind=Pod,",
api.FieldSelectorQueryParam(testapi.Version()): []string{
getInvolvedObjectNameFieldLabel(testapi.Version()) + "=foo,",
"involvedObject.namespace=baz",
"involvedObject.namespace=baz,",
"involvedObject.kind=Pod",
},
"labels": []string{},
api.LabelSelectorQueryParam(testapi.Version()): []string{},
},
},
Response: Response{StatusCode: 200, Body: &api.EventList{}},
}
eventList, err := c.Setup().Events("").Search(
eventList, err := c.Setup().Events("baz").Search(
&api.Pod{
ObjectMeta: api.ObjectMeta{
Name: "foo",
@@ -78,13 +78,13 @@ func TestEventCreate(t *testing.T) {
c := &testClient{
Request: testRequest{
Method: "POST",
Path: "/events",
Path: testapi.ResourcePath("events", api.NamespaceDefault, ""),
Body: event,
},
Response: Response{StatusCode: 200, Body: event},
}
response, err := c.Setup().Events("").Create(event)
response, err := c.Setup().Events(api.NamespaceDefault).Create(event)
if err != nil {
t.Fatalf("%v should be nil.", err)
@@ -117,13 +117,13 @@ func TestEventGet(t *testing.T) {
c := &testClient{
Request: testRequest{
Method: "GET",
Path: "/events/1",
Path: testapi.ResourcePath("events", "other", "1"),
Body: nil,
},
Response: Response{StatusCode: 200, Body: event},
}
response, err := c.Setup().Events("").Get("1")
response, err := c.Setup().Events("other").Get("1")
if err != nil {
t.Fatalf("%v should be nil.", err)
@@ -158,7 +158,7 @@ func TestEventList(t *testing.T) {
c := &testClient{
Request: testRequest{
Method: "GET",
Path: "/events",
Path: testapi.ResourcePath("events", ns, ""),
Body: nil,
},
Response: Response{StatusCode: 200, Body: eventList},
@@ -184,7 +184,10 @@ func TestEventList(t *testing.T) {
func TestEventDelete(t *testing.T) {
ns := api.NamespaceDefault
c := &testClient{
Request: testRequest{Method: "DELETE", Path: "/events/foo"},
Request: testRequest{
Method: "DELETE",
Path: testapi.ResourcePath("events", ns, "foo"),
},
Response: Response{StatusCode: 200},
}
err := c.Setup().Events(ns).Delete("foo")