func TestRESTUpdate(t *testing.T) { _, rest := NewTestREST() eventA := testEvent("foo") _, err := rest.Create(api.NewDefaultContext(), eventA) if err != nil { t.Fatalf("Unexpected error %v", err) } got, err := rest.Get(api.NewDefaultContext(), eventA.Name) if err != nil { t.Fatalf("Unexpected error %v", err) } if e, a := eventA, got; !reflect.DeepEqual(e, a) { t.Errorf("diff: %s", util.ObjectDiff(e, a)) } eventB := testEvent("bar") _, _, err = rest.Update(api.NewDefaultContext(), eventB) if err != nil { t.Fatalf("Unexpected error %v", err) } got2, err := rest.Get(api.NewDefaultContext(), eventB.Name) if err != nil { t.Fatalf("Unexpected error %v", err) } if e, a := eventB, got2; !reflect.DeepEqual(e, a) { t.Errorf("diff: %s", util.ObjectDiff(e, a)) } }
func TestRESTGet(t *testing.T) { _, rest := NewTestREST() secretA := testSecret("foo") _, err := rest.Create(api.NewDefaultContext(), secretA) if err != nil { t.Fatalf("Unexpected error %v", err) } got, err := rest.Get(api.NewDefaultContext(), secretA.Name) if err != nil { t.Fatalf("Unexpected error %v", err) } if e, a := secretA, got; !reflect.DeepEqual(e, a) { t.Errorf("diff: %s", util.ObjectDiff(e, a)) } }