Refactor check earlier registration
[nonrtric/plt/sme.git] / capifcore / internal / invokermanagementapi / typevalidation_test.go
index 58cd655..499b0a1 100644 (file)
@@ -53,3 +53,22 @@ func TestValidateInvoker(t *testing.T) {
        err = invokerUnderTest.Validate()
        assert.Nil(t, err)
 }
+
+func TestIsOnboarded(t *testing.T) {
+       publicKey := "publicKey"
+       invokerUnderTest := APIInvokerEnrolmentDetails{
+               OnboardingInformation: OnboardingInformation{
+                       ApiInvokerPublicKey: publicKey,
+               },
+       }
+
+       otherInvoker := APIInvokerEnrolmentDetails{
+               OnboardingInformation: OnboardingInformation{
+                       ApiInvokerPublicKey: "otherPublicKey",
+               },
+       }
+       assert.False(t, invokerUnderTest.IsOnboarded(otherInvoker))
+
+       otherInvoker.OnboardingInformation.ApiInvokerPublicKey = publicKey
+       assert.True(t, invokerUnderTest.IsOnboarded(otherInvoker))
+}