frontend: resolve asn in dns/whois/fail order & fix tests

This commit is contained in:
Lan Tian
2021-07-31 16:56:39 +08:00
committed by Yuhui Xu
parent 2e0cb131ca
commit bee26f421c
4 changed files with 60 additions and 18 deletions

22
frontend/whois_test.go Normal file
View File

@@ -0,0 +1,22 @@
package main
import (
"strings"
"testing"
)
func TestWhois(t *testing.T) {
setting.whoisServer = "whois.arin.net"
result := whois("AS6939")
if !strings.Contains(result, "HURRICANE") {
t.Errorf("Whois AS6939 failed, got %s", result)
}
}
func TestWhoisWithoutServer(t *testing.T) {
setting.whoisServer = ""
result := whois("AS6939")
if result != "" {
t.Errorf("Whois AS6939 without server produced output, got %s", result)
}
}