summaryrefslogtreecommitdiffstats
path: root/api/post_test.go
diff options
context:
space:
mode:
authorGeorge Goldberg <george@gberg.me>2018-02-13 13:35:52 +0000
committerGeorge Goldberg <george@gberg.me>2018-02-13 13:46:01 +0000
commit5c101253c5987743cf1b3a8fe68814d748070622 (patch)
treee2632505d051e7d15d6daf974ed8ac92095f82fe /api/post_test.go
parentb7fc3d7d35ca4dd16097715a66463392a1dfaf0a (diff)
parentd88d2bc2ed3aefa68b5ed2942f493ae42bb40bfa (diff)
downloadchat-5c101253c5987743cf1b3a8fe68814d748070622.tar.gz
chat-5c101253c5987743cf1b3a8fe68814d748070622.tar.bz2
chat-5c101253c5987743cf1b3a8fe68814d748070622.zip
Merge branch 'master' into advanced-permissions-phase-1
Diffstat (limited to 'api/post_test.go')
-rw-r--r--api/post_test.go24
1 files changed, 3 insertions, 21 deletions
diff --git a/api/post_test.go b/api/post_test.go
index b88c733db..7a2367312 100644
--- a/api/post_test.go
+++ b/api/post_test.go
@@ -160,18 +160,8 @@ func TestCreatePost(t *testing.T) {
}
}
- isLicensed := utils.IsLicensed()
- license := utils.License()
- disableTownSquareReadOnly := th.App.Config().TeamSettings.ExperimentalTownSquareIsReadOnly
- defer func() {
- th.App.UpdateConfig(func(cfg *model.Config) { cfg.TeamSettings.ExperimentalTownSquareIsReadOnly = disableTownSquareReadOnly })
- utils.SetIsLicensed(isLicensed)
- utils.SetLicense(license)
- }()
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.ExperimentalTownSquareIsReadOnly = true })
- utils.SetIsLicensed(true)
- utils.SetLicense(&model.License{Features: &model.Features{}})
- utils.License().Features.SetDefaults()
+ th.App.SetLicense(model.NewTestLicense())
defaultChannel := store.Must(th.App.Srv.Store.Channel().GetByName(team.Id, model.DEFAULT_CHANNEL, true)).(*model.Channel)
defaultPost := &model.Post{
@@ -400,6 +390,7 @@ func TestUpdatePost(t *testing.T) {
defer func() {
th.RestoreDefaultRolePermissions(defaultRolePermissions)
}()
+ th.App.SetLicense(model.NewTestLicense())
th.AddPermissionToRole(model.PERMISSION_EDIT_POST.Id, model.CHANNEL_USER_ROLE_ID)
@@ -470,17 +461,8 @@ func TestUpdatePost(t *testing.T) {
}
// Test licensed policy controls for edit post
- isLicensed := utils.IsLicensed()
- license := utils.License()
- defer func() {
- utils.SetIsLicensed(isLicensed)
- utils.SetLicense(license)
- }()
- utils.SetIsLicensed(true)
- utils.SetLicense(&model.License{Features: &model.Features{}})
- utils.License().Features.SetDefaults()
-
th.RemovePermissionFromRole(model.PERMISSION_EDIT_POST.Id, model.CHANNEL_USER_ROLE_ID)
+
post4 := &model.Post{ChannelId: channel1.Id, Message: "zz" + model.NewId() + "a", RootId: rpost1.Data.(*model.Post).Id}
rpost4, err := Client.CreatePost(post4)
if err != nil {