...
1
2
3
4
5
6
7
8
9
10 package auth
11
12 import (
13 "context"
14 "testing"
15
16 "go.mongodb.org/mongo-driver/mongo/address"
17 "go.mongodb.org/mongo-driver/mongo/description"
18 )
19
20 func TestGSSAPIAuthenticator(t *testing.T) {
21 t.Run("PropsError", func(t *testing.T) {
22
23
24 authenticator := &GSSAPIAuthenticator{
25 Username: "foo",
26 Password: "bar",
27 PasswordSet: true,
28 Props: map[string]string{
29 "CANONICALIZE_HOST_NAME": "true",
30 "SERVICE_HOST": "localhost",
31 },
32 }
33 desc := description.Server{
34 WireVersion: &description.VersionRange{
35 Max: 6,
36 },
37 Addr: address.Address("foo:27017"),
38 }
39 err := authenticator.Auth(context.Background(), &Config{Description: desc})
40 if err == nil {
41 t.Fatalf("expected err, got nil")
42 }
43 })
44
45 }
46
View as plain text