mirror of
https://github.com/bettercap/bettercap
synced 2025-08-19 04:59:25 -07:00
add test for EachAccessPoint
This commit is contained in:
parent
dfa55d2a2e
commit
36562bc7a9
1 changed files with 15 additions and 0 deletions
|
@ -41,3 +41,18 @@ func TestWiFiMarshalJSON(t *testing.T) {
|
||||||
t.Error("unable to marshal JSON from WiFi struct")
|
t.Error("unable to marshal JSON from WiFi struct")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestEachAccessPoint(t *testing.T) {
|
||||||
|
exampleWiFi := buildExampleWiFi()
|
||||||
|
exampleAP := NewAccessPoint("my_wifi", "ff:ff:ff:ff:ff:ff", 2472, int8(0))
|
||||||
|
exampleWiFi.aps["ff:ff:ff:ff:ff:f1"] = exampleAP
|
||||||
|
exampleWiFi.aps["ff:ff:ff:ff:ff:f2"] = exampleAP
|
||||||
|
count := 0
|
||||||
|
exampleCB := func(mac string, ap *AccessPoint) {
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
exampleWiFi.EachAccessPoint(exampleCB)
|
||||||
|
if count != 2 {
|
||||||
|
t.Error("unable to perform callback function for each access point")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue