X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=pkg%2Fnbi%2Fhttprestful_test.go;h=99dbe74110424ef668a3590eecffe11b1bf1b531;hb=refs%2Fchanges%2F55%2F1055%2F1;hp=a8444253ebbe6344e5af0cb5b061c7f81f2a63aa;hpb=eb2ff0d217caf158dd15424bf70f8aa79c3742b1;p=ric-plt%2Frtmgr.git diff --git a/pkg/nbi/httprestful_test.go b/pkg/nbi/httprestful_test.go index a844425..99dbe74 100644 --- a/pkg/nbi/httprestful_test.go +++ b/pkg/nbi/httprestful_test.go @@ -40,7 +40,7 @@ import ( "time" ) -var BASIC_XAPPLIST = []byte(`[ +var BasicXAppLists = []byte(`[ { "name":"xapp-01","status":"unknown","version":"1.2.3", "instances":[ @@ -56,9 +56,9 @@ var BASIC_XAPPLIST = []byte(`[ } ]`) -var SUBSCRIPTION_RESP = []byte(`{"ID":"deadbeef1234567890", "Version":0, "EventType":"all"}`) +var SubscriptionResp = []byte(`{"ID":"deadbeef1234567890", "Version":0, "EventType":"all"}`) -var INVALID_SUB_RESP = []byte(`{"Version":0, "EventType":all}`) +var InvalidSubResp = []byte(`{"Version":0, "EventType":all}`) func createMockAppmgrWithData(url string, g []byte, p []byte) *httptest.Server { l, err := net.Listen("tcp", url) @@ -84,7 +84,7 @@ func createMockAppmgrWithData(url string, g []byte, p []byte) *httptest.Server { } func createMockPlatformComponents() { - var filename = string("config.json") + var filename = "config.json" file, _ := json.MarshalIndent(stub.ValidPlatformComponents, "", "") filestr := string(file) filestr = "{\"PlatformComponents\":" + filestr + "}" @@ -168,20 +168,20 @@ func TestValidateXappCallbackDataWithInvalidData(t *testing.T) { } } -func TestHttpGetXappsInvalidData(t *testing.T) { - _, err := httpGetXapps(XMURL) +func TestHttpGetXAppsInvalidData(t *testing.T) { + _, err := httpGetXApps(XMURL) if err == nil { t.Error("No XApp data received: " + err.Error()) } } -func TestHttpGetXappsWithValidData(t *testing.T) { - var expected int = 1 - ts := createMockAppmgrWithData("127.0.0.1:3000", BASIC_XAPPLIST, nil) +func TestHttpGetXAppsWithValidData(t *testing.T) { + var expected = 1 + ts := createMockAppmgrWithData("127.0.0.1:3000", BasicXAppLists, nil) ts.Start() defer ts.Close() - xapplist, err := httpGetXapps(XMURL) + xapplist, err := httpGetXApps(XMURL) if err != nil { t.Error("Error occured: " + err.Error()) } else { @@ -203,7 +203,7 @@ func TestRetrieveStartupDataTimeout(t *testing.T) { } func TestRetrieveStartupData(t *testing.T) { - ts := createMockAppmgrWithData("127.0.0.1:3000", BASIC_XAPPLIST, SUBSCRIPTION_RESP) + ts := createMockAppmgrWithData("127.0.0.1:3000", BasicXAppLists, SubscriptionResp) ts.Start() defer ts.Close() sdlEngine, _ := sdl.GetSdl("file") @@ -219,7 +219,7 @@ func TestRetrieveStartupData(t *testing.T) { } func TestRetrieveStartupDataWithInvalidSubResp(t *testing.T) { - ts := createMockAppmgrWithData("127.0.0.1:3000", BASIC_XAPPLIST, INVALID_SUB_RESP) + ts := createMockAppmgrWithData("127.0.0.1:3000", BasicXAppLists, InvalidSubResp) ts.Start() defer ts.Close() sdlEngine, _ := sdl.GetSdl("file")