make testclient more precise

This commit is contained in:
deads2k
2015-08-03 09:21:11 -04:00
parent 4271f28548
commit 182885e897
33 changed files with 1004 additions and 401 deletions

View File

@@ -37,8 +37,8 @@ func TestAdmissionDeny(t *testing.T) {
func testAdmission(t *testing.T, pod *api.Pod, shouldAccept bool) {
mockClient := &testclient.Fake{
ReactFn: func(action testclient.FakeAction) (runtime.Object, error) {
if action.Action == "get-pod" && action.Value.(string) == pod.Name {
ReactFn: func(action testclient.Action) (runtime.Object, error) {
if action.Matches("get", "pods") && action.(testclient.GetAction).GetName() == pod.Name {
return pod, nil
}
t.Errorf("Unexpected API call: %#v", action)

View File

@@ -49,7 +49,7 @@ func TestAdmission(t *testing.T) {
if len(actions) != 1 {
t.Errorf("Expected a create-namespace request")
}
if actions[0].Action != "create-namespace" {
if !actions[0].Matches("create", "namespaces") {
t.Errorf("Expected a create-namespace request to be made via the client")
}
}