Index: service/rawdatastore/datastore_test.go |
diff --git a/helper/datastore_test.go b/service/rawdatastore/datastore_test.go |
similarity index 86% |
rename from helper/datastore_test.go |
rename to service/rawdatastore/datastore_test.go |
index 31372b6e60e4420c5beb5fb929e3dac5d76e2cce..462fe7cfac382ea5e6c20ac429050da0031821b7 100644 |
--- a/helper/datastore_test.go |
+++ b/service/rawdatastore/datastore_test.go |
@@ -4,7 +4,7 @@ |
// adapted from github.com/golang/appengine/datastore |
-package helper |
+package rawdatastore |
import ( |
"bytes" |
@@ -17,13 +17,13 @@ import ( |
"testing" |
"time" |
- "github.com/luci/gae" |
+ "github.com/luci/gae/service/blobstore" |
. "github.com/smartystreets/goconvey/convey" |
) |
var ( |
- mp = gae.MkDSProperty |
- mpNI = gae.MkDSPropertyNI |
+ mp = MkProperty |
+ mpNI = MkPropertyNI |
) |
const testAppID = "testApp" |
@@ -64,9 +64,9 @@ var ( |
testKey1b = mkKey("aid", "", "kind", "name1") |
testKey2a = mkKey("aid", "", "kind", "name0", "kind", "name2") |
testKey2b = mkKey("aid", "", "kind", "name0", "kind", "name2") |
- testGeoPt0 = gae.DSGeoPoint{Lat: 1.2, Lng: 3.4} |
- testGeoPt1 = gae.DSGeoPoint{Lat: 5, Lng: 10} |
- testBadGeoPt = gae.DSGeoPoint{Lat: 1000, Lng: 34} |
+ testGeoPt0 = GeoPoint{Lat: 1.2, Lng: 3.4} |
+ testGeoPt1 = GeoPoint{Lat: 5, Lng: 10} |
+ testBadGeoPt = GeoPoint{Lat: 1000, Lng: 34} |
) |
type B0 struct { |
@@ -90,7 +90,7 @@ type B4 struct { |
} |
type B5 struct { |
- B gae.DSByteString |
+ B ByteString |
} |
type C0 struct { |
@@ -115,19 +115,19 @@ type C3 struct { |
type E struct{} |
type G0 struct { |
- G gae.DSGeoPoint |
+ G GeoPoint |
} |
type G1 struct { |
- G []gae.DSGeoPoint |
+ G []GeoPoint |
} |
type K0 struct { |
- K gae.DSKey |
+ K Key |
} |
type K1 struct { |
- K []gae.DSKey |
+ K []Key |
} |
type N0 struct { |
@@ -319,21 +319,21 @@ type MutuallyRecursive1 struct { |
} |
type ExoticTypes struct { |
- BS gae.BSKey |
- DSBS gae.DSByteString |
+ BS blobstore.Key |
+ DSBS ByteString |
} |
type Underspecified struct { |
- Iface gae.DSPropertyConverter |
+ Iface PropertyConverter |
} |
type MismatchTypes struct { |
S string |
B bool |
F float32 |
- K gae.DSKey |
+ K Key |
T time.Time |
- G gae.DSGeoPoint |
+ G GeoPoint |
IS []int |
} |
@@ -348,11 +348,11 @@ type Doubler struct { |
B bool |
} |
-func (d *Doubler) Load(props gae.DSPropertyMap) error { |
+func (d *Doubler) Load(props PropertyMap) error { |
return GetPLS(d).Load(props) |
} |
-func (d *Doubler) Save(withMeta bool) (gae.DSPropertyMap, error) { |
+func (d *Doubler) Save(withMeta bool) (PropertyMap, error) { |
pls := GetPLS(d) |
propMap, err := pls.Save(withMeta) |
if err != nil { |
@@ -375,17 +375,17 @@ func (d *Doubler) Save(withMeta bool) (gae.DSPropertyMap, error) { |
return propMap, nil |
} |
-func (d *Doubler) GetMeta(string) (interface{}, error) { return nil, gae.ErrDSMetaFieldUnset } |
-func (d *Doubler) SetMeta(string, interface{}) error { return gae.ErrDSMetaFieldUnset } |
+func (d *Doubler) GetMeta(string) (interface{}, error) { return nil, ErrMetaFieldUnset } |
+func (d *Doubler) SetMeta(string, interface{}) error { return ErrMetaFieldUnset } |
func (d *Doubler) Problem() error { return nil } |
-var _ gae.DSPropertyLoadSaver = (*Doubler)(nil) |
+var _ PropertyLoadSaver = (*Doubler)(nil) |
type Deriver struct { |
S, Derived, Ignored string |
} |
-func (d *Deriver) Load(props gae.DSPropertyMap) error { |
+func (d *Deriver) Load(props PropertyMap) error { |
for name, p := range props { |
if name != "S" { |
continue |
@@ -396,36 +396,36 @@ func (d *Deriver) Load(props gae.DSPropertyMap) error { |
return nil |
} |
-func (d *Deriver) Save(withMeta bool) (gae.DSPropertyMap, error) { |
- return map[string][]gae.DSProperty{ |
+func (d *Deriver) Save(withMeta bool) (PropertyMap, error) { |
+ return map[string][]Property{ |
"S": {mp(d.S)}, |
}, nil |
} |
-func (d *Deriver) GetMeta(string) (interface{}, error) { return nil, gae.ErrDSMetaFieldUnset } |
-func (d *Deriver) SetMeta(string, interface{}) error { return gae.ErrDSMetaFieldUnset } |
+func (d *Deriver) GetMeta(string) (interface{}, error) { return nil, ErrMetaFieldUnset } |
+func (d *Deriver) SetMeta(string, interface{}) error { return ErrMetaFieldUnset } |
func (d *Deriver) Problem() error { return nil } |
-var _ gae.DSPropertyLoadSaver = (*Deriver)(nil) |
+var _ PropertyLoadSaver = (*Deriver)(nil) |
type BK struct { |
- Key gae.BSKey |
+ Key blobstore.Key |
} |
type Convertable []int64 |
-var _ gae.DSPropertyConverter = (*Convertable)(nil) |
+var _ PropertyConverter = (*Convertable)(nil) |
-func (c *Convertable) ToDSProperty() (ret gae.DSProperty, err error) { |
+func (c *Convertable) ToProperty() (ret Property, err error) { |
buf := make([]string, len(*c)) |
for i, v := range *c { |
buf[i] = strconv.FormatInt(v, 10) |
} |
- err = ret.SetValue(strings.Join(buf, ","), gae.NoIndex) |
+ err = ret.SetValue(strings.Join(buf, ","), NoIndex) |
return |
} |
-func (c *Convertable) FromDSProperty(pv gae.DSProperty) error { |
+func (c *Convertable) FromProperty(pv Property) error { |
if sval, ok := pv.Value().(string); ok { |
for _, t := range strings.Split(sval, ",") { |
ival, err := strconv.ParseInt(t, 10, 64) |
@@ -452,12 +452,12 @@ type Convertable2 struct { |
Exploded []string |
} |
-func (c *Convertable2) ToDSProperty() (ret gae.DSProperty, err error) { |
- err = ret.SetValue(c.Data, gae.ShouldIndex) |
+func (c *Convertable2) ToProperty() (ret Property, err error) { |
+ err = ret.SetValue(c.Data, ShouldIndex) |
return |
} |
-func (c *Convertable2) FromDSProperty(pv gae.DSProperty) error { |
+func (c *Convertable2) FromProperty(pv Property) error { |
if sval, ok := pv.Value().(string); ok { |
c.Data = sval |
c.Exploded = []string{"turn", "down", "for", "what"} |
@@ -476,18 +476,18 @@ type ImpossibleInner2 struct { |
type JSONKVProp map[string]interface{} |
-var _ gae.DSPropertyConverter = (*JSONKVProp)(nil) |
+var _ PropertyConverter = (*JSONKVProp)(nil) |
-func (j *JSONKVProp) ToDSProperty() (ret gae.DSProperty, err error) { |
+func (j *JSONKVProp) ToProperty() (ret Property, err error) { |
data, err := json.Marshal(map[string]interface{}(*j)) |
if err != nil { |
return |
} |
- err = ret.SetValue(data, gae.NoIndex) |
+ err = ret.SetValue(data, NoIndex) |
return |
} |
-func (j *JSONKVProp) FromDSProperty(pv gae.DSProperty) error { |
+func (j *JSONKVProp) FromProperty(pv Property) error { |
if bval, ok := pv.Value().([]byte); ok { |
dec := json.NewDecoder(bytes.NewBuffer(bval)) |
dec.UseNumber() |
@@ -502,19 +502,19 @@ type Impossible3 struct { |
type Complex complex128 |
-var _ gae.DSPropertyConverter = (*Complex)(nil) |
+var _ PropertyConverter = (*Complex)(nil) |
-func (c *Complex) ToDSProperty() (ret gae.DSProperty, err error) { |
+func (c *Complex) ToProperty() (ret Property, err error) { |
// cheat hardkore and usurp GeoPoint so datastore will index these suckers |
// (note that this won't REALLY work, since GeoPoints are limited to a very |
// limited range of values, but it's nice to pretend ;)). You'd probably |
// really end up with a packed binary representation. |
- err = ret.SetValue(gae.DSGeoPoint{Lat: real(*c), Lng: imag(*c)}, gae.ShouldIndex) |
+ err = ret.SetValue(GeoPoint{Lat: real(*c), Lng: imag(*c)}, ShouldIndex) |
return |
} |
-func (c *Complex) FromDSProperty(p gae.DSProperty) error { |
- if gval, ok := p.Value().(gae.DSGeoPoint); ok { |
+func (c *Complex) FromProperty(p Property) error { |
+ if gval, ok := p.Value().(GeoPoint); ok { |
*c = Complex(complex(gval.Lat, gval.Lng)) |
return nil |
} |
@@ -526,11 +526,11 @@ type Impossible4 struct { |
} |
type DerivedKey struct { |
- K *GenericDSKey |
+ K *GenericKey |
} |
type IfaceKey struct { |
- K gae.DSKey |
+ K Key |
} |
type testCase struct { |
@@ -596,14 +596,14 @@ var testCases = []testCase{ |
{ |
desc: "geopoint as props", |
src: &G0{G: testGeoPt0}, |
- want: gae.DSPropertyMap{ |
+ want: PropertyMap{ |
"G": {mp(testGeoPt0)}, |
}, |
}, |
{ |
desc: "geopoint slice", |
- src: &G1{G: []gae.DSGeoPoint{testGeoPt0, testGeoPt1}}, |
- want: &G1{G: []gae.DSGeoPoint{testGeoPt0, testGeoPt1}}, |
+ src: &G1{G: []GeoPoint{testGeoPt0, testGeoPt1}}, |
+ want: &G1{G: []GeoPoint{testGeoPt0, testGeoPt1}}, |
}, |
{ |
desc: "key", |
@@ -622,13 +622,13 @@ var testCases = []testCase{ |
}, |
{ |
desc: "all nil keys in slice", |
- src: &K1{[]gae.DSKey{nil, nil}}, |
- want: &K1{[]gae.DSKey{nil, nil}}, |
+ src: &K1{[]Key{nil, nil}}, |
+ want: &K1{[]Key{nil, nil}}, |
}, |
{ |
desc: "some nil keys in slice", |
- src: &K1{[]gae.DSKey{testKey1a, nil, testKey2a}}, |
- want: &K1{[]gae.DSKey{testKey1b, nil, testKey2b}}, |
+ src: &K1{[]Key{testKey1a, nil, testKey2a}}, |
+ want: &K1{[]Key{testKey1b, nil, testKey2b}}, |
}, |
{ |
desc: "overflow", |
@@ -644,7 +644,7 @@ var testCases = []testCase{ |
{ |
desc: "time as props", |
src: &T{T: time.Unix(1e9, 0).UTC()}, |
- want: gae.DSPropertyMap{ |
+ want: PropertyMap{ |
"T": {mp(time.Unix(1e9, 0).UTC())}, |
}, |
}, |
@@ -715,13 +715,13 @@ var testCases = []testCase{ |
{ |
desc: "use convertable slice (to map)", |
src: &Impossible{[]ImpossibleInner{{Convertable{1, 5, 9}}, {Convertable{2, 4, 6}}}}, |
- want: gae.DSPropertyMap{ |
+ want: PropertyMap{ |
"Nested.wot": {mpNI("1,5,9"), mpNI("2,4,6")}, |
}, |
}, |
{ |
desc: "convertable slice (bad load)", |
- src: gae.DSPropertyMap{"Nested.wot": {mpNI([]byte("ohai"))}}, |
+ src: PropertyMap{"Nested.wot": {mpNI([]byte("ohai"))}}, |
want: &Impossible{[]ImpossibleInner{{}}}, |
loadErr: "nope", |
}, |
@@ -764,7 +764,7 @@ var testCases = []testCase{ |
"what": []interface{}{"is", "really", 100}, |
}, |
}, |
- want: gae.DSPropertyMap{ |
+ want: PropertyMap{ |
"kewelmap": { |
mpNI([]byte( |
`{"epic":"success","no_way!":[true,"story"],"what":["is","really",100]}`))}, |
@@ -784,26 +784,26 @@ var testCases = []testCase{ |
src: &Impossible4{ |
[]Complex{complex(1, 2), complex(3, 4)}, |
}, |
- want: gae.DSPropertyMap{ |
+ want: PropertyMap{ |
"Values": { |
- mp(gae.DSGeoPoint{Lat: 1, Lng: 2}), mp(gae.DSGeoPoint{Lat: 3, Lng: 4})}, |
+ mp(GeoPoint{Lat: 1, Lng: 2}), mp(GeoPoint{Lat: 3, Lng: 4})}, |
}, |
}, |
{ |
desc: "convertable complex slice (bad load)", |
- src: gae.DSPropertyMap{"Values": {mp("hello")}}, |
+ src: PropertyMap{"Values": {mp("hello")}}, |
want: &Impossible4{[]Complex(nil)}, |
loadErr: "nope", |
}, |
{ |
- desc: "allow concrete gae.DSKey implementors (save)", |
- src: &DerivedKey{testKey2a.(*GenericDSKey)}, |
+ desc: "allow concrete Key implementors (save)", |
+ src: &DerivedKey{testKey2a.(*GenericKey)}, |
want: &IfaceKey{testKey2b}, |
}, |
{ |
- desc: "allow concrete gae.DSKey implementors (load)", |
+ desc: "allow concrete Key implementors (load)", |
src: &IfaceKey{testKey2b}, |
- want: &DerivedKey{testKey2a.(*GenericDSKey)}, |
+ want: &DerivedKey{testKey2a.(*GenericKey)}, |
}, |
{ |
desc: "save []float64 load []int64", |
@@ -879,20 +879,20 @@ var testCases = []testCase{ |
}}, |
}, |
{ |
- desc: "short gae.DSByteString", |
- src: &B5{B: gae.DSByteString(makeUint8Slice(3))}, |
- want: &B5{B: gae.DSByteString(makeUint8Slice(3))}, |
+ desc: "short ByteString", |
+ src: &B5{B: ByteString(makeUint8Slice(3))}, |
+ want: &B5{B: ByteString(makeUint8Slice(3))}, |
}, |
{ |
- desc: "short gae.DSByteString as props", |
- src: &B5{B: gae.DSByteString(makeUint8Slice(3))}, |
- want: gae.DSPropertyMap{ |
- "B": {mp(gae.DSByteString(makeUint8Slice(3)))}, |
+ desc: "short ByteString as props", |
+ src: &B5{B: ByteString(makeUint8Slice(3))}, |
+ want: PropertyMap{ |
+ "B": {mp(ByteString(makeUint8Slice(3)))}, |
}, |
}, |
{ |
desc: "[]byte must be noindex", |
- src: gae.DSPropertyMap{ |
+ src: PropertyMap{ |
"B": {mp(makeUint8Slice(3))}, |
}, |
actualNoIndex: true, |
@@ -900,7 +900,7 @@ var testCases = []testCase{ |
{ |
desc: "save tagged load props", |
src: &Tagged{A: 1, B: []int{21, 22, 23}, C: 3, D: 4, E: 5, I: 6, J: 7}, |
- want: gae.DSPropertyMap{ |
+ want: PropertyMap{ |
// A and B are renamed to a and b; A and C are noindex, I is ignored. |
// Indexed properties are loaded before raw properties. Thus, the |
// result is: b, b, b, D, E, a, c. |
@@ -923,7 +923,7 @@ var testCases = []testCase{ |
}, |
{ |
desc: "save props load tagged", |
- src: gae.DSPropertyMap{ |
+ src: PropertyMap{ |
"A": {mpNI(11)}, |
"a": {mpNI(12)}, |
}, |
@@ -964,14 +964,14 @@ var testCases = []testCase{ |
{ |
desc: "save struct load props", |
src: &X0{S: "s", I: 1}, |
- want: gae.DSPropertyMap{ |
+ want: PropertyMap{ |
"S": {mp("s")}, |
"I": {mp(1)}, |
}, |
}, |
{ |
desc: "save props load struct", |
- src: gae.DSPropertyMap{ |
+ src: PropertyMap{ |
"S": {mp("s")}, |
"I": {mp(1)}, |
}, |
@@ -979,7 +979,7 @@ var testCases = []testCase{ |
}, |
{ |
desc: "nil-value props", |
- src: gae.DSPropertyMap{ |
+ src: PropertyMap{ |
"I": {mp(nil)}, |
"B": {mp(nil)}, |
"S": {mp(nil)}, |
@@ -997,7 +997,7 @@ var testCases = []testCase{ |
B bool |
S string |
F float64 |
- K gae.DSKey |
+ K Key |
T time.Time |
J []int64 |
}{ |
@@ -1020,7 +1020,7 @@ var testCases = []testCase{ |
Z: true, |
}, |
}, |
- want: gae.DSPropertyMap{ |
+ want: PropertyMap{ |
"A": {mp(1)}, |
"I.W": { |
mp(10), |
@@ -1038,7 +1038,7 @@ var testCases = []testCase{ |
}, |
{ |
desc: "save props load outer-equivalent", |
- src: gae.DSPropertyMap{ |
+ src: PropertyMap{ |
"A": {mp(1)}, |
"I.W": { |
mp(10), |
@@ -1088,13 +1088,13 @@ var testCases = []testCase{ |
{ |
desc: "dotted names save", |
src: &Dotted{A: DottedA{B: DottedB{C: 88}}}, |
- want: gae.DSPropertyMap{ |
+ want: PropertyMap{ |
"A0.A1.A2.B3.C4.C5": {mp(88)}, |
}, |
}, |
{ |
desc: "dotted names load", |
- src: gae.DSPropertyMap{ |
+ src: PropertyMap{ |
"A0.A1.A2.B3.C4.C5": {mp(99)}, |
}, |
want: &Dotted{A: DottedA{B: DottedB{C: 99}}}, |
@@ -1160,11 +1160,11 @@ var testCases = []testCase{ |
desc: "exotic types", |
src: &ExoticTypes{ |
BS: "sup", |
- DSBS: gae.DSByteString("nerds"), |
+ DSBS: ByteString("nerds"), |
}, |
want: &ExoticTypes{ |
BS: "sup", |
- DSBS: gae.DSByteString("nerds"), |
+ DSBS: ByteString("nerds"), |
}, |
}, |
{ |
@@ -1174,47 +1174,47 @@ var testCases = []testCase{ |
}, |
{ |
desc: "mismatch (string)", |
- src: gae.DSPropertyMap{ |
+ src: PropertyMap{ |
"K": {mp(199)}, |
"S": {mp([]byte("cats"))}, |
- "F": {mp(gae.DSByteString("nurbs"))}, |
+ "F": {mp(ByteString("nurbs"))}, |
}, |
want: &MismatchTypes{}, |
loadErr: "type mismatch", |
}, |
{ |
desc: "mismatch (float)", |
- src: gae.DSPropertyMap{"F": {mp(gae.BSKey("wot"))}}, |
+ src: PropertyMap{"F": {mp(blobstore.Key("wot"))}}, |
want: &MismatchTypes{}, |
loadErr: "type mismatch", |
}, |
{ |
desc: "mismatch (float/overflow)", |
- src: gae.DSPropertyMap{"F": {mp(math.MaxFloat64)}}, |
+ src: PropertyMap{"F": {mp(math.MaxFloat64)}}, |
want: &MismatchTypes{}, |
loadErr: "overflows", |
}, |
{ |
desc: "mismatch (key)", |
- src: gae.DSPropertyMap{"K": {mp(false)}}, |
+ src: PropertyMap{"K": {mp(false)}}, |
want: &MismatchTypes{}, |
loadErr: "type mismatch", |
}, |
{ |
desc: "mismatch (bool)", |
- src: gae.DSPropertyMap{"B": {mp(testKey0)}}, |
+ src: PropertyMap{"B": {mp(testKey0)}}, |
want: &MismatchTypes{}, |
loadErr: "type mismatch", |
}, |
{ |
desc: "mismatch (time)", |
- src: gae.DSPropertyMap{"T": {mp(gae.DSGeoPoint{})}}, |
+ src: PropertyMap{"T": {mp(GeoPoint{})}}, |
want: &MismatchTypes{}, |
loadErr: "type mismatch", |
}, |
{ |
desc: "mismatch (geopoint)", |
- src: gae.DSPropertyMap{"G": {mp(time.Now().UTC())}}, |
+ src: PropertyMap{"G": {mp(time.Now().UTC())}}, |
want: &MismatchTypes{}, |
loadErr: "type mismatch", |
}, |
@@ -1325,7 +1325,7 @@ var testCases = []testCase{ |
}, |
}, |
}, |
- want: gae.DSPropertyMap{ |
+ want: PropertyMap{ |
"red.S": {mp("rouge")}, |
"red.I": {mp(0)}, |
"red.Nonymous.S": {mp("rosso0"), mp("rosso1")}, |
@@ -1345,7 +1345,7 @@ var testCases = []testCase{ |
}, |
{ |
desc: "save props load structs with ragged fields", |
- src: gae.DSPropertyMap{ |
+ src: PropertyMap{ |
"red.S": {mp("rot")}, |
"green.Nonymous.I": {mp(10), mp(11), mp(12), mp(13)}, |
"Blue.Nonymous.S": {mp("blau0"), mp("blau1"), mp("blau2")}, |
@@ -1384,7 +1384,7 @@ var testCases = []testCase{ |
Y string |
} |
}{}, |
- want: gae.DSPropertyMap{ |
+ want: PropertyMap{ |
"B.Y": {mp("")}, |
"A.X": {mpNI("")}, |
"A.Y": {mpNI("")}, |
@@ -1396,7 +1396,7 @@ var testCases = []testCase{ |
src: &struct { |
Inner1 `gae:"foo"` |
}{}, |
- want: gae.DSPropertyMap{ |
+ want: PropertyMap{ |
"foo.W": {mp(0)}, |
"foo.X": {mp("")}, |
}, |
@@ -1421,7 +1421,7 @@ var testCases = []testCase{ |
src: &struct { |
i, J int64 |
}{i: 1, J: 2}, |
- want: gae.DSPropertyMap{ |
+ want: PropertyMap{ |
"J": {mp(2)}, |
}, |
}, |
@@ -1432,7 +1432,7 @@ var testCases = []testCase{ |
}{ |
J: json.RawMessage("rawr"), |
}, |
- want: gae.DSPropertyMap{ |
+ want: PropertyMap{ |
"J": {mp([]byte("rawr"))}, |
}, |
}, |
@@ -1505,7 +1505,7 @@ func TestRoundTrip(t *testing.T) { |
for _, tc := range testCases { |
tc := tc |
Convey(tc.desc, func() { |
- pls, ok := tc.src.(gae.DSPropertyLoadSaver) |
+ pls, ok := tc.src.(PropertyLoadSaver) |
if !ok { |
pls = GetPLS(tc.src) |
} |
@@ -1522,19 +1522,19 @@ func TestRoundTrip(t *testing.T) { |
if tc.actualNoIndex { |
for _, props := range savedProps { |
- So(props[0].IndexSetting(), ShouldEqual, gae.NoIndex) |
+ So(props[0].IndexSetting(), ShouldEqual, NoIndex) |
return |
} |
So(true, ShouldBeFalse) // shouldn't get here |
} |
var got interface{} |
- if _, ok := tc.want.(gae.DSPropertyMap); ok { |
- pls = gae.DSPropertyMap{} |
+ if _, ok := tc.want.(PropertyMap); ok { |
+ pls = PropertyMap{} |
got = pls |
} else { |
got = reflect.New(reflect.TypeOf(tc.want).Elem()).Interface() |
- if pls, ok = got.(gae.DSPropertyLoadSaver); !ok { |
+ if pls, ok = got.(PropertyLoadSaver); !ok { |
pls = GetPLS(got) |
} |
} |
@@ -1584,7 +1584,7 @@ func TestSpecial(t *testing.T) { |
o := &N0{ID: 100} |
pls := GetPLS(o) |
_, err := pls.GetMeta("wat") |
- So(err, ShouldEqual, gae.ErrDSMetaFieldUnset) |
+ So(err, ShouldEqual, ErrMetaFieldUnset) |
}) |
Convey("getting/setting from a bad struct is an error", func() { |
@@ -1613,7 +1613,7 @@ func TestSpecial(t *testing.T) { |
So(err.Error(), ShouldContainSubstring, "unexported field") |
err = pls.SetMeta("noob", "hi") |
- So(err, ShouldEqual, gae.ErrDSMetaFieldUnset) |
+ So(err, ShouldEqual, ErrMetaFieldUnset) |
}) |
}) |
@@ -1636,7 +1636,7 @@ func TestSpecial(t *testing.T) { |
Convey("attempting to get a PLS for a non *struct is an error", func() { |
pls := GetPLS((*[]string)(nil)) |
- So(pls.Problem(), ShouldEqual, gae.ErrDSInvalidEntityType) |
+ So(pls.Problem(), ShouldEqual, ErrInvalidEntityType) |
}) |
Convey("convertible meta default types", func() { |
@@ -1664,9 +1664,9 @@ func TestSpecial(t *testing.T) { |
pls := GetPLS(&OKDefaults{}) |
pm, err := pls.Save(true) |
So(err, ShouldBeNil) |
- So(pm, ShouldResemble, gae.DSPropertyMap{ |
- "$when": {gae.MkDSPropertyNI("tomorrow")}, |
- "$amt": {gae.MkDSPropertyNI(100)}, |
+ So(pm, ShouldResemble, PropertyMap{ |
+ "$when": {mpNI("tomorrow")}, |
+ "$amt": {mpNI(100)}, |
}) |
v, err := pm.GetMeta("when") |