fix TestGetTags test, was missing scope and ctx

This commit is contained in:
Christoph Kluge 2024-08-05 10:19:00 +02:00
parent 2551921ed6
commit e6ebec8c1e
2 changed files with 15 additions and 1 deletions

View File

@ -5,9 +5,11 @@
package repository package repository
import ( import (
"context"
"fmt" "fmt"
"testing" "testing"
"github.com/ClusterCockpit/cc-backend/pkg/schema"
_ "github.com/mattn/go-sqlite3" _ "github.com/mattn/go-sqlite3"
) )
@ -45,7 +47,19 @@ func TestFindById(t *testing.T) {
func TestGetTags(t *testing.T) { func TestGetTags(t *testing.T) {
r := setup(t) r := setup(t)
tags, counts, err := r.CountTags(nil) const contextUserKey ContextKey = "user"
contextUserValue := &schema.User{
Username: "testuser",
Projects: make([]string, 0),
Roles: []string{"user"},
AuthType: 0,
AuthSource: 2,
}
ctx := context.WithValue(getContext(t), contextUserKey, contextUserValue)
// Test Tag has Scope "global"
tags, counts, err := r.CountTags(ctx)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }

Binary file not shown.