mirror of
https://github.com/MichaelMure/git-bug.git
synced 2024-12-15 10:12:06 +03:00
39 lines
686 B
Go
39 lines
686 B
Go
package commands
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
const (
|
|
testUserName = "John Doe"
|
|
testUserEmail = "jdoe@example.com"
|
|
)
|
|
|
|
func newTestEnvAndUser(t *testing.T) (*testEnv, string) {
|
|
t.Helper()
|
|
|
|
testEnv := newTestEnv(t)
|
|
|
|
opts := createUserOptions{
|
|
name: testUserName,
|
|
email: testUserEmail,
|
|
avatarURL: "",
|
|
nonInteractive: true,
|
|
}
|
|
|
|
require.NoError(t, runUserCreate(testEnv.env, opts))
|
|
|
|
userID := strings.TrimSpace(testEnv.out.String())
|
|
testEnv.out.Reset()
|
|
|
|
return testEnv, userID
|
|
}
|
|
|
|
func TestUserCreateCommand(t *testing.T) {
|
|
_, userID := newTestEnvAndUser(t)
|
|
require.Regexp(t, "[0-9a-f]{64}", userID)
|
|
}
|