Type validation in publish service
[nonrtric/plt/sme.git] / capifcore / internal / invokermanagement / invokermanagement_test.go
index 4613cc4..e5fa008 100644 (file)
@@ -80,7 +80,7 @@ func TestOnboardInvoker(t *testing.T) {
        assert.True(t, invokerUnderTest.VerifyInvokerSecret(wantedInvokerId, wantedInvokerSecret))
        publishRegisterMock.AssertCalled(t, "GetAllPublishedServices")
        assert.Equal(t, invokermanagementapi.APIList(publishedServices), *resultInvoker.ApiList)
-       if invokerEvent, ok := waitForEvent(eventChannel, 1*time.Second); ok {
+       if invokerEvent, timeout := waitForEvent(eventChannel, 1*time.Second); timeout {
                assert.Fail(t, "No event sent")
        } else {
                assert.Equal(t, *resultInvoker.ApiInvokerId, (*invokerEvent.EventDetail.ApiInvokerIds)[0])
@@ -106,7 +106,7 @@ func TestOnboardInvoker(t *testing.T) {
 
        // Onboard an invoker missing required OnboardingInformation.ApiInvokerPublicKey, should get 400 with problem details
        invalidInvoker = invokermanagementapi.APIInvokerEnrolmentDetails{
-               NotificationDestination: "url",
+               NotificationDestination: "http://golang.cafe/",
        }
 
        result = testutil.NewRequest().Post("/onboardedInvokers").WithJsonBody(invalidInvoker).Go(t, requestHandler)
@@ -138,7 +138,7 @@ func TestDeleteInvoker(t *testing.T) {
 
        assert.Equal(t, http.StatusNoContent, result.Code())
        assert.False(t, invokerUnderTest.IsInvokerRegistered(invokerId))
-       if invokerEvent, ok := waitForEvent(eventChannel, 1*time.Second); ok {
+       if invokerEvent, timeout := waitForEvent(eventChannel, 1*time.Second); timeout {
                assert.Fail(t, "No event sent")
        } else {
                assert.Equal(t, invokerId, (*invokerEvent.EventDetail.ApiInvokerIds)[0])
@@ -154,7 +154,7 @@ func TestUpdateInvoker(t *testing.T) {
        invokerId := "invokerId"
        invoker := invokermanagementapi.APIInvokerEnrolmentDetails{
                ApiInvokerId:            &invokerId,
-               NotificationDestination: "url",
+               NotificationDestination: "http://golang.cafe/",
                OnboardingInformation: invokermanagementapi.OnboardingInformation{
                        ApiInvokerPublicKey: "key",
                },
@@ -162,7 +162,7 @@ func TestUpdateInvoker(t *testing.T) {
        serviceUnderTest.onboardedInvokers[invokerId] = invoker
 
        // Update the invoker with valid invoker, should return 200 with updated invoker details
-       newNotifURL := "newUrl"
+       newNotifURL := "http://golang.org/"
        invoker.NotificationDestination = common29122.Uri(newNotifURL)
        newPublicKey := "newPublicKey"
        invoker.OnboardingInformation.ApiInvokerPublicKey = newPublicKey
@@ -196,7 +196,7 @@ func TestUpdateInvoker(t *testing.T) {
        assert.Contains(t, *problemDetails.Cause, "NotificationDestination")
 
        // Update with an invoker missing required OnboardingInformation.ApiInvokerPublicKey, should get 400 with problem details
-       invalidInvoker.NotificationDestination = "url"
+       invalidInvoker.NotificationDestination = "http://golang.org/"
        invalidInvoker.OnboardingInformation = invokermanagementapi.OnboardingInformation{}
        result = testutil.NewRequest().Put("/onboardedInvokers/"+invokerId).WithJsonBody(invalidInvoker).Go(t, requestHandler)
 
@@ -220,7 +220,7 @@ func TestUpdateInvoker(t *testing.T) {
        assert.Contains(t, *problemDetails.Cause, "not matching")
        assert.Contains(t, *problemDetails.Cause, "ApiInvokerId")
 
-       // Update an invoker that has not been onboarded, shold get 404 with problem details
+       // Update an invoker that has not been onboarded, should get 404 with problem details
        missingId := "1"
        invoker.ApiInvokerId = &missingId
        result = testutil.NewRequest().Put("/onboardedInvokers/"+missingId).WithJsonBody(invoker).Go(t, requestHandler)
@@ -312,7 +312,7 @@ func getAefProfile(aefId string) publishserviceapi.AefProfile {
 func getInvoker(invokerInfo string) invokermanagementapi.APIInvokerEnrolmentDetails {
        newInvoker := invokermanagementapi.APIInvokerEnrolmentDetails{
                ApiInvokerInformation:   &invokerInfo,
-               NotificationDestination: "url",
+               NotificationDestination: "http://golang.cafe/",
                OnboardingInformation: invokermanagementapi.OnboardingInformation{
                        ApiInvokerPublicKey: "key",
                },