summaryrefslogtreecommitdiffstats
path: root/store/sql_preference_store_test.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2015-11-18 12:48:45 -0500
committerJoram Wilander <jwawilander@gmail.com>2015-11-18 12:48:45 -0500
commite408d615c02ae3c863df3c7dc13d1b813c22fd28 (patch)
treea1c607b7721831c71aadbf89f018ed7b11a0e426 /store/sql_preference_store_test.go
parent9660adb00775aba822d2d684d215c55679a456c6 (diff)
parentc115191d6b5abdefda856c063e3f9048dc82f830 (diff)
downloadchat-e408d615c02ae3c863df3c7dc13d1b813c22fd28.tar.gz
chat-e408d615c02ae3c863df3c7dc13d1b813c22fd28.tar.bz2
chat-e408d615c02ae3c863df3c7dc13d1b813c22fd28.zip
Merge pull request #1448 from mattermost/PLT-975
PLT-975 adding delete to command line tool
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..77da71fd6 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().PermanentDeleteByUser(userId); result.Err != nil {
+ t.Fatal(result.Err)
+ }
+}