2018-04-19 15:46:38 +00:00
|
|
|
package ssh
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"io/ioutil"
|
|
|
|
"log"
|
|
|
|
"testing"
|
|
|
|
|
2018-04-26 08:50:26 +00:00
|
|
|
ocmsc "git.loafle.net/overflow/commons-go/model/sensorconfig"
|
2018-04-19 15:46:38 +00:00
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestMatch(t *testing.T) {
|
2018-04-26 08:50:26 +00:00
|
|
|
config := &ocmsc.SensorConfig{}
|
2018-04-19 15:46:38 +00:00
|
|
|
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)
|
|
|
|
}
|