X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=capifcore%2Finternal%2Fpublishservice%2Fpublishservice_test.go;fp=capifcore%2Finternal%2Fpublishservice%2Fpublishservice_test.go;h=3c19204ac496c7d2bad8a5ca0d74840ede98c9af;hb=c3cc44190afd4793d76f3cc5814b8b5e79267fb3;hp=ffbfba38e63bbb4ca6e83e17834912c3610596f3;hpb=590dbe9389e8d8746bbcf30fc8b74d0f4ee81a1b;p=nonrtric%2Fplt%2Fsme.git diff --git a/capifcore/internal/publishservice/publishservice_test.go b/capifcore/internal/publishservice/publishservice_test.go index ffbfba3..3c19204 100644 --- a/capifcore/internal/publishservice/publishservice_test.go +++ b/capifcore/internal/publishservice/publishservice_test.go @@ -101,6 +101,16 @@ func TestPublishUnpublishService(t *testing.T) { assert.NoError(t, err, "error unmarshaling response") assert.Equal(t, *resultService.ApiId, newApiId) + // Publish the same service again should result in Forbidden + result = testutil.NewRequest().Post("/"+apfId+"/service-apis").WithJsonBody(newServiceDescription).Go(t, requestHandler) + + assert.Equal(t, http.StatusForbidden, result.Code()) + var resultError common29122.ProblemDetails + err = result.UnmarshalBodyToObject(&resultError) + assert.NoError(t, err, "error unmarshaling response") + assert.Contains(t, *resultError.Cause, "already published") + assert.Equal(t, http.StatusForbidden, *resultError.Status) + // Delete the service helmManagerMock.On("UninstallHelmChart", mock.Anything, mock.Anything).Return(nil) @@ -141,8 +151,7 @@ func TestPostUnpublishedServiceWithUnregisteredFunction(t *testing.T) { assert.NoError(t, err, "error unmarshaling response") assert.Contains(t, *resultError.Cause, aefId) assert.Contains(t, *resultError.Cause, "not registered") - notFound := http.StatusNotFound - assert.Equal(t, ¬Found, resultError.Status) + assert.Equal(t, http.StatusNotFound, *resultError.Status) } func TestGetServices(t *testing.T) {