fix unit test
This commit is contained in:
parent
89b8fbfdcc
commit
61a0673550
2 changed files with 8 additions and 0 deletions
|
|
@ -20,6 +20,8 @@ var runCmd = &cobra.Command{
|
||||||
Short: L("Execute process"),
|
Short: L("Execute process"),
|
||||||
Long: L("Execute process"),
|
Long: L("Execute process"),
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
share.SessionServerStart() // Connect to session server
|
||||||
|
defer share.SessionServerStop() // Connect to session server
|
||||||
defer gou.KillPlugins()
|
defer gou.KillPlugins()
|
||||||
defer func() {
|
defer func() {
|
||||||
err := exception.Catch(recover())
|
err := exception.Catch(recover())
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,16 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/yaoapp/yao/share"
|
||||||
"github.com/yaoapp/yao/user"
|
"github.com/yaoapp/yao/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestUserAuth(t *testing.T) {
|
func TestUserAuth(t *testing.T) {
|
||||||
|
|
||||||
|
// Start Session Server
|
||||||
|
share.SessionServerStart()
|
||||||
|
defer share.SessionServerStop()
|
||||||
|
|
||||||
res := user.Auth("email", "xiang@iqka.com", "A123456p+")
|
res := user.Auth("email", "xiang@iqka.com", "A123456p+")
|
||||||
assert.True(t, res.Has("user"))
|
assert.True(t, res.Has("user"))
|
||||||
assert.True(t, res.Has("token"))
|
assert.True(t, res.Has("token"))
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue