mirror of
https://github.com/gitpod-io/gitpod.git
synced 2025-12-08 17:36:30 +00:00
* [experiment] Add "Sign in with SSO" to Login Reusing existing parts: * `/complete-auth` page of Dashbaord to forward results of authN flows running in a modal * Adding preliminary UI to the Login view: Org-slug and simple button. * [gitpod-db] get team/org by slug * [gitpod-db] fix OIDCClientConfig.OrganizationID field's type * [oidc] consider returnTo URL * [oidc] consider orgSlug param from start request * [oidc] fix oauth2 clientId propagation * [oidc] fix a flaky test * [onboarding] skip for organizational accounts * Move SSO Login UI into it's own component * adjust validation a bit, add useCallbacks * adding GetOIDCClientConfigByOrgSlug * add table name * removing commented out code --------- Co-authored-by: Brad Harris <bmharris@gmail.com>
59 lines
1.3 KiB
Go
59 lines
1.3 KiB
Go
// Copyright (c) 2022 Gitpod GmbH. All rights reserved.
|
|
// Licensed under the GNU Affero General Public License (AGPL).
|
|
// See License.AGPL.txt in the project root for license information.
|
|
|
|
package db_test
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
db "github.com/gitpod-io/gitpod/components/gitpod-db/go"
|
|
"github.com/gitpod-io/gitpod/components/gitpod-db/go/dbtest"
|
|
"github.com/google/uuid"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func Test_WriteRead(t *testing.T) {
|
|
conn := dbtest.ConnectForTests(t)
|
|
|
|
team := db.Team{
|
|
ID: uuid.New(),
|
|
Name: "Team1",
|
|
Slug: "team1",
|
|
}
|
|
|
|
_, err := db.CreateTeam(context.Background(), conn, team)
|
|
require.NoError(t, err)
|
|
|
|
candidates := []db.Team{
|
|
{ID: team.ID},
|
|
{Slug: team.Slug},
|
|
}
|
|
|
|
for _, read := range candidates {
|
|
tx := conn.First(&read)
|
|
require.NoError(t, tx.Error)
|
|
require.Equal(t, team.Name, read.Name)
|
|
require.Equal(t, team.Slug, read.Slug)
|
|
}
|
|
}
|
|
|
|
func Test_GetTeamBySlug(t *testing.T) {
|
|
conn := dbtest.ConnectForTests(t)
|
|
|
|
team := db.Team{
|
|
ID: uuid.New(),
|
|
Name: "Team1",
|
|
Slug: "team1",
|
|
}
|
|
|
|
_, err := db.CreateTeam(context.Background(), conn, team)
|
|
require.NoError(t, err)
|
|
|
|
read, err := db.GetTeamBySlug(context.Background(), conn, team.Slug)
|
|
require.NoError(t, err)
|
|
require.Equal(t, team.Name, read.Name)
|
|
require.Equal(t, team.Slug, read.Slug)
|
|
}
|