fonchain-fiee/pkg/service/artwork_test.go
2025-02-19 14:24:15 +08:00

679 lines
12 KiB
Go

package service
import (
"github.com/fonchain_enterprise/fonchain-main/api/artist"
"github.com/fonchain_enterprise/fonchain-main/pkg/model"
"github.com/gin-gonic/gin"
"reflect"
"testing"
)
func TestAuthData(t *testing.T) {
type args struct {
c *gin.Context
}
tests := []struct {
name string
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
AuthData(tt.args.c)
})
}
}
func TestAuthImg(t *testing.T) {
type args struct {
c *gin.Context
}
tests := []struct {
name string
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
AuthImg(tt.args.c)
})
}
}
func TestAwDetail(t *testing.T) {
type args struct {
c *gin.Context
}
tests := []struct {
name string
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
AwDetail(tt.args.c)
})
}
}
func TestAwList(t *testing.T) {
type args struct {
c *gin.Context
}
tests := []struct {
name string
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
AwList(tt.args.c)
})
}
}
func TestAwTagList(t *testing.T) {
type args struct {
c *gin.Context
}
tests := []struct {
name string
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
AwTagList(tt.args.c)
})
}
}
func TestAwTags(t *testing.T) {
type args struct {
c *gin.Context
}
tests := []struct {
name string
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
AwTags(tt.args.c)
})
}
}
func TestCatList(t *testing.T) {
type args struct {
c *gin.Context
}
tests := []struct {
name string
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
CatList(tt.args.c)
})
}
}
func TestCreateAwProfile(t *testing.T) {
type args struct {
c *gin.Context
}
tests := []struct {
name string
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
CreateAwProfile(tt.args.c)
})
}
}
func TestDelAuthData(t *testing.T) {
type args struct {
c *gin.Context
}
tests := []struct {
name string
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
DelAuthData(tt.args.c)
})
}
}
func TestDelAwProfile(t *testing.T) {
type args struct {
c *gin.Context
}
tests := []struct {
name string
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
DelAwProfile(tt.args.c)
})
}
}
func TestDelMarketData(t *testing.T) {
type args struct {
c *gin.Context
}
tests := []struct {
name string
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
DelMarketData(tt.args.c)
})
}
}
func TestDelStorageData(t *testing.T) {
type args struct {
c *gin.Context
}
tests := []struct {
name string
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
DelStorageData(tt.args.c)
})
}
}
func TestDelThirdParty(t *testing.T) {
type args struct {
c *gin.Context
}
tests := []struct {
name string
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
DelThirdParty(tt.args.c)
})
}
}
func TestDigiInfo(t *testing.T) {
type args struct {
c *gin.Context
}
tests := []struct {
name string
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
DigiInfo(tt.args.c)
})
}
}
func TestGetArtistInfoBYAwUuid(t *testing.T) {
type args struct {
artistUuid string
}
tests := []struct {
name string
args args
wantArtistInfo *artist.ArtistInfoResponse
wantErr bool
}{
{
args: args{artistUuid: "2f1e6f9c-bb09-42d8-9b1e-59ec5a7ec251"},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
gotArtistInfo, err := GetArtistInfoBYAwUuid(tt.args.artistUuid)
if (err != nil) != tt.wantErr {
t.Errorf("GetArtistInfoBYAwUuid() error = %v, wantErr %v", err, tt.wantErr)
return
}
if !reflect.DeepEqual(gotArtistInfo, tt.wantArtistInfo) {
t.Errorf("GetArtistInfoBYAwUuid() gotArtistInfo = %v, want %v", gotArtistInfo, tt.wantArtistInfo)
}
})
}
}
func TestGetFileChunkInfo(t *testing.T) {
type args struct {
c *gin.Context
}
tests := []struct {
name string
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
GetFileChunkInfo(tt.args.c)
})
}
}
func TestMarketInfo(t *testing.T) {
type args struct {
c *gin.Context
}
tests := []struct {
name string
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
MarketInfo(tt.args.c)
})
}
}
func TestMergeChunk(t *testing.T) {
type args struct {
chunkDst string
newDst string
fileName string
}
tests := []struct {
name string
args args
wantErr bool
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if err := MergeChunk(tt.args.chunkDst, tt.args.newDst, tt.args.fileName); (err != nil) != tt.wantErr {
t.Errorf("MergeChunk() error = %v, wantErr %v", err, tt.wantErr)
}
})
}
}
func TestRandomHash(t *testing.T) {
type args struct {
c *gin.Context
}
tests := []struct {
name string
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
RandomHash(tt.args.c)
})
}
}
func TestStorage(t *testing.T) {
type args struct {
c *gin.Context
}
tests := []struct {
name string
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Storage(tt.args.c)
})
}
}
func TestStorageInfo(t *testing.T) {
type args struct {
c *gin.Context
}
tests := []struct {
name string
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
StorageInfo(tt.args.c)
})
}
}
func TestThirdPartyList(t *testing.T) {
type args struct {
c *gin.Context
}
tests := []struct {
name string
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
ThirdPartyList(tt.args.c)
})
}
}
func TestTransferInfoList(t *testing.T) {
type args struct {
c *gin.Context
}
tests := []struct {
name string
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
TransferInfoList(tt.args.c)
})
}
}
func TestUpdateAwPriceRun(t *testing.T) {
type args struct {
c *gin.Context
}
tests := []struct {
name string
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
UpdateAwPriceRun(tt.args.c)
})
}
}
func TestUpdateAwProfile(t *testing.T) {
type args struct {
c *gin.Context
}
tests := []struct {
name string
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
UpdateAwProfile(tt.args.c)
})
}
}
func TestUpdateExtInfo(t *testing.T) {
type args struct {
c *gin.Context
}
tests := []struct {
name string
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
UpdateExtInfo(tt.args.c)
})
}
}
func TestUpdateMarketInfo(t *testing.T) {
type args struct {
c *gin.Context
}
tests := []struct {
name string
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
UpdateMarketInfo(tt.args.c)
})
}
}
func TestUpdateThirdParty(t *testing.T) {
type args struct {
c *gin.Context
}
tests := []struct {
name string
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
UpdateThirdParty(tt.args.c)
})
}
}
func TestUpdateTransferInfo(t *testing.T) {
type args struct {
c *gin.Context
}
tests := []struct {
name string
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
UpdateTransferInfo(tt.args.c)
})
}
}
func TestUploadChunk(t *testing.T) {
type args struct {
c *gin.Context
}
tests := []struct {
name string
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
UploadChunk(tt.args.c)
})
}
}
func Test_checkArtworkName(t *testing.T) {
type args struct {
artworkName string
}
tests := []struct {
name string
args args
wantArtworkId int32
wantArtworkUuid string
wantErr bool
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
gotArtworkId, gotArtworkUuid, err := checkArtworkName(tt.args.artworkName)
if (err != nil) != tt.wantErr {
t.Errorf("checkArtworkName() error = %v, wantErr %v", err, tt.wantErr)
return
}
if gotArtworkId != tt.wantArtworkId {
t.Errorf("checkArtworkName() gotArtworkId = %v, want %v", gotArtworkId, tt.wantArtworkId)
}
if gotArtworkUuid != tt.wantArtworkUuid {
t.Errorf("checkArtworkName() gotArtworkUuid = %v, want %v", gotArtworkUuid, tt.wantArtworkUuid)
}
})
}
}
func Test_checkArtworkTfnum(t *testing.T) {
type args struct {
Tfnum string
}
tests := []struct {
name string
args args
wantArtworkId int32
wantArtworkUuid string
wantErr bool
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
gotArtworkId, gotArtworkUuid, err := checkArtworkTfnum(tt.args.Tfnum)
if (err != nil) != tt.wantErr {
t.Errorf("checkArtworkTfnum() error = %v, wantErr %v", err, tt.wantErr)
return
}
if gotArtworkId != tt.wantArtworkId {
t.Errorf("checkArtworkTfnum() gotArtworkId = %v, want %v", gotArtworkId, tt.wantArtworkId)
}
if gotArtworkUuid != tt.wantArtworkUuid {
t.Errorf("checkArtworkTfnum() gotArtworkUuid = %v, want %v", gotArtworkUuid, tt.wantArtworkUuid)
}
})
}
}
func Test_checkChunk(t *testing.T) {
type args struct {
c *gin.Context
total int
chunkPath string
newDst string
useType int32
fileName string
}
tests := []struct {
name string
args args
wantResp *model.UploadChunkResp
wantErr bool
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
//gotResp, err := checkChunk(tt.args.c, tt.args.total, tt.args.chunkPath, tt.args.newDst, tt.args.useType, tt.args.fileName)
//if (err != nil) != tt.wantErr {
// t.Errorf("checkChunk() error = %v, wantErr %v", err, tt.wantErr)
// return
//}
//if !reflect.DeepEqual(gotResp, tt.wantResp) {
// t.Errorf("checkChunk() gotResp = %v, want %v", gotResp, tt.wantResp)
//}
})
}
}
func Test_getDirRecur(t *testing.T) {
type args struct {
filePath string
imgMap *map[string][]string
parentDir string
}
tests := []struct {
name string
args args
wantErr bool
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if err := getDirRecur(tt.args.filePath, tt.args.imgMap, tt.args.parentDir); (err != nil) != tt.wantErr {
t.Errorf("getDirRecur() error = %v, wantErr %v", err, tt.wantErr)
}
})
}
}
func Test_imgMatchUpdate(t *testing.T) {
type args struct {
useType int32
artworkUuid string
imgUrl string
fullFileAPath string
artworkName string
}
tests := []struct {
name string
args args
wantMsg string
wantErr bool
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
gotMsg, err := imgMatchUpdate(tt.args.useType, tt.args.artworkUuid, tt.args.imgUrl, tt.args.fullFileAPath, tt.args.artworkName)
if (err != nil) != tt.wantErr {
t.Errorf("imgMatchUpdate() error = %v, wantErr %v", err, tt.wantErr)
return
}
if gotMsg != tt.wantMsg {
t.Errorf("imgMatchUpdate() gotMsg = %v, want %v", gotMsg, tt.wantMsg)
}
})
}
}