2024-02-12 04:52:41 +08:00
|
|
|
package services
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2024-08-31 23:50:17 +08:00
|
|
|
"github.com/tgdrive/teldrive/internal/database"
|
2024-02-12 04:52:41 +08:00
|
|
|
|
|
|
|
"github.com/stretchr/testify/suite"
|
2024-08-31 23:50:17 +08:00
|
|
|
"github.com/tgdrive/teldrive/pkg/models"
|
2024-02-12 04:52:41 +08:00
|
|
|
"gorm.io/gorm"
|
|
|
|
)
|
|
|
|
|
|
|
|
type UploadServiceSuite struct {
|
|
|
|
suite.Suite
|
|
|
|
db *gorm.DB
|
|
|
|
srv *UploadService
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *UploadServiceSuite) SetupSuite() {
|
|
|
|
s.db = database.NewTestDatabase(s.T(), false)
|
2024-07-26 23:50:26 +08:00
|
|
|
s.srv = NewUploadService(s.db, nil, nil, nil, nil)
|
2024-02-12 04:52:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *UploadServiceSuite) SetupTest() {
|
|
|
|
s.srv.db.Where("id is not NULL").Delete(&models.Upload{})
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestUploadSuite(t *testing.T) {
|
|
|
|
suite.Run(t, new(UploadServiceSuite))
|
|
|
|
}
|