freeconf / restconf

Implementation of RESTCONF Management protocol - IETF RFC8040

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Duplicate/Bad test for restconf server?

HRogge opened this issue · comments

In server_test.go the test in line 54 seems to be wrong... the return type suggest this was meant to do a "GET" operation on the "car" data, but what the test does is to retrieve the schema of "car", exactly as the test beginning in line 51.

This can also be seen in the file testdata/gold/car.json, which doesn't contain JSON data but a YANG file.

I guess the test should be a line like:
req, _ := http.NewRequest("GET", fmt.Sprintf("%s/restconf/data/car", addr), nil)

Test is ok.
It is subtle, but Accept-Type is different on lines 54 and 51 and one tests getting YANG file in it's original form and one in the JSON form.
After implementing this, I have since discovered RESTCONF allows for getting YANG in original form via the ietf-yang-lib module and I hope to investigate that someday as an alternative to getting the original version. .