2019-06-18 07:28:30 -07:00
|
|
|
package xmpp
|
2018-01-12 09:01:27 -08:00
|
|
|
|
2019-06-17 02:59:39 -07:00
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
2018-01-12 09:01:27 -08:00
|
|
|
|
|
|
|
func TestHandshake(t *testing.T) {
|
2019-06-08 10:47:05 -07:00
|
|
|
opts := ComponentOptions{
|
|
|
|
Domain: "test.localhost",
|
2018-01-12 09:01:27 -08:00
|
|
|
Secret: "mypass",
|
|
|
|
}
|
2019-06-08 10:47:05 -07:00
|
|
|
c := Component{ComponentOptions: opts}
|
2018-01-12 09:01:27 -08:00
|
|
|
|
|
|
|
streamID := "1263952298440005243"
|
|
|
|
expected := "c77e2ef0109fbbc5161e83b51629cd1353495332"
|
|
|
|
|
2018-01-12 09:14:41 -08:00
|
|
|
result := c.handshake(streamID)
|
2018-01-12 09:01:27 -08:00
|
|
|
if result != expected {
|
|
|
|
t.Errorf("incorrect handshake calculation '%s' != '%s'", result, expected)
|
|
|
|
}
|
|
|
|
}
|
2018-01-25 14:16:55 -08:00
|
|
|
|
|
|
|
func TestGenerateHandshake(t *testing.T) {
|
|
|
|
// TODO
|
|
|
|
}
|
2019-08-08 08:46:02 -07:00
|
|
|
|
|
|
|
// Test that NewStreamManager can accept a Component.
|
|
|
|
//
|
|
|
|
// This validates that Component conforms to StreamClient interface.
|
|
|
|
func TestStreamManager(t *testing.T) {
|
|
|
|
NewStreamManager(&Component{}, nil)
|
|
|
|
}
|