6
1
mirror of https://git.mills.io/saltyim/saltyim.git synced 2024-06-25 16:28:20 +00:00
prologic-saltyim/internal/test_helpers.go

25 lines
444 B
Go
Raw Normal View History

package internal
import (
"testing"
"github.com/stretchr/testify/require"
2023-02-27 22:37:41 +00:00
"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
}