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

Side by Side Diff: appengine/cmd/dm/mutate/ensure_quest_attempts_test.go

Issue 1537883002: Initial distributor implementation (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: self review Created 4 years, 6 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
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 package mutate 5 package mutate
6 6
7 import ( 7 import (
8 "testing" 8 "testing"
9 9
10 "github.com/luci/gae/service/datastore" 10 "github.com/luci/gae/service/datastore"
11 "github.com/luci/luci-go/appengine/cmd/dm/model" 11 "github.com/luci/luci-go/appengine/cmd/dm/model"
12 "github.com/luci/luci-go/appengine/tumble" 12 "github.com/luci/luci-go/appengine/tumble"
13 "github.com/luci/luci-go/common/api/dm/service/v1" 13 "github.com/luci/luci-go/common/api/dm/service/v1"
14 //. "github.com/luci/luci-go/common/testing/assertions" 14 //. "github.com/luci/luci-go/common/testing/assertions"
15 . "github.com/smartystreets/goconvey/convey" 15 . "github.com/smartystreets/goconvey/convey"
16 ) 16 )
17 17
18 func TestEnsureQuestAttempts(t *testing.T) { 18 func TestEnsureQuestAttempts(t *testing.T) {
19 t.Parallel() 19 t.Parallel()
20 20
21 Convey("EnsureQuestAttempts", t, func() { 21 Convey("EnsureQuestAttempts", t, func() {
22 ttest := &tumble.Testing{} 22 ttest := &tumble.Testing{}
23 c := ttest.Context() 23 c := ttest.Context()
24 ds := datastore.Get(c) 24 ds := datastore.Get(c)
25 25
26 » » desc := dm.NewQuestDesc("distributor", `{"data":"yes"}`) 26 » » desc := dm.NewQuestDesc("distributor", `{"data":"yes"}`, nil)
27 » » qst, err := model.NewQuest(c, desc) 27 » » So(desc.Normalize(), ShouldBeNil)
28 » » So(err, ShouldBeNil) 28 » » qst := model.NewQuest(c, desc)
29 29
30 eqa := EnsureQuestAttempts{qst, []uint32{1, 2, 3, 4}, false} 30 eqa := EnsureQuestAttempts{qst, []uint32{1, 2, 3, 4}, false}
31 31
32 Convey("root", func() { 32 Convey("root", func() {
33 So(eqa.Root(c), ShouldResemble, ds.MakeKey("Quest", qst. ID)) 33 So(eqa.Root(c), ShouldResemble, ds.MakeKey("Quest", qst. ID))
34 }) 34 })
35 35
36 Convey("quest dne", func() { 36 Convey("quest dne", func() {
37 muts, err := eqa.RollForward(c) 37 muts, err := eqa.RollForward(c)
38 So(err, ShouldBeNil) 38 So(err, ShouldBeNil)
(...skipping 19 matching lines...) Expand all
58 &EnsureAttempt{dm.NewAttemptID(qst.ID, 7)}, 58 &EnsureAttempt{dm.NewAttemptID(qst.ID, 7)},
59 &EnsureAttempt{dm.NewAttemptID(qst.ID, 8)}, 59 &EnsureAttempt{dm.NewAttemptID(qst.ID, 8)},
60 &EnsureAttempt{dm.NewAttemptID(qst.ID, 9)}, 60 &EnsureAttempt{dm.NewAttemptID(qst.ID, 9)},
61 &EnsureAttempt{dm.NewAttemptID(qst.ID, 10)}, 61 &EnsureAttempt{dm.NewAttemptID(qst.ID, 10)},
62 &EnsureAttempt{dm.NewAttemptID(qst.ID, 11)}, 62 &EnsureAttempt{dm.NewAttemptID(qst.ID, 11)},
63 &EnsureQuestAttempts{qst, []uint32{12}, true}, 63 &EnsureQuestAttempts{qst, []uint32{12}, true},
64 }) 64 })
65 }) 65 })
66 }) 66 })
67 } 67 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698