NONRTRIC-946: Confirm ApiProvDomId for PUT equals path param
[nonrtric/plt/sme.git] / capifcore / internal / providermanagement / providermanagement_test.go
index 7d52729..cbcf438 100644 (file)
@@ -62,7 +62,7 @@ func TestFailedUpdateValidProviderWithNewFunction(t *testing.T) {
        // Modify the provider
        updatedProvider := getProvider()
 
-       // We omit to set updatedProvider.ApiProvDomId
+       // For this test case, we do not set updatedProvider.ApiProvDomId, so that we can test for a 400 error below.
        (*updatedProvider.ApiProvFuncs)[0].ApiProvFuncId = &funcIdAPF
        (*updatedProvider.ApiProvFuncs)[1].ApiProvFuncId = &funcIdAMF
        (*updatedProvider.ApiProvFuncs)[2].ApiProvFuncId = &funcIdAEF
@@ -82,13 +82,13 @@ func TestFailedUpdateValidProviderWithNewFunction(t *testing.T) {
        updatedProvider.ApiProvFuncs = &testFuncs
 
        result := testutil.NewRequest().Put("/registrations/"+domainID).WithJsonBody(updatedProvider).Go(t, requestHandler)
-       assert.Equal(t, http.StatusNotFound, result.Code())
+       assert.Equal(t, http.StatusBadRequest, result.Code())
 
        var resultError common29122.ProblemDetails
        err := result.UnmarshalJsonToObject(&resultError)
        assert.NoError(t, err, "error unmarshaling response")
 
-       assert.Contains(t, *resultError.Cause, "APIProviderEnrolmentDetails missing required ApiProvDomId")
+       assert.Contains(t, *resultError.Cause, "APIProviderEnrolmentDetails ApiProvDomId doesn't match path parameter")
        assert.False(t, managerUnderTest.IsFunctionRegistered("AEF_id_new_func_as_AEF"))
 }