1package commands_test
2
3import (
4 "path/filepath"
5 "strings"
6 "testing"
7
8 "github.com/stretchr/testify/require"
9)
10
11func newTestEnvAndUser(t *testing.T) (*testEnv, string) {
12 t.Helper()
13
14 testEnv := newTestEnv(t)
15
16 testEnv.cmd.SetArgs(
17 []string{
18 "user",
19 "create",
20 "--non-interactive",
21 "-n John Doe",
22 "-e jdoe@example.com",
23 })
24
25 testEnv.Execute(t)
26 userID := strings.TrimSpace(testEnv.out.String())
27 testEnv.out.Reset()
28
29 return testEnv, userID
30}
31
32func TestUserCreateCommand(t *testing.T) {
33 testEnv, userID := newTestEnvAndUser(t)
34
35 t.Log("CWD:", testEnv.cwd)
36
37 require.FileExists(t, filepath.Join(testEnv.cwd, ".git", "refs", "identities", userID))
38 require.FileExists(t, filepath.Join(testEnv.cwd, ".git", "git-bug", "identity-cache"))
39}