6
1
mirror of https://git.mills.io/saltyim/saltyim.git synced 2024-06-16 03:48:24 +00:00
prologic-saltyim/internal/test_helpers.go
2023-02-28 08:37:50 +10:00

25 lines
444 B
Go

package internal
import (
"testing"
"github.com/stretchr/testify/require"
"go.salty.im/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
}