mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
* chore: Fix golangci-lint configuration and patch errors Due to misconfiguration of a linting rules directory, our linter has not been working properly. This change fixes the configuration issue, and all remaining linting errors. * Fix race in peer logging * Fix race and return * Lock on bufferred amount low * Fix mutex lock
57 lines
1.3 KiB
Go
57 lines
1.3 KiB
Go
package coderd_test
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/coder/coder/coderd"
|
|
"github.com/coder/coder/coderd/coderdtest"
|
|
)
|
|
|
|
func TestUsers(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
t.Run("Authenticated", func(t *testing.T) {
|
|
t.Parallel()
|
|
server := coderdtest.New(t)
|
|
_, err := server.Client.User(context.Background(), "")
|
|
require.NoError(t, err)
|
|
})
|
|
|
|
t.Run("CreateMultipleInitial", func(t *testing.T) {
|
|
t.Parallel()
|
|
server := coderdtest.New(t)
|
|
_, err := server.Client.CreateInitialUser(context.Background(), coderd.CreateUserRequest{
|
|
Email: "dummy@coder.com",
|
|
Username: "fake",
|
|
Password: "password",
|
|
})
|
|
require.Error(t, err)
|
|
})
|
|
|
|
t.Run("LoginNoEmail", func(t *testing.T) {
|
|
t.Parallel()
|
|
server := coderdtest.New(t)
|
|
_, err := server.Client.LoginWithPassword(context.Background(), coderd.LoginWithPasswordRequest{
|
|
Email: "hello@io.io",
|
|
Password: "wowie",
|
|
})
|
|
require.Error(t, err)
|
|
})
|
|
|
|
t.Run("LoginBadPassword", func(t *testing.T) {
|
|
t.Parallel()
|
|
server := coderdtest.New(t)
|
|
user, err := server.Client.User(context.Background(), "")
|
|
require.NoError(t, err)
|
|
|
|
_, err = server.Client.LoginWithPassword(context.Background(), coderd.LoginWithPasswordRequest{
|
|
Email: user.Email,
|
|
Password: "bananas",
|
|
})
|
|
require.Error(t, err)
|
|
})
|
|
}
|