2015-03-30 18:55:03 +02:00
|
|
|
package authboss
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
"io"
|
|
|
|
"log"
|
|
|
|
"strings"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestDefaultLogger(t *testing.T) {
|
2015-03-31 21:34:03 +02:00
|
|
|
t.Parallel()
|
|
|
|
|
2015-03-30 18:55:03 +02:00
|
|
|
logger := NewDefaultLogger()
|
|
|
|
if logger == nil {
|
|
|
|
t.Error("Logger was not created.")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestDefaultLoggerOutput(t *testing.T) {
|
2015-03-31 21:34:03 +02:00
|
|
|
t.Parallel()
|
|
|
|
|
2015-03-30 18:55:03 +02:00
|
|
|
buffer := &bytes.Buffer{}
|
|
|
|
logger := (*DefaultLogger)(log.New(buffer, "", log.LstdFlags))
|
|
|
|
io.WriteString(logger, "hello world")
|
|
|
|
if s := buffer.String(); !strings.HasSuffix(s, "hello world\n") {
|
|
|
|
t.Error("Output was wrong:", s)
|
|
|
|
}
|
|
|
|
}
|