summaryrefslogtreecommitdiffstats
path: root/store/sql_preference_store_test.go
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2015-11-15 18:18:02 -0800
committer=Corey Hulen <corey@hulen.com>2015-11-16 11:34:29 -0800
commit03c6dcbd865e2af2db5db150189504bfa493ae2e (patch)
tree360d2ece83de79d3df338d581216e4282b420209 /store/sql_preference_store_test.go
parent48d2f86b90b3e0b02cb28f3e8b6e4d454f9cb869 (diff)
downloadchat-03c6dcbd865e2af2db5db150189504bfa493ae2e.tar.gz
chat-03c6dcbd865e2af2db5db150189504bfa493ae2e.tar.bz2
chat-03c6dcbd865e2af2db5db150189504bfa493ae2e.zip
PLT-975 adding perm deletes
Diffstat (limited to 'store/sql_preference_store_test.go')
-rw-r--r--store/sql_preference_store_test.go40
1 files changed, 40 insertions, 0 deletions
diff --git a/store/sql_preference_store_test.go b/store/sql_preference_store_test.go
index e68203cc3..8d850e22c 100644
--- a/store/sql_preference_store_test.go
+++ b/store/sql_preference_store_test.go
@@ -192,3 +192,43 @@ func TestPreferenceGetAll(t *testing.T) {
}
}
}
+
+func TestPreferenceDelete(t *testing.T) {
+ Setup()
+
+ userId := model.NewId()
+ category := model.PREFERENCE_CATEGORY_DIRECT_CHANNEL_SHOW
+ name := model.NewId()
+
+ preferences := model.Preferences{
+ {
+ UserId: userId,
+ Category: category,
+ Name: name,
+ },
+ // same user/category, different name
+ {
+ UserId: userId,
+ Category: category,
+ Name: model.NewId(),
+ },
+ // same user/name, different category
+ {
+ UserId: userId,
+ Category: model.NewId(),
+ Name: name,
+ },
+ // same name/category, different user
+ {
+ UserId: model.NewId(),
+ Category: category,
+ Name: name,
+ },
+ }
+
+ Must(store.Preference().Save(&preferences))
+
+ if result := <-store.Preference().Delete(userId); result.Err != nil {
+ t.Fatal(result.Err)
+ }
+}