X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fnbi%2Fhttpgetter_test.go;h=0080a843b5dfcc3699718f8ce72a74cbe1787e22;hb=0e0bfaa85da83b06978def0d818852aaea5aedbf;hp=a6cbbf77a91c349d279e9db64adc18b601338d11;hpb=92162653c9741f2417d1a36ec1c211d6863d0a68;p=ric-plt%2Frtmgr.git diff --git a/pkg/nbi/httpgetter_test.go b/pkg/nbi/httpgetter_test.go index a6cbbf7..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,27 +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()) + 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 { @@ -70,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 { @@ -81,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", @@ -118,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 { @@ -127,4 +129,3 @@ func TestFetchAllXappsWithValidData(t *testing.T) { } } } -