mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-10-22 01:23:49 +00:00
moving caching w/ TTL to its own package
This commit is contained in:
10
router/middleware/cache/repos_test.go
vendored
10
router/middleware/cache/repos_test.go
vendored
@@ -3,6 +3,7 @@ package cache
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/drone/drone/cache"
|
||||
"github.com/drone/drone/model"
|
||||
"github.com/franela/goblin"
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -13,13 +14,13 @@ func TestReposCache(t *testing.T) {
|
||||
g := goblin.Goblin(t)
|
||||
g.Describe("Repo List Cache", func() {
|
||||
|
||||
var c *gin.Context
|
||||
g.BeforeEach(func() {
|
||||
cache.Purge()
|
||||
c = new(gin.Context)
|
||||
cache.ToContext(c, cache.Default())
|
||||
})
|
||||
|
||||
g.It("should skip when no user session", func() {
|
||||
c := &gin.Context{}
|
||||
|
||||
Perms(c)
|
||||
|
||||
_, ok := c.Get("perm")
|
||||
@@ -27,9 +28,8 @@ func TestReposCache(t *testing.T) {
|
||||
})
|
||||
|
||||
g.It("should get repos from cache", func() {
|
||||
c := &gin.Context{}
|
||||
c.Set("user", fakeUser)
|
||||
set("repos/octocat", fakeRepos, 999)
|
||||
cache.SetRepos(c, fakeUser, fakeRepos)
|
||||
|
||||
Repos(c)
|
||||
|
||||
|
Reference in New Issue
Block a user