2016-03-19 15:07:44 +01:00
|
|
|
package respond
|
|
|
|
|
|
|
|
import (
|
|
|
|
"io/ioutil"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestParse(t *testing.T) {
|
|
|
|
assert := assert.New(t)
|
|
|
|
|
|
|
|
// read testdata
|
|
|
|
compressed, err := ioutil.ReadFile("testdata/nodeinfo.flated")
|
|
|
|
assert.Nil(err)
|
|
|
|
|
2016-10-03 19:55:37 +02:00
|
|
|
res := &Response{
|
2016-03-19 15:07:44 +01:00
|
|
|
Raw: compressed,
|
2016-10-03 19:55:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
data, err := res.parse()
|
|
|
|
|
|
|
|
assert.NoError(err)
|
|
|
|
assert.NotNil(data)
|
2016-03-19 15:07:44 +01:00
|
|
|
|
2016-10-03 19:55:37 +02:00
|
|
|
assert.Equal("f81a67a5e9c1", data.NodeInfo.NodeId)
|
2016-03-19 15:07:44 +01:00
|
|
|
}
|