This commit is contained in:
crusader 2018-08-29 21:09:59 +09:00
parent ffd94e2c8e
commit c955c396bc

View File

@ -6,23 +6,14 @@ import (
omd "git.loafle.net/overflow/model/discovery" omd "git.loafle.net/overflow/model/discovery"
omm "git.loafle.net/overflow/model/meta" omm "git.loafle.net/overflow/model/meta"
"git.loafle.net/overflow_scanner/probe/model" "git.loafle.net/overflow_scanner/probe/discovery/session"
"github.com/grandcat/zeroconf" "github.com/grandcat/zeroconf"
) )
func TestScan(t *testing.T) { func TestScan(t *testing.T) {
type args struct { s := session.MockDiscoverySession()
discovered model.Discovered s.InitWithDiscoverHost(
} nil,
tests := []struct {
name string
args args
}{
// TODO: Add test cases.
{
name: "1",
args: args{
discovered: model.New(
&omd.Zone{ &omd.Zone{
Network: "192.168.1.0/24", Network: "192.168.1.0/24",
Iface: "enp3s0", Iface: "enp3s0",
@ -30,13 +21,30 @@ func TestScan(t *testing.T) {
Address: "192.168.1.101", Address: "192.168.1.101",
Mac: "44:8a:5b:f1:f1:f3", Mac: "44:8a:5b:f1:f1:f3",
}, },
), &omd.DiscoverHost{
MetaIPType: omm.ToMetaIPType(omm.MetaIPTypeEnumV4),
FirstScanRange: "192.168.1.1",
LastScanRange: "192.168.1.254",
},
)
type args struct {
discoverySession session.DiscoverySession
}
tests := []struct {
name string
args args
}{
{
name: "1",
args: args{
discoverySession: s,
}, },
}, },
} }
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {
Scan(tt.args.discovered) Scan(tt.args.discoverySession)
}) })
} }
} }