mirror of
				https://github.com/ClusterCockpit/cc-backend
				synced 2025-10-30 23:45:06 +01:00 
			
		
		
		
	fix TestGetTags test, was missing scope and ctx
This commit is contained in:
		| @@ -5,9 +5,11 @@ | ||||
| package repository | ||||
|  | ||||
| import ( | ||||
| 	"context" | ||||
| 	"fmt" | ||||
| 	"testing" | ||||
|  | ||||
| 	"github.com/ClusterCockpit/cc-backend/pkg/schema" | ||||
| 	_ "github.com/mattn/go-sqlite3" | ||||
| ) | ||||
|  | ||||
| @@ -45,7 +47,19 @@ func TestFindById(t *testing.T) { | ||||
| func TestGetTags(t *testing.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 { | ||||
| 		t.Fatal(err) | ||||
| 	} | ||||
|   | ||||
							
								
								
									
										
											BIN
										
									
								
								internal/repository/testdata/job.db
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								internal/repository/testdata/job.db
									
									
									
									
										vendored
									
									
								
							
										
											Binary file not shown.
										
									
								
							
		Reference in New Issue
	
	Block a user