Loading go-apps/meep-app-enablement/server/mae_test.go +15 −41 Original line number Diff line number Diff line Loading @@ -7045,7 +7045,7 @@ func TestAppRegistrationPUT(t *testing.T) { subscriptionId, _ := testAppRegistrationPOST(t, appInstanceId, true) // PUT testAppRegistrationPUT(t, appInstanceId, subscriptionId, true) testAppRegistrationPUT(t, appInstanceId, true) // DELETE testAppRegistrationDelete(t, appInstanceId, subscriptionId, true) Loading @@ -7057,26 +7057,9 @@ func TestAppRegistrationPUT(t *testing.T) { terminateScenario() } func testAppRegistrationPUT(t *testing.T, appInstanceId string, subscriptionId string, expectSuccess bool) string { func testAppRegistrationPUT(t *testing.T, appInstanceId string, expectSuccess bool) string { fmt.Println(">>> testAppRegistrationPUT") /****************************** * expected response section ******************************/ appDId := uuid.New().String() expectedAppInfo := as.AppInfo{ AppName: "MyAppName", AppProvider: "MyAppProvider2", AppDId: appDId, AppInstanceId: appInstanceId, IsInsByMec: true, } expectedResponseStr, err := json.Marshal(expectedAppInfo) if err != nil { t.Fatalf(err.Error()) } fmt.Println("expectedResponseStr: ", string(expectedResponseStr)) /****************************** * request vars section ******************************/ Loading @@ -7086,14 +7069,7 @@ func testAppRegistrationPUT(t *testing.T, appInstanceId string, subscriptionId s /****************************** * request body section ******************************/ /****************************** * request queries section ******************************/ /****************************** * request execution section ******************************/ appDId := uuid.New().String() appInfo := as.AppInfo{ AppName: "MyAppName", AppProvider: "MyAppProvider2", Loading @@ -7106,31 +7082,29 @@ func testAppRegistrationPUT(t *testing.T, appInstanceId string, subscriptionId s t.Fatalf(err.Error()) } fmt.Println("body: ", string(body)) /****************************** * request queries section ******************************/ /****************************** * request execution section ******************************/ if expectSuccess { rr, err := sendRequest(http.MethodPost, "/mec_app_support/v2/registrations/"+appInstanceId, bytes.NewBuffer(body), vars, nil, nil, http.StatusOK, as.AppRegistrationPUT) _, err := sendRequest(http.MethodPost, "/mec_app_support/v2/registrations/"+appInstanceId, bytes.NewBuffer(body), vars, nil, nil, http.StatusNoContent, as.AppRegistrationPUT) if err != nil { t.Fatalf(err.Error()) } fmt.Println("sendRequest done") var respBody as.AppInfo err = json.Unmarshal([]byte(rr), &respBody) if err != nil { t.Fatalf("Failed to get expected response") } fmt.Println("respBody: ", respBody) if !validateAppInfo(respBody, expectedAppInfo) { t.Fatalf("Invalid delta seconds") } return string(expectedResponseStr) } else { _, err := sendRequest(http.MethodPost, "/mec_app_support/v2/registrations/"+appInstanceId, bytes.NewBuffer(body), vars, nil, nil, http.StatusNotFound, as.AppRegistrationPOST) if err != nil { t.Fatalf(err.Error()) } fmt.Println("sendRequest done") return "" } return "" } func TestFailAppRegistrationPUT(t *testing.T) { Loading Loading @@ -7176,7 +7150,7 @@ func TestFailAppRegistrationPUT(t *testing.T) { ******************************/ // PUT testAppRegistrationPUT(t, appInstanceId, "12345", false) testAppRegistrationPUT(t, appInstanceId, false) /****************************** * back to initial state section Loading Loading
go-apps/meep-app-enablement/server/mae_test.go +15 −41 Original line number Diff line number Diff line Loading @@ -7045,7 +7045,7 @@ func TestAppRegistrationPUT(t *testing.T) { subscriptionId, _ := testAppRegistrationPOST(t, appInstanceId, true) // PUT testAppRegistrationPUT(t, appInstanceId, subscriptionId, true) testAppRegistrationPUT(t, appInstanceId, true) // DELETE testAppRegistrationDelete(t, appInstanceId, subscriptionId, true) Loading @@ -7057,26 +7057,9 @@ func TestAppRegistrationPUT(t *testing.T) { terminateScenario() } func testAppRegistrationPUT(t *testing.T, appInstanceId string, subscriptionId string, expectSuccess bool) string { func testAppRegistrationPUT(t *testing.T, appInstanceId string, expectSuccess bool) string { fmt.Println(">>> testAppRegistrationPUT") /****************************** * expected response section ******************************/ appDId := uuid.New().String() expectedAppInfo := as.AppInfo{ AppName: "MyAppName", AppProvider: "MyAppProvider2", AppDId: appDId, AppInstanceId: appInstanceId, IsInsByMec: true, } expectedResponseStr, err := json.Marshal(expectedAppInfo) if err != nil { t.Fatalf(err.Error()) } fmt.Println("expectedResponseStr: ", string(expectedResponseStr)) /****************************** * request vars section ******************************/ Loading @@ -7086,14 +7069,7 @@ func testAppRegistrationPUT(t *testing.T, appInstanceId string, subscriptionId s /****************************** * request body section ******************************/ /****************************** * request queries section ******************************/ /****************************** * request execution section ******************************/ appDId := uuid.New().String() appInfo := as.AppInfo{ AppName: "MyAppName", AppProvider: "MyAppProvider2", Loading @@ -7106,31 +7082,29 @@ func testAppRegistrationPUT(t *testing.T, appInstanceId string, subscriptionId s t.Fatalf(err.Error()) } fmt.Println("body: ", string(body)) /****************************** * request queries section ******************************/ /****************************** * request execution section ******************************/ if expectSuccess { rr, err := sendRequest(http.MethodPost, "/mec_app_support/v2/registrations/"+appInstanceId, bytes.NewBuffer(body), vars, nil, nil, http.StatusOK, as.AppRegistrationPUT) _, err := sendRequest(http.MethodPost, "/mec_app_support/v2/registrations/"+appInstanceId, bytes.NewBuffer(body), vars, nil, nil, http.StatusNoContent, as.AppRegistrationPUT) if err != nil { t.Fatalf(err.Error()) } fmt.Println("sendRequest done") var respBody as.AppInfo err = json.Unmarshal([]byte(rr), &respBody) if err != nil { t.Fatalf("Failed to get expected response") } fmt.Println("respBody: ", respBody) if !validateAppInfo(respBody, expectedAppInfo) { t.Fatalf("Invalid delta seconds") } return string(expectedResponseStr) } else { _, err := sendRequest(http.MethodPost, "/mec_app_support/v2/registrations/"+appInstanceId, bytes.NewBuffer(body), vars, nil, nil, http.StatusNotFound, as.AppRegistrationPOST) if err != nil { t.Fatalf(err.Error()) } fmt.Println("sendRequest done") return "" } return "" } func TestFailAppRegistrationPUT(t *testing.T) { Loading Loading @@ -7176,7 +7150,7 @@ func TestFailAppRegistrationPUT(t *testing.T) { ******************************/ // PUT testAppRegistrationPUT(t, appInstanceId, "12345", false) testAppRegistrationPUT(t, appInstanceId, false) /****************************** * back to initial state section Loading