31 lines
511 B
Go
31 lines
511 B
Go
package ssh
|
|
|
|
import (
|
|
"encoding/json"
|
|
"io/ioutil"
|
|
"log"
|
|
"testing"
|
|
|
|
ocsm "git.loafle.net/overflow/commons-go/sensorconfig/model"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestMatch(t *testing.T) {
|
|
config := &ocsm.SensorConfig{}
|
|
data, err := ioutil.ReadFile("./SSHCrawler_test.json")
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
err = json.Unmarshal(data, config)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
c := NewCrawler().(*SSHCrawler)
|
|
|
|
rss, err := c.Get(config)
|
|
|
|
assert.Nil(t, err)
|
|
assert.NotNil(t, rss)
|
|
}
|