Closed nemith closed 1 year ago
Add unittest for RPCMsg encoding and ensure that operation is supplied when encoding rpc request messages (i.e ReqMSG) via custom MarshalXML method.
rpc
ReqMSG
Future work to make sure structs passed in are named.
Test Plan:
$ go test . -v -run=MarshalRPCMsg === RUN TestMarshalRPCMsg === RUN TestMarshalRPCMsg/nil msg_test.go:55: out: === RUN TestMarshalRPCMsg/string msg_test.go:55: out: <rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1"><foo><bar/></foo></rpc> === RUN TestMarshalRPCMsg/byteslice msg_test.go:55: out: <rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1"><baz><qux/></baz></rpc> === RUN TestMarshalRPCMsg/validate msg_test.go:55: out: <rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1"><validate><source><running/></source></validate></rpc> === RUN TestMarshalRPCMsg/customStruct msg_test.go:55: out: <rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1"><command xmlns="http://xml.juniper.net/junos/22.4R0/junos">show bgp neighbors</command></rpc> --- PASS: TestMarshalRPCMsg (0.00s) --- PASS: TestMarshalRPCMsg/nil (0.00s) --- PASS: TestMarshalRPCMsg/string (0.00s) --- PASS: TestMarshalRPCMsg/byteslice (0.00s) --- PASS: TestMarshalRPCMsg/validate (0.00s) --- PASS: TestMarshalRPCMsg/customStruct (0.00s) PASS ok github.com/nemith/netconf (cached)
Add unittest for RPCMsg encoding and ensure that operation is supplied when encoding
rpc
request messages (i.eReqMSG
) via custom MarshalXML method.Future work to make sure structs passed in are named.
Test Plan: