diff options
author | JoramWilander <jwawilander@gmail.com> | 2015-12-17 12:44:46 -0500 |
---|---|---|
committer | JoramWilander <jwawilander@gmail.com> | 2015-12-17 12:44:46 -0500 |
commit | a6ae90ac2a74871331707751e823b4746136ff09 (patch) | |
tree | 2651cc8adfeca84a0ee89974ba6c40f167a81123 /store/sql_user_store_test.go | |
parent | 58358ddd7cd0152bf16a7326e1d595524fb51246 (diff) | |
download | chat-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.go | 31 |
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") + } + } +} |