-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsspi_test.go
58 lines (44 loc) · 969 Bytes
/
sspi_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
50
51
52
53
54
55
56
57
58
//go:build windows
// +build windows
package sshkrb5_test
import (
"os/user"
"regexp"
"testing"
"github.com/bodgit/sshkrb5"
"github.com/stretchr/testify/assert"
)
func TestNewClient(t *testing.T) {
t.Parallel()
whoami, err := testNewClient(t)
if err != nil {
t.Fatal(err)
}
assert.Regexp(t, regexp.MustCompile(`\btest$`), whoami)
}
func TestNewClientWithCredentials(t *testing.T) {
t.Parallel()
whoami, err := testNewClientWithCredentials(t)
if err != nil {
t.Fatal(err)
}
assert.Regexp(t, regexp.MustCompile(`\btest$`), whoami)
}
func TestNewClientWithKeytab(t *testing.T) {
t.Parallel()
_, err := testNewClientWithKeytab(t)
assert.Equal(t, sshkrb5.ErrNotSupported, err)
}
func TestNewServer(t *testing.T) {
t.Parallel()
u, err := user.Current()
if err != nil {
t.Fatal(err)
}
if u.Username != `NT AUTHORITY\SYSTEM` {
t.Skip("not running as system account")
}
if err := testNewServer(t); err != nil {
t.Fatal(err)
}
}