PLT-3984 Add the ability to regenerate OAuth Client Secret (#3899)

Этот коммит содержится в:
enahum
2016-08-30 21:15:40 -03:00
коммит произвёл GitHub
родитель e9bc77a8f7
Коммит 1326ab66a1
9 изменённых файлов: 150 добавлений и 9 удалений

Просмотреть файл

@@ -278,6 +278,30 @@ func TestDeauthorizeApp(t *testing.T) {
}
}
func TestRegenerateOAuthAppSecret(t *testing.T) {
th := Setup().InitSystemAdmin()
AdminClient := th.SystemAdminClient
utils.Cfg.ServiceSettings.EnableOAuthServiceProvider = true
app := &model.OAuthApp{Name: "TestApp6" + model.NewId(), Homepage: "https://nowhere.com", Description: "test", CallbackUrls: []string{"https://nowhere.com"}}
app = AdminClient.Must(AdminClient.RegisterApp(app)).Data.(*model.OAuthApp)
if regenApp, err := AdminClient.RegenerateOAuthAppSecret(app.Id); err != nil {
t.Fatal(err)
} else {
app2 := regenApp.Data.(*model.OAuthApp)
if app2.Id != app.Id {
t.Fatal("Should have been the same app Id")
}
if app2.ClientSecret == app.ClientSecret {
t.Fatal("Should have been diferent client Secrets")
}
}
}
func TestOAuthDeleteApp(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
Client := th.BasicClient