ooni-probe-cli/internal/tunnel/config_test.go

37 lines
697 B
Go
Raw Normal View History

package tunnel
import (
"testing"
"github.com/apex/log"
)
func TestConfigLoggerDefault(t *testing.T) {
config := &Config{}
if config.logger() != defaultLogger {
t.Fatal("not the logger we expected")
}
}
func TestConfigLoggerCustom(t *testing.T) {
config := &Config{Logger: log.Log}
if config.logger() != log.Log {
t.Fatal("not the logger we expected")
}
}
func TestTorBinaryNotSet(t *testing.T) {
config := &Config{}
if config.torBinary() != "tor" {
t.Fatal("not the result we expected")
}
}
func TestTorBinarySet(t *testing.T) {
path := "/usr/local/bin/tor"
config := &Config{TorBinary: path}
if config.torBinary() != path {
t.Fatal("not the result we expected")
}
}