sum7
/
yaja
Archived
1
0
Fork 0
This repository has been archived on 2020-09-27. You can view files and clone it, but cannot push or open issues or pull requests.
yaja/client/client_test.go

41 lines
811 B
Go
Raw Normal View History

package client
2018-03-03 09:28:24 +01:00
/*
func TestClient(t *testing.T) {
assert := assert.New(t)
jid := xmppbase.NewJID("test@example.net")
logger := log.New()
logger.SetLevel(log.DebugLevel)
client := &Client{
JID: jid,
Timeout: time.Millisecond * 500,
Logging: logger.WithField("jid", jid.String()),
}
// close nil connected
assert.NoError(client.Close())
err := client.Connect("password")
assert.Error(err)
assert.Contains(err.Error(), "timeout")
jid.Domain = "chat.sum7.eu"
// invalid auth
client, err = NewClient(jid, "password")
assert.NotNil(client)
assert.Error(err)
assert.Contains(err.Error(), "not-authorized : ")
// already closed
assert.Error(client.Close())
client.Logging = logger.WithField("jid", jid.String())
err = client.Connect("FqzMp6bevlHlt8d")
assert.NoError(err)
}
*/