Cleanup provider validation test 11/10311/2
authorelinuxhenrik <henrik.b.andersson@est.tech>
Fri, 27 Jan 2023 08:40:22 +0000 (09:40 +0100)
committerelinuxhenrik <henrik.b.andersson@est.tech>
Fri, 27 Jan 2023 08:43:22 +0000 (09:43 +0100)
Issue-ID: NONRTRIC-814
Signed-off-by: elinuxhenrik <henrik.b.andersson@est.tech>
Change-Id: Icb272a81501e1bbbe897a775ac29f5f51e340f3d

capifcore/internal/providermanagementapi/typevalidation_test.go

index fb5ad81..3980b19 100644 (file)
@@ -88,55 +88,14 @@ func TestValidateAPIProviderEnrolmentDetails(t *testing.T) {
                assert.Contains(t, err.Error(), "apiProvFuncs")
                assert.Contains(t, err.Error(), "contains invalid")
        }
-}
-
-func TestUpdateFuncs_addNewFunction(t *testing.T) {
-       providerUnderTest := getProvider()
 
-       newFuncInfoAEF := "new func as AEF"
-       newFuncs := append(*providerUnderTest.ApiProvFuncs, APIProviderFunctionDetails{
-               ApiProvFuncInfo: &newFuncInfoAEF,
+       (*providerDetailsUnderTest.ApiProvFuncs)[0] = APIProviderFunctionDetails{
                ApiProvFuncRole: ApiProviderFuncRoleAEF,
-       })
-       providerUnderTest.ApiProvFuncs = &newFuncs
-
-       err := providerUnderTest.UpdateFuncs(getProvider())
-
-       assert.Nil(t, err)
-       assert.Len(t, *providerUnderTest.ApiProvFuncs, 4)
-       assert.True(t, providerUnderTest.IsFunctionRegistered("AEF_id_new_func_as_AEF"))
-}
-
-func TestUpdateFuncs_deleteFunction(t *testing.T) {
-       providerUnderTest := getProvider()
-
-       modFuncs := []APIProviderFunctionDetails{(*providerUnderTest.ApiProvFuncs)[0], (*providerUnderTest.ApiProvFuncs)[1]}
-       providerUnderTest.ApiProvFuncs = &modFuncs
-
-       err := providerUnderTest.UpdateFuncs(getProvider())
-
-       assert.Nil(t, err)
-       assert.Len(t, *providerUnderTest.ApiProvFuncs, 2)
-       assert.True(t, providerUnderTest.IsFunctionRegistered(funcIdAPF))
-       assert.True(t, providerUnderTest.IsFunctionRegistered(funcIdAMF))
-}
-
-func TestUpdateFuncs_unregisteredFunction(t *testing.T) {
-       providerUnderTest := getProvider()
-
-       unRegId := "unRegId"
-       modFuncs := []APIProviderFunctionDetails{
-               {
-                       ApiProvFuncId: &unRegId,
+               RegInfo: RegistrationInformation{
+                       ApiProvPubKey: "key",
                },
        }
-       providerUnderTest.ApiProvFuncs = &modFuncs
-
-       err := providerUnderTest.UpdateFuncs(getProvider())
-       if assert.Error(t, err) {
-               assert.Contains(t, err.Error(), unRegId)
-               assert.Contains(t, err.Error(), "not registered")
-       }
+       assert.Nil(t, providerDetailsUnderTest.Validate())
 }
 
 func getProvider() APIProviderEnrolmentDetails {