ocr is working
This commit is contained in:
@@ -26,13 +26,18 @@ func (s stubEngine) ExtractText(_ context.Context, _ string, _ string) (string,
|
||||
return s.text, nil
|
||||
}
|
||||
|
||||
// newTestOcr builds an Ocr over a fresh DB and returns it with the ids.
|
||||
// newTestOcr builds an Ocr over a fresh DB, starts the bounded worker (1
|
||||
// worker) and returns it with the ids.
|
||||
func newTestOcr(t *testing.T, uploadDir string, engine ocr.Engine) (*Ocr, string, string, string) {
|
||||
t.Helper()
|
||||
s := newServiceStore(t)
|
||||
userID := mustCreateUser(t, s.Repository, "ocr-failed")
|
||||
deviceID := mustRegisterDevice(t, s.Repository, repository.NewID())
|
||||
return NewOcr(s.Repository, uploadDir, "fra+eng", engine), userID, deviceID, uploadDir
|
||||
o := NewOcr(s.Repository, uploadDir, "fra+eng", engine)
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
go o.Run(ctx, 1)
|
||||
t.Cleanup(cancel)
|
||||
return o, userID, deviceID, uploadDir
|
||||
}
|
||||
|
||||
// waitTillTerminal poll jusqu'à un statut terminal (done/failed).
|
||||
|
||||
Reference in New Issue
Block a user