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

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

Issue 2353063004: Add "MkKeyContext" KeyContext generation function. (Closed)
Patch Set: Created 4 years, 3 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/datastore/key.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 LUCI Authors. All rights reserved. 1 // Copyright 2015 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be 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"
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 `field "NonSerializableField" has invali d type: complex64`) 389 `field "NonSerializableField" has invali d type: complex64`)
390 }) 390 })
391 }) 391 })
392 }) 392 })
393 } 393 }
394 394
395 func TestPopulateKey(t *testing.T) { 395 func TestPopulateKey(t *testing.T) {
396 t.Parallel() 396 t.Parallel()
397 397
398 Convey("Test PopulateKey", t, func() { 398 Convey("Test PopulateKey", t, func() {
399 » » k := KeyContext{"app", "namespace"}.NewKey("kind", "", 1337, nil ) 399 » » k := MkKeyContext("app", "namespace").NewKey("kind", "", 1337, n il)
400 400
401 Convey("Can set the key of a common struct.", func() { 401 Convey("Can set the key of a common struct.", func() {
402 var cs CommonStruct 402 var cs CommonStruct
403 403
404 So(PopulateKey(&cs, k), ShouldBeTrue) 404 So(PopulateKey(&cs, k), ShouldBeTrue)
405 So(cs.ID, ShouldEqual, 1337) 405 So(cs.ID, ShouldEqual, 1337)
406 }) 406 })
407 407
408 Convey("Will not set the value of a singleton struct.", func() { 408 Convey("Will not set the value of a singleton struct.", func() {
409 var ss SingletonStruct 409 var ss SingletonStruct
(...skipping 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after
1824 if err != nil { 1824 if err != nil {
1825 panic(fmt.Errorf("failed to find absolute path f or `%s`", sameLevelDir)) 1825 panic(fmt.Errorf("failed to find absolute path f or `%s`", sameLevelDir))
1826 } 1826 }
1827 1827
1828 ids, err := FindAndParseIndexYAML(abs) 1828 ids, err := FindAndParseIndexYAML(abs)
1829 So(err, ShouldBeNil) 1829 So(err, ShouldBeNil)
1830 So(ids[1].Kind, ShouldEqual, "Test Foo") 1830 So(ids[1].Kind, ShouldEqual, "Test Foo")
1831 }) 1831 })
1832 }) 1832 })
1833 } 1833 }
OLDNEW
« no previous file with comments | « service/datastore/context_test.go ('k') | service/datastore/key.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698