(t *testing.T)
| 213 | } |
| 214 | |
| 215 | func TestNamespaceResetting(t *testing.T) { |
| 216 | namec := make(chan *string, 1) |
| 217 | c0 := aetesting.FakeSingleContext(t, "memcache", "Get", func(req *pb.MemcacheGetRequest, res *pb.MemcacheGetResponse) error { |
| 218 | namec <- req.NameSpace |
| 219 | return errRPC |
| 220 | }) |
| 221 | |
| 222 | // Check that wrapping c0 in a namespace twice works correctly. |
| 223 | c1, err := appengine.Namespace(c0, "A") |
| 224 | if err != nil { |
| 225 | t.Fatalf("appengine.Namespace: %v", err) |
| 226 | } |
| 227 | c2, err := appengine.Namespace(c1, "") // should act as the original context |
| 228 | if err != nil { |
| 229 | t.Fatalf("appengine.Namespace: %v", err) |
| 230 | } |
| 231 | |
| 232 | Get(c0, "key") |
| 233 | if ns := <-namec; ns != nil { |
| 234 | t.Errorf(`Get with c0: ns = %q, want nil`, *ns) |
| 235 | } |
| 236 | |
| 237 | Get(c1, "key") |
| 238 | if ns := <-namec; ns == nil { |
| 239 | t.Error(`Get with c1: ns = nil, want "A"`) |
| 240 | } else if *ns != "A" { |
| 241 | t.Errorf(`Get with c1: ns = %q, want "A"`, *ns) |
| 242 | } |
| 243 | |
| 244 | Get(c2, "key") |
| 245 | if ns := <-namec; ns != nil { |
| 246 | t.Errorf(`Get with c2: ns = %q, want nil`, *ns) |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | func TestGetMultiEmpty(t *testing.T) { |
| 251 | serviceCalled := false |
nothing calls this directly
no test coverage detected
searching dependent graphs…