checking in- needs some refinement then done
This commit is contained in:
55
netsplit/tiana_test.go
Normal file
55
netsplit/tiana_test.go
Normal file
@@ -0,0 +1,55 @@
|
||||
package netsplit
|
||||
|
||||
import (
|
||||
`encoding/json`
|
||||
`fmt`
|
||||
`net/http`
|
||||
"testing"
|
||||
|
||||
`github.com/go-resty/resty/v2`
|
||||
`github.com/goccy/go-yaml`
|
||||
)
|
||||
|
||||
func TestIANA(t *testing.T) {
|
||||
|
||||
var err error
|
||||
var b []byte
|
||||
var req *resty.Request
|
||||
var resp *resty.Response
|
||||
var reg *IANARegistry
|
||||
var client *resty.Client = resty.New()
|
||||
|
||||
// IPv4
|
||||
req = client.R()
|
||||
reg = new(IANARegistry)
|
||||
req.SetResult(reg)
|
||||
if resp, err = req.Get(ianaSpecial4); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if resp.StatusCode() != http.StatusOK {
|
||||
t.Fatal(resp.Status())
|
||||
}
|
||||
|
||||
if b, err = json.MarshalIndent(reg, "", " "); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
fmt.Println(string(b))
|
||||
|
||||
// IPv6
|
||||
req = client.R()
|
||||
reg = new(IANARegistry)
|
||||
req.SetResult(reg)
|
||||
if resp, err = req.Get(ianaSpecial6); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if resp.StatusCode() != http.StatusOK {
|
||||
t.Fatal(resp.Status())
|
||||
}
|
||||
|
||||
if b, err = yaml.Marshal(reg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
fmt.Println(string(b))
|
||||
|
||||
_ = b
|
||||
}
|
||||
Reference in New Issue
Block a user