mirror of
https://github.com/bettercap/bettercap
synced 2025-08-19 13:09:49 -07:00
add test for MarshalJSON
This commit is contained in:
parent
ba47e82e77
commit
bb493de4c9
1 changed files with 18 additions and 0 deletions
|
@ -51,3 +51,21 @@ func TestNewLAN(t *testing.T) {
|
||||||
t.Fatalf("expected '%v', got '%v'", 0, len(lan.aliases.data))
|
t.Fatalf("expected '%v', got '%v'", 0, len(lan.aliases.data))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestMarshalJSON(t *testing.T) {
|
||||||
|
iface, err := FindInterface("")
|
||||||
|
if err != nil {
|
||||||
|
t.Error("no iface found", err)
|
||||||
|
}
|
||||||
|
gateway, err := FindGateway(iface)
|
||||||
|
if err != nil {
|
||||||
|
t.Error("no gateway found", err)
|
||||||
|
}
|
||||||
|
exNewCallback := func(e *Endpoint) {}
|
||||||
|
exLostCallback := func(e *Endpoint) {}
|
||||||
|
lan := NewLAN(iface, gateway, exNewCallback, exLostCallback)
|
||||||
|
_, err = lan.MarshalJSON()
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue