tests: split test to check public team discovery in two runs
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
Daniel Herrmann 2024-03-10 14:03:33 +01:00
parent 25f0c0480c
commit 4b72a28f04
1 changed files with 12 additions and 4 deletions

View File

@ -149,7 +149,7 @@ func TestTeam_ReadAll(t *testing.T) {
assert.Len(t, ts, 1)
assert.Equal(t, int64(2), ts[0].ID)
})
t.Run("public", func(t *testing.T) {
t.Run("public discovery disabled", func(t *testing.T) {
s := db.NewSession()
defer s.Close()
@ -173,16 +173,24 @@ func TestTeam_ReadAll(t *testing.T) {
assert.Equal(t, reflect.Slice, reflect.TypeOf(teams).Kind())
ts = teams.([]*Team)
assert.Len(t, ts, 5)
})
t.Run("public discovery enabled", func(t *testing.T) {
s := db.NewSession()
defer s.Close()
team := &Team{}
// Enable ServiceEnablePublicTeams feature
config.ServiceEnablePublicTeams.Set(true)
// Fetch without public flag should still be the same
// Fetch without public flag should be the same as before
team.IncludePublic = false
teams, _, _, err = team.ReadAll(s, doer, "", 1, 50)
teams, _, _, err := team.ReadAll(s, doer, "", 1, 50)
require.NoError(t, err)
assert.Equal(t, reflect.Slice, reflect.TypeOf(teams).Kind())
ts = teams.([]*Team)
ts := teams.([]*Team)
assert.Len(t, ts, 5)
// Fetch with public flag should return more teams