Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: service/datastore/datastore_test.go

Issue 1916463004: impl/memory: Disallow empty namespace. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/gae@master
Patch Set: Rbase. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « service/datastore/context_test.go ('k') | service/info/interface.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // adapted from github.com/golang/appengine/datastore 5 // adapted from github.com/golang/appengine/datastore
6 6
7 package datastore 7 package datastore
8 8
9 import ( 9 import (
10 "bytes" 10 "bytes"
11 "fmt" 11 "fmt"
12 "io/ioutil" 12 "io/ioutil"
13 "os" 13 "os"
14 "path/filepath" 14 "path/filepath"
15 "runtime" 15 "runtime"
16 "testing" 16 "testing"
17 17
18 "github.com/luci/gae/service/info" 18 "github.com/luci/gae/service/info"
19 "github.com/luci/luci-go/common/errors" 19 "github.com/luci/luci-go/common/errors"
20 . "github.com/luci/luci-go/common/testing/assertions" 20 . "github.com/luci/luci-go/common/testing/assertions"
21 . "github.com/smartystreets/goconvey/convey" 21 . "github.com/smartystreets/goconvey/convey"
22 "golang.org/x/net/context" 22 "golang.org/x/net/context"
23 ) 23 )
24 24
25 func fakeDatastoreFactory(c context.Context, wantTxn bool) RawInterface { 25 func fakeDatastoreFactory(c context.Context, wantTxn bool) RawInterface {
26 i := info.Get(c) 26 i := info.Get(c)
27 » return &fakeDatastore{ 27 » fds := fakeDatastore{
28 aid: i.FullyQualifiedAppID(), 28 aid: i.FullyQualifiedAppID(),
29 ns: i.GetNamespace(),
30 } 29 }
30 fds.ns, _ = i.GetNamespace()
31 return &fds
31 } 32 }
32 33
33 type fakeDatastore struct { 34 type fakeDatastore struct {
34 RawInterface 35 RawInterface
35 aid string 36 aid string
36 ns string 37 ns string
37 } 38 }
38 39
39 func (f *fakeDatastore) mkKey(elems ...interface{}) *Key { 40 func (f *fakeDatastore) mkKey(elems ...interface{}) *Key {
40 return MakeKey(f.aid, f.ns, elems...) 41 return MakeKey(f.aid, f.ns, elems...)
(...skipping 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after
1577 if err != nil { 1578 if err != nil {
1578 panic(fmt.Errorf("failed to find absolute path f or `%s`", sameLevelDir)) 1579 panic(fmt.Errorf("failed to find absolute path f or `%s`", sameLevelDir))
1579 } 1580 }
1580 1581
1581 ids, err := FindAndParseIndexYAML(abs) 1582 ids, err := FindAndParseIndexYAML(abs)
1582 So(err, ShouldBeNil) 1583 So(err, ShouldBeNil)
1583 So(ids[1].Kind, ShouldEqual, "Test Foo") 1584 So(ids[1].Kind, ShouldEqual, "Test Foo")
1584 }) 1585 })
1585 }) 1586 })
1586 } 1587 }
OLDNEW
« no previous file with comments | « service/datastore/context_test.go ('k') | service/info/interface.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698