Keep It Simple Stupid Stats (KISSS)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

33 lines
732 B

package main
import (
"testing"
)
func Test_config_statsAuth(t *testing.T) {
type fields struct {
StatsUsername string
StatsPassword string
}
tests := []struct {
name string
fields fields
want bool
}{
{"No username nor password", fields{"", ""}, false},
{"Only username", fields{"abc", ""}, false},
{"Only password", fields{"", "abc"}, false},
{"Username and password", fields{"abc", "abc"}, true},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
ac := &config{
StatsUsername: tt.fields.StatsUsername,
StatsPassword: tt.fields.StatsPassword,
}
if got := ac.statsAuth(); got != tt.want {
t.Errorf("config.statsAuth() = %v, want %v", got, tt.want)
}
})
}
}