OLD | NEW |
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 // +build appengine | 5 // +build appengine |
6 | 6 |
7 package prod | 7 package prod |
8 | 8 |
9 import ( | 9 import ( |
10 "testing" | 10 "testing" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 118 |
119 ret := TestStruct{ID: orig.ID} | 119 ret := TestStruct{ID: orig.ID} |
120 So(ds.Get(&ret), ShouldBeNil) | 120 So(ds.Get(&ret), ShouldBeNil) |
121 So(ret, ShouldResemble, orig) | 121 So(ret, ShouldResemble, orig) |
122 | 122 |
123 // can't be sure the indexes have caught up... so sleep | 123 // can't be sure the indexes have caught up... so sleep |
124 time.Sleep(time.Second) | 124 time.Sleep(time.Second) |
125 | 125 |
126 Convey("Can query", func() { | 126 Convey("Can query", func() { |
127 q := datastore.NewQuery("TestStruct") | 127 q := datastore.NewQuery("TestStruct") |
128 » » » » ds.Run(q, func(ts *TestStruct, _ datastore.Curso
rCB) bool { | 128 » » » » ds.Run(q, func(ts *TestStruct) { |
129 So(*ts, ShouldResemble, orig) | 129 So(*ts, ShouldResemble, orig) |
130 return true | |
131 }) | 130 }) |
132 count, err := ds.Count(q) | 131 count, err := ds.Count(q) |
133 So(err, ShouldBeNil) | 132 So(err, ShouldBeNil) |
134 So(count, ShouldEqual, 1) | 133 So(count, ShouldEqual, 1) |
135 }) | 134 }) |
136 | 135 |
137 Convey("Can project", func() { | 136 Convey("Can project", func() { |
138 q := datastore.NewQuery("TestStruct").Project("V
alueS") | 137 q := datastore.NewQuery("TestStruct").Project("V
alueS") |
139 rslts := []datastore.PropertyMap{} | 138 rslts := []datastore.PropertyMap{} |
140 So(ds.GetAll(q, &rslts), ShouldBeNil) | 139 So(ds.GetAll(q, &rslts), ShouldBeNil) |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 So(tval, ShouldResemble, pm["Time"][0].Value()) | 209 So(tval, ShouldResemble, pm["Time"][0].Value()) |
211 | 210 |
212 ent := datastore.PropertyMap{ | 211 ent := datastore.PropertyMap{ |
213 "$key": {mpNI(ds.MakeKey("Something", "value"))}
, | 212 "$key": {mpNI(ds.MakeKey("Something", "value"))}
, |
214 } | 213 } |
215 So(ds.Get(&ent), ShouldBeNil) | 214 So(ds.Get(&ent), ShouldBeNil) |
216 So(ent["Time"], ShouldResemble, pm["Time"]) | 215 So(ent["Time"], ShouldResemble, pm["Time"]) |
217 }) | 216 }) |
218 }) | 217 }) |
219 } | 218 } |
OLD | NEW |