summaryrefslogtreecommitdiffstats
path: root/store/sql_user_store_test.go
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2015-12-17 12:44:46 -0500
committerJoramWilander <jwawilander@gmail.com>2015-12-17 12:44:46 -0500
commita6ae90ac2a74871331707751e823b4746136ff09 (patch)
tree2651cc8adfeca84a0ee89974ba6c40f167a81123 /store/sql_user_store_test.go
parent58358ddd7cd0152bf16a7326e1d595524fb51246 (diff)
downloadchat-a6ae90ac2a74871331707751e823b4746136ff09.tar.gz
chat-a6ae90ac2a74871331707751e823b4746136ff09.tar.bz2
chat-a6ae90ac2a74871331707751e823b4746136ff09.zip
Add ability to switch between SSO and email account
Diffstat (limited to 'store/sql_user_store_test.go')
-rw-r--r--store/sql_user_store_test.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/store/sql_user_store_test.go b/store/sql_user_store_test.go
index dd08438f1..d1ee5e647 100644
--- a/store/sql_user_store_test.go
+++ b/store/sql_user_store_test.go
@@ -390,3 +390,34 @@ func TestUserStoreDelete(t *testing.T) {
t.Fatal(err)
}
}
+
+func TestUserStoreUpdateAuthData(t *testing.T) {
+ Setup()
+
+ u1 := model.User{}
+ u1.TeamId = model.NewId()
+ u1.Email = model.NewId()
+ Must(store.User().Save(&u1))
+
+ service := "someservice"
+ authData := "1"
+
+ if err := (<-store.User().UpdateAuthData(u1.Id, service, authData)).Err; err != nil {
+ t.Fatal(err)
+ }
+
+ if r1 := <-store.User().GetByEmail(u1.TeamId, u1.Email); r1.Err != nil {
+ t.Fatal(r1.Err)
+ } else {
+ user := r1.Data.(*model.User)
+ if user.AuthService != service {
+ t.Fatal("AuthService was not updated correctly")
+ }
+ if user.AuthData != authData {
+ t.Fatal("AuthData was not updated correctly")
+ }
+ if user.Password != "" {
+ t.Fatal("Password was not cleared properly")
+ }
+ }
+}