diff options
Diffstat (limited to 'api4/channel_test.go')
-rw-r--r-- | api4/channel_test.go | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/api4/channel_test.go b/api4/channel_test.go index c8faf7aa1..0f11edebc 100644 --- a/api4/channel_test.go +++ b/api4/channel_test.go @@ -91,10 +91,10 @@ func TestCreateChannel(t *testing.T) { }() *utils.Cfg.TeamSettings.RestrictPublicChannelCreation = model.PERMISSIONS_ALL *utils.Cfg.TeamSettings.RestrictPrivateChannelCreation = model.PERMISSIONS_ALL - utils.SetDefaultRolesBasedOnConfig() utils.IsLicensed = true utils.License = &model.License{Features: &model.Features{}} utils.License.Features.SetDefaults() + utils.SetDefaultRolesBasedOnConfig() channel.Name = GenerateTestChannelName() _, resp = Client.CreateChannel(channel) @@ -160,6 +160,19 @@ func TestCreateChannel(t *testing.T) { _, resp = th.SystemAdminClient.CreateChannel(private) CheckNoError(t, resp) + // Check that if unlicensed the policy restriction is not enforced. + utils.IsLicensed = false + utils.License = nil + utils.SetDefaultRolesBasedOnConfig() + + channel.Name = GenerateTestChannelName() + _, resp = Client.CreateChannel(channel) + CheckNoError(t, resp) + + private.Name = GenerateTestChannelName() + _, resp = Client.CreateChannel(private) + CheckNoError(t, resp) + if r, err := Client.DoApiPost("/channels", "garbage"); err == nil { t.Fatal("should have errored") } else { |