go-http-tunnel/log/filterlogger_test.go
2017-11-24 15:29:38 +01:00

31 lines
623 B
Go

// Copyright (C) 2017 Michał Matczuk
// Use of this source code is governed by an AGPL-style
// license that can be found in the LICENSE file.
package log
import (
"testing"
"github.com/golang/mock/gomock"
"github.com/mmatczuk/go-http-tunnel/tunnelmock"
)
func TestFilterLogger_Log(t *testing.T) {
t.Parallel()
ctrl := gomock.NewController(t)
defer ctrl.Finish()
b := tunnelmock.NewMockLogger(ctrl)
f := NewFilterLogger(b, 2)
b.EXPECT().Log("level", 0)
f.Log("level", 0)
b.EXPECT().Log("level", 1)
f.Log("level", 1)
b.EXPECT().Log("level", 2)
f.Log("level", 2)
f.Log("level", 3)
f.Log("level", 4)
}