-
-
Notifications
You must be signed in to change notification settings - Fork 368
Expand file tree
/
Copy pathdebug_test.go
More file actions
37 lines (29 loc) · 636 Bytes
/
debug_test.go
File metadata and controls
37 lines (29 loc) · 636 Bytes
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
package debug
import (
"bytes"
"testing"
"github.com/stretchr/testify/assert"
)
func TestVerboseEnabled(t *testing.T) {
b := &bytes.Buffer{}
output = b
Verbose = true
Println("World")
if b.String() != "World\n" {
t.Error("expected 'World' got", b.String())
}
}
func TestVerboseDisabled(t *testing.T) {
b := &bytes.Buffer{}
output = b
Verbose = false
Println("World")
if b.String() != "" {
t.Error("expected '' got", b.String())
}
}
func TestRedact(t *testing.T) {
fakeToken := "1a11111aaaa111aa1a11111a11111aa1"
expected := "1a11*************************aa1"
assert.Equal(t, expected, Redact(fakeToken))
}