Updating unit tests for pkg/client so that they pass with v1beta3 api
This commit is contained in:
@@ -21,6 +21,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/testapi"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/fields"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
|
||||
)
|
||||
@@ -33,7 +34,7 @@ func TestNamespaceCreate(t *testing.T) {
|
||||
c := &testClient{
|
||||
Request: testRequest{
|
||||
Method: "POST",
|
||||
Path: "/namespaces",
|
||||
Path: testapi.ResourcePath("namespaces", "", ""),
|
||||
Body: namespace,
|
||||
},
|
||||
Response: Response{StatusCode: 200, Body: namespace},
|
||||
@@ -58,7 +59,7 @@ func TestNamespaceGet(t *testing.T) {
|
||||
c := &testClient{
|
||||
Request: testRequest{
|
||||
Method: "GET",
|
||||
Path: "/namespaces/foo",
|
||||
Path: testapi.ResourcePath("namespaces", "", "foo"),
|
||||
Body: nil,
|
||||
},
|
||||
Response: Response{StatusCode: 200, Body: namespace},
|
||||
@@ -86,7 +87,7 @@ func TestNamespaceList(t *testing.T) {
|
||||
c := &testClient{
|
||||
Request: testRequest{
|
||||
Method: "GET",
|
||||
Path: "/namespaces",
|
||||
Path: testapi.ResourcePath("namespaces", "", ""),
|
||||
Body: nil,
|
||||
},
|
||||
Response: Response{StatusCode: 200, Body: namespaceList},
|
||||
@@ -122,7 +123,9 @@ func TestNamespaceUpdate(t *testing.T) {
|
||||
},
|
||||
}
|
||||
c := &testClient{
|
||||
Request: testRequest{Method: "PUT", Path: "/namespaces/foo"},
|
||||
Request: testRequest{
|
||||
Method: "PUT",
|
||||
Path: testapi.ResourcePath("namespaces", "", "foo")},
|
||||
Response: Response{StatusCode: 200, Body: requestNamespace},
|
||||
}
|
||||
receivedNamespace, err := c.Setup().Namespaces().Update(requestNamespace)
|
||||
@@ -144,7 +147,10 @@ func TestNamespaceFinalize(t *testing.T) {
|
||||
},
|
||||
}
|
||||
c := &testClient{
|
||||
Request: testRequest{Method: "PUT", Path: "/namespaces/foo/finalize"},
|
||||
Request: testRequest{
|
||||
Method: "PUT",
|
||||
Path: testapi.ResourcePath("namespaces", "", "foo") + "/finalize",
|
||||
},
|
||||
Response: Response{StatusCode: 200, Body: requestNamespace},
|
||||
}
|
||||
receivedNamespace, err := c.Setup().Namespaces().Finalize(requestNamespace)
|
||||
@@ -153,7 +159,7 @@ func TestNamespaceFinalize(t *testing.T) {
|
||||
|
||||
func TestNamespaceDelete(t *testing.T) {
|
||||
c := &testClient{
|
||||
Request: testRequest{Method: "DELETE", Path: "/namespaces/foo"},
|
||||
Request: testRequest{Method: "DELETE", Path: testapi.ResourcePath("namespaces", "", "foo")},
|
||||
Response: Response{StatusCode: 200},
|
||||
}
|
||||
err := c.Setup().Namespaces().Delete("foo")
|
||||
@@ -162,7 +168,10 @@ func TestNamespaceDelete(t *testing.T) {
|
||||
|
||||
func TestNamespaceWatch(t *testing.T) {
|
||||
c := &testClient{
|
||||
Request: testRequest{Method: "GET", Path: "/watch/namespaces", Query: url.Values{"resourceVersion": []string{}}},
|
||||
Request: testRequest{
|
||||
Method: "GET",
|
||||
Path: "/api/" + testapi.Version() + "/watch/namespaces",
|
||||
Query: url.Values{"resourceVersion": []string{}}},
|
||||
Response: Response{StatusCode: 200},
|
||||
}
|
||||
_, err := c.Setup().Namespaces().Watch(labels.Everything(), fields.Everything(), "")
|
||||
|
Reference in New Issue
Block a user