frontend: add a test case for lookup DNS -> WHOIS fallback

This commit is contained in:
Lan Tian
2023-05-06 00:26:40 -07:00
parent a0246ccee2
commit db58bd3354

View File

@@ -19,6 +19,18 @@ func TestGetASNRepresentationDNS(t *testing.T) {
}
}
func TestGetASNRepresentationDNSFallback(t *testing.T) {
checkNetwork(t)
setting.dnsInterface = "invalid.example.com"
setting.whoisServer = "whois.arin.net"
cache := make(ASNCache)
result := cache.Lookup("6939")
if !strings.Contains(result, "HURRICANE") {
t.Errorf("Lookup AS6939 failed, got %s", result)
}
}
func TestGetASNRepresentationWhois(t *testing.T) {
checkNetwork(t)