mirror of
https://github.com/MichaelMure/git-bug.git
synced 2024-12-14 17:51:44 +03:00
test(778): execute add user in testEnv and return userID
This commit is contained in:
parent
508d0eb82a
commit
ecfffe3902
33
commands/add_test.go
Normal file
33
commands/add_test.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
package commands_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strings"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func newTestEnvUserAndBug(t *testing.T) (*testEnv, string, string) {
|
||||||
|
t.Helper()
|
||||||
|
|
||||||
|
testEnv, userID := newTestEnvAndUser(t)
|
||||||
|
|
||||||
|
testEnv.cmd.SetArgs([]string{
|
||||||
|
"add",
|
||||||
|
"--non-interactive",
|
||||||
|
"-t 'this is a bug title'",
|
||||||
|
"-m 'this is a bug message'",
|
||||||
|
})
|
||||||
|
|
||||||
|
testEnv.Execute(t)
|
||||||
|
require.Regexp(t, "^[0-9A-Fa-f]{7} created\n$", testEnv.out)
|
||||||
|
bugID := strings.Split(testEnv.out.String(), " ")[0]
|
||||||
|
testEnv.out.Reset()
|
||||||
|
|
||||||
|
return testEnv, userID, bugID
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestAdd(t *testing.T) {
|
||||||
|
_, _, user := newTestEnvUserAndBug(t)
|
||||||
|
require.Regexp(t, "^[0-9A-Fa-f]{7}$", user)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user