-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscreenshots_test.go
62 lines (49 loc) · 1.18 KB
/
screenshots_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package models
/*
func TestScreeenshots(t *testing.T) {
convey.Convey("Should Create Screenshot", t, func() {
c := Client{Path: config.Get().DB.TestFile}
err := c.Open()
convey.So(err, convey.ShouldEqual, nil)
defer c.DB.Close()
testUser := User{
UserName: "admin",
}
err = testUser.Create(c.DB)
convey.So(err, convey.ShouldEqual, nil)
testData := Screenshot{
UserID: "admin",
Timestamp: time.Now(),
URL: "//placehold.it/700x700",
}
//err = testData.Create(c.DB)
//convey.So(err, convey.ShouldEqual, nil)
convey.Convey("Should return Screenshots", func() {
var result []Screenshot
result, err = testData.GetTodaysScreenshots(c.DB, "admin")
convey.So(err, convey.ShouldEqual, nil)
convey.So(result, convey.ShouldNotBeEmpty)
t.Log(result)
})
tx, err := c.DB.Begin(true)
if err != nil {
log.Println(err)
}
defer tx.Rollback()
b := tx.Bucket([]byte(constants.USER_BUCKET))
recur(b, 5)
})
}
func recur(buk *bolt.Bucket, level int) {
if buk == nil {
return
}
c := buk.Cursor()
for k, v := c.First(); k != nil; k, v = c.Next() {
fmt.Printf("%s:%s\n", k, v)
if v == nil {
recur(buk.Bucket(k), level+1)
}
}
}
*/