forked from saucelabs/forwarder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkerberos_test.go
More file actions
41 lines (30 loc) · 1.16 KB
/
kerberos_test.go
File metadata and controls
41 lines (30 loc) · 1.16 KB
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
// Copyright 2022-2024 Sauce Labs Inc., all rights reserved.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
package forwarder
import (
"testing"
"github.com/saucelabs/forwarder/log/slog"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestKerberosAdapterFailsWithoutConfig(t *testing.T) {
cnf := KerberosConfig{}
_, err := NewKerberosAdapter(cnf, slog.Default())
assert.Error(t, err)
require.ErrorContains(t, err, "kerberos config file (krb5.conf) not specified")
cnf.CfgFilePath = "/tmp/test.cfg"
_, err = NewKerberosAdapter(cnf, slog.Default())
assert.Error(t, err)
require.ErrorContains(t, err, "kerberos keytab file not specified")
cnf.KeyTabFilePath = "/tmp/keytab"
_, err = NewKerberosAdapter(cnf, slog.Default())
assert.Error(t, err)
require.ErrorContains(t, err, "kerberos username not specified")
cnf.UserName = "user1"
_, err = NewKerberosAdapter(cnf, slog.Default())
assert.Error(t, err)
require.ErrorContains(t, err, "kerberos user realm not specified")
}