-
Notifications
You must be signed in to change notification settings - Fork 4
/
response_options_test.go
58 lines (50 loc) · 1.42 KB
/
response_options_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
// Copyright (c) Jim Lambert
// SPDX-License-Identifier: MIT
package gldap
import (
"testing"
"github.com/stretchr/testify/assert"
)
func Test_WithDiagnosticMessage(t *testing.T) {
t.Parallel()
assert := assert.New(t)
opts := getResponseOpts(WithDiagnosticMessage("msg"))
testOpts := responseDefaults()
testOpts.withDiagnosticMessage = "msg"
assert.Equal(opts, testOpts)
}
func Test_WithMatchedDN(t *testing.T) {
t.Parallel()
assert := assert.New(t)
opts := getResponseOpts(WithMatchedDN("dn"))
testOpts := responseDefaults()
testOpts.withMatchedDN = "dn"
assert.Equal(opts, testOpts)
}
func Test_WithResponseCode(t *testing.T) {
t.Parallel()
assert := assert.New(t)
opts := getResponseOpts(WithResponseCode(ResultNoSuchOperation))
testOpts := responseDefaults()
testOpts.withResponseCode = intPtr(ResultNoSuchOperation)
assert.Equal(opts, testOpts)
}
func Test_WithApplicationCode(t *testing.T) {
t.Parallel()
assert := assert.New(t)
opts := getResponseOpts(WithApplicationCode(ApplicationAbandonRequest))
testOpts := responseDefaults()
testOpts.withApplicationCode = intPtr(ApplicationAbandonRequest)
assert.Equal(opts, testOpts)
}
func Test_WithAttributes(t *testing.T) {
t.Parallel()
assert := assert.New(t)
attrs := map[string][]string{
"email": {"[email protected]"},
}
opts := getResponseOpts(WithAttributes(attrs))
testOpts := responseDefaults()
testOpts.withAttributes = attrs
assert.Equal(opts, testOpts)
}