mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Identify: Options to skip multiple results and single name performers (#3707)
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
@@ -31,9 +31,10 @@ func Test_getPerformerID(t *testing.T) {
|
||||
}).Return(nil)
|
||||
|
||||
type args struct {
|
||||
endpoint string
|
||||
p *models.ScrapedPerformer
|
||||
createMissing bool
|
||||
endpoint string
|
||||
p *models.ScrapedPerformer
|
||||
createMissing bool
|
||||
skipSingleName bool
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
@@ -47,6 +48,7 @@ func Test_getPerformerID(t *testing.T) {
|
||||
emptyEndpoint,
|
||||
&models.ScrapedPerformer{},
|
||||
false,
|
||||
false,
|
||||
},
|
||||
nil,
|
||||
false,
|
||||
@@ -59,6 +61,7 @@ func Test_getPerformerID(t *testing.T) {
|
||||
StoredID: &invalidStoredID,
|
||||
},
|
||||
false,
|
||||
false,
|
||||
},
|
||||
nil,
|
||||
true,
|
||||
@@ -71,6 +74,7 @@ func Test_getPerformerID(t *testing.T) {
|
||||
StoredID: &validStoredIDStr,
|
||||
},
|
||||
false,
|
||||
false,
|
||||
},
|
||||
&validStoredID,
|
||||
false,
|
||||
@@ -83,6 +87,7 @@ func Test_getPerformerID(t *testing.T) {
|
||||
Name: &name,
|
||||
},
|
||||
false,
|
||||
false,
|
||||
},
|
||||
nil,
|
||||
false,
|
||||
@@ -93,10 +98,24 @@ func Test_getPerformerID(t *testing.T) {
|
||||
emptyEndpoint,
|
||||
&models.ScrapedPerformer{},
|
||||
true,
|
||||
false,
|
||||
},
|
||||
nil,
|
||||
false,
|
||||
},
|
||||
{
|
||||
"single name no disambig creating",
|
||||
args{
|
||||
emptyEndpoint,
|
||||
&models.ScrapedPerformer{
|
||||
Name: &name,
|
||||
},
|
||||
true,
|
||||
true,
|
||||
},
|
||||
nil,
|
||||
true,
|
||||
},
|
||||
{
|
||||
"valid name creating",
|
||||
args{
|
||||
@@ -105,6 +124,7 @@ func Test_getPerformerID(t *testing.T) {
|
||||
Name: &name,
|
||||
},
|
||||
true,
|
||||
false,
|
||||
},
|
||||
&validStoredID,
|
||||
false,
|
||||
@@ -112,7 +132,7 @@ func Test_getPerformerID(t *testing.T) {
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got, err := getPerformerID(testCtx, tt.args.endpoint, &mockPerformerReaderWriter, tt.args.p, tt.args.createMissing)
|
||||
got, err := getPerformerID(testCtx, tt.args.endpoint, &mockPerformerReaderWriter, tt.args.p, tt.args.createMissing, tt.args.skipSingleName)
|
||||
if (err != nil) != tt.wantErr {
|
||||
t.Errorf("getPerformerID() error = %v, wantErr %v", err, tt.wantErr)
|
||||
return
|
||||
@@ -207,7 +227,7 @@ func Test_scrapedToPerformerInput(t *testing.T) {
|
||||
name := "name"
|
||||
|
||||
var stringValues []string
|
||||
for i := 0; i < 17; i++ {
|
||||
for i := 0; i < 20; i++ {
|
||||
stringValues = append(stringValues, strconv.Itoa(i))
|
||||
}
|
||||
|
||||
@@ -240,44 +260,50 @@ func Test_scrapedToPerformerInput(t *testing.T) {
|
||||
{
|
||||
"set all",
|
||||
&models.ScrapedPerformer{
|
||||
Name: &name,
|
||||
Birthdate: nextVal(),
|
||||
DeathDate: nextVal(),
|
||||
Gender: nextVal(),
|
||||
Ethnicity: nextVal(),
|
||||
Country: nextVal(),
|
||||
EyeColor: nextVal(),
|
||||
HairColor: nextVal(),
|
||||
Height: nextVal(),
|
||||
Weight: nextVal(),
|
||||
Measurements: nextVal(),
|
||||
FakeTits: nextVal(),
|
||||
CareerLength: nextVal(),
|
||||
Tattoos: nextVal(),
|
||||
Piercings: nextVal(),
|
||||
Aliases: nextVal(),
|
||||
Twitter: nextVal(),
|
||||
Instagram: nextVal(),
|
||||
Name: &name,
|
||||
Disambiguation: nextVal(),
|
||||
Birthdate: nextVal(),
|
||||
DeathDate: nextVal(),
|
||||
Gender: nextVal(),
|
||||
Ethnicity: nextVal(),
|
||||
Country: nextVal(),
|
||||
EyeColor: nextVal(),
|
||||
HairColor: nextVal(),
|
||||
Height: nextVal(),
|
||||
Weight: nextVal(),
|
||||
Measurements: nextVal(),
|
||||
FakeTits: nextVal(),
|
||||
CareerLength: nextVal(),
|
||||
Tattoos: nextVal(),
|
||||
Piercings: nextVal(),
|
||||
Aliases: nextVal(),
|
||||
Twitter: nextVal(),
|
||||
Instagram: nextVal(),
|
||||
URL: nextVal(),
|
||||
Details: nextVal(),
|
||||
},
|
||||
models.Performer{
|
||||
Name: name,
|
||||
Birthdate: dateToDatePtr(models.NewDate(*nextVal())),
|
||||
DeathDate: dateToDatePtr(models.NewDate(*nextVal())),
|
||||
Gender: genderPtr(models.GenderEnum(*nextVal())),
|
||||
Ethnicity: *nextVal(),
|
||||
Country: *nextVal(),
|
||||
EyeColor: *nextVal(),
|
||||
HairColor: *nextVal(),
|
||||
Height: nextIntVal(),
|
||||
Weight: nextIntVal(),
|
||||
Measurements: *nextVal(),
|
||||
FakeTits: *nextVal(),
|
||||
CareerLength: *nextVal(),
|
||||
Tattoos: *nextVal(),
|
||||
Piercings: *nextVal(),
|
||||
Aliases: models.NewRelatedStrings([]string{*nextVal()}),
|
||||
Twitter: *nextVal(),
|
||||
Instagram: *nextVal(),
|
||||
Name: name,
|
||||
Disambiguation: *nextVal(),
|
||||
Birthdate: dateToDatePtr(models.NewDate(*nextVal())),
|
||||
DeathDate: dateToDatePtr(models.NewDate(*nextVal())),
|
||||
Gender: genderPtr(models.GenderEnum(*nextVal())),
|
||||
Ethnicity: *nextVal(),
|
||||
Country: *nextVal(),
|
||||
EyeColor: *nextVal(),
|
||||
HairColor: *nextVal(),
|
||||
Height: nextIntVal(),
|
||||
Weight: nextIntVal(),
|
||||
Measurements: *nextVal(),
|
||||
FakeTits: *nextVal(),
|
||||
CareerLength: *nextVal(),
|
||||
Tattoos: *nextVal(),
|
||||
Piercings: *nextVal(),
|
||||
Aliases: models.NewRelatedStrings([]string{*nextVal()}),
|
||||
Twitter: *nextVal(),
|
||||
Instagram: *nextVal(),
|
||||
URL: *nextVal(),
|
||||
Details: *nextVal(),
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user