mirror of
https://git.vectorsigma.ru/public/photoview.git
synced 2026-08-03 20:49:02 +00:00
Add failing test for #198
This commit is contained in:
36
api/test_utils/scanner_helpers.go
Normal file
36
api/test_utils/scanner_helpers.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package test_utils
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/photoview/photoview/api/graphql/models"
|
||||
"github.com/photoview/photoview/api/scanner"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func RunScannerOnUser(t *testing.T, db *gorm.DB, user *models.User) {
|
||||
if !assert.NoError(t, scanner.InitializeScannerQueue(db)) {
|
||||
return
|
||||
}
|
||||
|
||||
if !assert.NoError(t, scanner.AddUserToQueue(user)) {
|
||||
return
|
||||
}
|
||||
|
||||
// wait for all jobs to finish
|
||||
scanner.CloseScannerQueue()
|
||||
}
|
||||
|
||||
func RunScannerAll(t *testing.T, db *gorm.DB) {
|
||||
if !assert.NoError(t, scanner.InitializeScannerQueue(db)) {
|
||||
return
|
||||
}
|
||||
|
||||
if !assert.NoError(t, scanner.AddAllToQueue()) {
|
||||
return
|
||||
}
|
||||
|
||||
// wait for all jobs to finish
|
||||
scanner.CloseScannerQueue()
|
||||
}
|
||||
Reference in New Issue
Block a user