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

Unified Diff: service/rawdatastore/context_test.go

Issue 1259593005: Add 'user friendly' datastore API. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: 100% coverage of new code Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: service/rawdatastore/context_test.go
diff --git a/service/rawdatastore/context_test.go b/service/rawdatastore/context_test.go
deleted file mode 100644
index 391e6f4cef4527da649d39e95a96d2ed903ea446..0000000000000000000000000000000000000000
--- a/service/rawdatastore/context_test.go
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package rawdatastore
-
-import (
- "testing"
-
- "github.com/luci/gae/service/info"
- . "github.com/smartystreets/goconvey/convey"
- "golang.org/x/net/context"
-)
-
-type fakeInfo struct{ info.Interface }
-
-func (fakeInfo) GetNamespace() string { return "ns" }
-func (fakeInfo) AppID() string { return "aid" }
-
-type fakeService struct{ Interface }
-
-type fakeFilt struct{ Interface }
-
-func (fakeFilt) NewKey(kind, stringID string, intID int64, parent Key) Key {
- return NewKey("aid", "ns", kind, stringID, intID, parent)
-}
-
-func TestServices(t *testing.T) {
- t.Parallel()
-
- Convey("Test service interfaces", t, func() {
- c := context.Background()
- Convey("without adding anything", func() {
- So(Get(c), ShouldBeNil)
- })
-
- Convey("adding a basic implementation", func() {
- c = Set(info.Set(c, fakeInfo{}), fakeService{})
-
- Convey("lets you pull them back out", func() {
- So(Get(c), ShouldResemble, &checkFilter{fakeService{}, "aid", "ns"})
- })
-
- Convey("and lets you add filters", func() {
- c = AddFilters(c, func(ic context.Context, rds Interface) Interface {
- return fakeFilt{rds}
- })
-
- k := Get(c).NewKey("Kind", "", 1, nil)
- So(KeysEqual(k, NewKey("aid", "ns", "Kind", "", 1, nil)), ShouldBeTrue)
- })
- })
- Convey("adding zero filters does nothing", func() {
- So(AddFilters(c), ShouldEqual, c)
- })
- })
-}

Powered by Google App Engine
This is Rietveld 408576698