X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fnbi%2Fhttpgetter_test.go;h=0080a843b5dfcc3699718f8ce72a74cbe1787e22;hb=2c131acf0418c45d9045a6a81baf3e7d047fcb38;hp=c1c597ac9b1260bf28ca3ca7636275243c7c8ab6;hpb=eb2ff0d217caf158dd15424bf70f8aa79c3742b1;p=ric-plt%2Frtmgr.git diff --git a/pkg/nbi/httpgetter_test.go b/pkg/nbi/httpgetter_test.go index c1c597a..0080a84 100644 --- a/pkg/nbi/httpgetter_test.go +++ b/pkg/nbi/httpgetter_test.go @@ -14,6 +14,11 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + + + This source code is part of the near-RT RIC (RAN Intelligent Controller) + platform project (RICP). + ================================================================================== */ /* @@ -28,25 +33,24 @@ import ( "net" "net/http" "net/http/httptest" - "routing-manager/pkg/rtmgr" "testing" ) var ( - XMURL string = "http://127.0.0.1:3000/ric/v1/xapps" + XMURL = "http://127.0.0.1:3000/ric/v1/xapps" + E2MURL = "http://127.0.0.1:8080/ric/v1/e2t/list" ) func TestFetchXappListInvalidData(t *testing.T) { var httpGetter = NewHttpGetter() - _, err := httpGetter.FetchAllXapps(XMURL) + _, err := httpGetter.FetchAllXApps(XMURL) if err == nil { t.Error("No XApp data received: " + err.Error()) } } func TestFetchXappListWithInvalidData(t *testing.T) { - var expected int = 0 - rtmgr.SetLogLevel("debug") + var expected = 0 b := []byte(`{"ID":"deadbeef1234567890", "Version":0, "EventType":"all"}`) l, err := net.Listen("tcp", "127.0.0.1:3000") if err != nil { @@ -68,7 +72,7 @@ func TestFetchXappListWithInvalidData(t *testing.T) { ts.Start() defer ts.Close() var httpGetter = NewHttpGetter() - xapplist, err := httpGetter.FetchAllXapps(XMURL) + xapplist, err := httpGetter.FetchAllXApps(XMURL) if err == nil { t.Error("Error occured: " + err.Error()) } else { @@ -79,8 +83,8 @@ func TestFetchXappListWithInvalidData(t *testing.T) { } } -func TestFetchAllXappsWithValidData(t *testing.T) { - var expected int = 1 +func TestFetchAllXAppsWithValidData(t *testing.T) { + var expected = 1 b := []byte(`[ { "name":"xapp-01","status":"unknown","version":"1.2.3", @@ -116,7 +120,7 @@ func TestFetchAllXappsWithValidData(t *testing.T) { ts.Start() defer ts.Close() var httpGetter = NewHttpGetter() - xapplist, err := httpGetter.FetchAllXapps(XMURL) + xapplist, err := httpGetter.FetchAllXApps(XMURL) if err != nil { t.Error("Error occured: " + err.Error()) } else {