-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
sasl_integration_test.go
49 lines (42 loc) · 1.14 KB
/
sasl_integration_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright 2020 The Mellium Contributors.
// Use of this source code is governed by the BSD 2-clause
// license that can be found in the LICENSE file.
//go:build integration
// +build integration
package xmpp_test
import (
"context"
"testing"
"mellium.im/xmpp/internal/integration"
"mellium.im/xmpp/internal/integration/mcabber"
"mellium.im/xmpp/internal/integration/mellium"
"mellium.im/xmpp/jid"
)
func TestMain(m *testing.M) {
mellium.TestMain(m)
}
func TestIntegrationSASLClient(t *testing.T) {
const pass = "testpass"
melliumRun := mellium.Test(context.TODO(), t,
integration.Cert("localhost"),
mellium.ConfigFile(mellium.Config{
ListenC2S: true,
}),
integration.User(jid.MustParse("me@localhost"), pass),
)
melliumRun(integrationSASLClient)
}
func integrationSASLClient(ctx context.Context, t *testing.T, cmd *integration.Cmd) {
j, pass := cmd.User()
p := cmd.C2SPort()
mcabberRun := mcabber.Test(context.TODO(), t,
mcabber.ConfigFile(mcabber.Config{
JID: j,
Password: pass,
Port: p,
}),
)
mcabberRun(func(ctx context.Context, t *testing.T, cmd *integration.Cmd) {
t.Log("Connected successfully!")
})
}