6
1
mirror of https://git.mills.io/saltyim/saltyim.git synced 2024-06-28 09:41:02 +00:00
prologic-saltyim/internal/test_helpers.go
James Mills 14857206cb Add client e2e integration tests (#180)
Co-authored-by: James Mills <1290234+prologic@users.noreply.github.com>
Reviewed-on: https://git.mills.io/saltyim/saltyim/pulls/180
2023-01-26 22:30:16 +00:00

25 lines
444 B
Go

package internal
import (
"testing"
"github.com/stretchr/testify/require"
"go.mills.io/saltyim"
)
func NewTestUser(addr, broker string, t *testing.T) *saltyim.Client {
require := require.New(t)
me, err := saltyim.ParseAddr(addr)
require.NoError(err)
id, err := saltyim.CreateIdentity(saltyim.WithIdentityAddr(me))
require.NoError(err)
cli, err := saltyim.NewClient(saltyim.WithIdentity(id))
require.NoError(err)
return cli
}