refactor testapi and test scripts to prepare for multiple API groups.

This commit is contained in:
Chao Xu
2015-09-04 00:06:01 -07:00
parent 49702f9059
commit 9fc79e9d99
109 changed files with 1010 additions and 714 deletions

View File

@@ -36,11 +36,11 @@ type serverResponse struct {
func makeTestServer(t *testing.T, namespace string, serviceAccountResponse serverResponse) (*httptest.Server, *util.FakeHandler) {
fakeServiceAccountsHandler := util.FakeHandler{
StatusCode: serviceAccountResponse.statusCode,
ResponseBody: runtime.EncodeOrDie(testapi.Codec(), serviceAccountResponse.obj.(runtime.Object)),
ResponseBody: runtime.EncodeOrDie(testapi.Default.Codec(), serviceAccountResponse.obj.(runtime.Object)),
}
mux := http.NewServeMux()
mux.Handle(testapi.ResourcePath("serviceAccounts", namespace, ""), &fakeServiceAccountsHandler)
mux.Handle(testapi.Default.ResourcePath("serviceAccounts", namespace, ""), &fakeServiceAccountsHandler)
mux.HandleFunc("/", func(res http.ResponseWriter, req *http.Request) {
t.Errorf("unexpected request: %v", req.RequestURI)
res.WriteHeader(http.StatusNotFound)