diff options
author | guillep2k <18600385+guillep2k@users.noreply.github.com> | 2019-08-24 09:28:59 -0300 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2019-08-24 15:28:59 +0300 |
commit | e3115cc019211fa2549f6943d379bf58fe7b7d7d (patch) | |
tree | 050115e3cdf4e0334d081459312f711e55f4ea86 /models/org_test.go | |
parent | f83db078f0603c775cd1b1bb016f996b65a04835 (diff) | |
download | gitea-e3115cc019211fa2549f6943d379bf58fe7b7d7d.tar.gz gitea-e3115cc019211fa2549f6943d379bf58fe7b7d7d.zip |
Add support for DEFAULT_ORG_MEMBER_VISIBLE (#7669)
* Add support for DEFAULT_ORG_MEMBER_VISIBLE
* Correct formatting
* Improved description in cheat sheet.
* Add test for DefaultOrgMemberVisible
* Remove dead code
Diffstat (limited to 'models/org_test.go')
-rw-r--r-- | models/org_test.go | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/models/org_test.go b/models/org_test.go index a2ebf1f60b..6c1c4fee0e 100644 --- a/models/org_test.go +++ b/models/org_test.go @@ -7,6 +7,7 @@ package models import ( "testing" + "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/structs" "github.com/stretchr/testify/assert" @@ -429,20 +430,28 @@ func TestChangeOrgUserStatus(t *testing.T) { func TestAddOrgUser(t *testing.T) { assert.NoError(t, PrepareTestDatabase()) - testSuccess := func(orgID, userID int64) { + testSuccess := func(orgID, userID int64, isPublic bool) { org := AssertExistsAndLoadBean(t, &User{ID: orgID}).(*User) expectedNumMembers := org.NumMembers if !BeanExists(t, &OrgUser{OrgID: orgID, UID: userID}) { expectedNumMembers++ } assert.NoError(t, AddOrgUser(orgID, userID)) - AssertExistsAndLoadBean(t, &OrgUser{OrgID: orgID, UID: userID}) + ou := &OrgUser{OrgID: orgID, UID: userID} + AssertExistsAndLoadBean(t, ou) + assert.Equal(t, ou.IsPublic, isPublic) org = AssertExistsAndLoadBean(t, &User{ID: orgID}).(*User) assert.EqualValues(t, expectedNumMembers, org.NumMembers) } - testSuccess(3, 5) - testSuccess(3, 5) - testSuccess(6, 2) + + setting.Service.DefaultOrgMemberVisible = false + testSuccess(3, 5, false) + testSuccess(3, 5, false) + testSuccess(6, 2, false) + + setting.Service.DefaultOrgMemberVisible = true + testSuccess(6, 3, true) + CheckConsistencyFor(t, &User{}, &Team{}) } |