mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
Studio Tagger (#3510)
* Studio image and parent studio support in scene tagger * Refactor studio backend and add studio tagger --------- Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
65
pkg/models/model_scraped_item_test.go
Normal file
65
pkg/models/model_scraped_item_test.go
Normal file
@@ -0,0 +1,65 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func Test_scrapedToStudioInput(t *testing.T) {
|
||||
const name = "name"
|
||||
url := "url"
|
||||
remoteSiteID := "remoteSiteID"
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
studio *ScrapedStudio
|
||||
want *Studio
|
||||
}{
|
||||
{
|
||||
"set all",
|
||||
&ScrapedStudio{
|
||||
Name: name,
|
||||
URL: &url,
|
||||
RemoteSiteID: &remoteSiteID,
|
||||
},
|
||||
&Studio{
|
||||
Name: name,
|
||||
URL: url,
|
||||
StashIDs: NewRelatedStashIDs([]StashID{
|
||||
{
|
||||
StashID: remoteSiteID,
|
||||
},
|
||||
}),
|
||||
},
|
||||
},
|
||||
{
|
||||
"set none",
|
||||
&ScrapedStudio{
|
||||
Name: name,
|
||||
RemoteSiteID: &remoteSiteID,
|
||||
},
|
||||
&Studio{
|
||||
Name: name,
|
||||
StashIDs: NewRelatedStashIDs([]StashID{
|
||||
{
|
||||
StashID: remoteSiteID,
|
||||
},
|
||||
}),
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got := tt.studio.ToStudio("", nil)
|
||||
|
||||
assert.NotEqual(t, time.Time{}, got.CreatedAt)
|
||||
assert.NotEqual(t, time.Time{}, got.UpdatedAt)
|
||||
|
||||
got.CreatedAt = time.Time{}
|
||||
got.UpdatedAt = time.Time{}
|
||||
assert.Equal(t, tt.want, got)
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user