Pull request: * all: move internal Go packages to internal/
Merge in DNS/adguard-home from 2234-move-to-internal to master Squashed commit of the following: commit d26a288cabeac86f9483fab307677b1027c78524 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Oct 30 12:44:18 2020 +0300 * all: move internal Go packages to internal/ Closes #2234.
This commit is contained in:
28
internal/home/whois_test.go
Normal file
28
internal/home/whois_test.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package home
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/AdguardTeam/AdGuardHome/internal/dnsforward"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func prepareTestDNSServer() error {
|
||||
config.DNS.Port = 1234
|
||||
Context.dnsServer = dnsforward.NewServer(dnsforward.DNSCreateParams{})
|
||||
conf := &dnsforward.ServerConfig{}
|
||||
conf.UpstreamDNS = []string{"8.8.8.8"}
|
||||
return Context.dnsServer.Prepare(conf)
|
||||
}
|
||||
|
||||
func TestWhois(t *testing.T) {
|
||||
assert.Nil(t, prepareTestDNSServer())
|
||||
|
||||
w := Whois{timeoutMsec: 5000}
|
||||
resp, err := w.queryAll("8.8.8.8")
|
||||
assert.Nil(t, err)
|
||||
m := whoisParse(resp)
|
||||
assert.Equal(t, "Google LLC", m["orgname"])
|
||||
assert.Equal(t, "US", m["country"])
|
||||
assert.Equal(t, "Mountain View", m["city"])
|
||||
}
|
||||
Reference in New Issue
Block a user