mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-12-15 11:22:49 +03:00
-: add one more test
This commit is contained in:
parent
6bf512f96f
commit
3dd91cf179
@ -445,6 +445,7 @@ func (clients *clientsContainer) SetWhoisInfo(ip string, info [][]string) {
|
||||
return
|
||||
}
|
||||
|
||||
// Create a ClientHost implicitly so that we don't do this check again
|
||||
ch = &ClientHost{
|
||||
Source: ClientSourceWHOIS,
|
||||
}
|
||||
@ -525,7 +526,6 @@ func (clients *clientsContainer) addFromHostsFile() {
|
||||
// The command's output is:
|
||||
// HOST (IP) at MAC on IFACE
|
||||
func (clients *clientsContainer) addFromSystemARP() {
|
||||
|
||||
if runtime.GOOS == "windows" {
|
||||
return
|
||||
}
|
||||
|
@ -257,7 +257,6 @@ func (clients *clientsContainer) handleFindClient(w http.ResponseWriter, r *http
|
||||
}
|
||||
cj := clientHostToJSON(ip, ch)
|
||||
el[ip] = cj
|
||||
|
||||
} else {
|
||||
cj := clientToJSON(&c)
|
||||
el[ip] = cj
|
||||
|
@ -190,7 +190,7 @@ func TestClientsAddExistingHost(t *testing.T) {
|
||||
|
||||
// add a client
|
||||
c = Client{
|
||||
IDs: []string{"1.1.1.1", "1:2:3::4", "aa:aa:aa:aa:aa:aa"},
|
||||
IDs: []string{"1.1.1.1", "1:2:3::4", "aa:aa:aa:aa:aa:aa", "2.2.2.0/24"},
|
||||
Name: "client1",
|
||||
}
|
||||
ok, err := clients.Add(c)
|
||||
@ -221,4 +221,9 @@ func TestClientsAddExistingHost(t *testing.T) {
|
||||
ok, err = clients.AddHost(testIP, "test", ClientSourceRDNS)
|
||||
assert.False(t, ok)
|
||||
assert.Nil(t, err)
|
||||
|
||||
// don't allow duplicates by CIDR
|
||||
ok, err = clients.AddHost("2.2.2.2", "test", ClientSourceRDNS)
|
||||
assert.False(t, ok)
|
||||
assert.Nil(t, err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user