From 920370599228bcd41e3e87ef63128b4c85b054bc Mon Sep 17 00:00:00 2001 From: Vivek Singh Chauhan Date: Thu, 22 Sep 2022 08:07:22 -0700 Subject: [PATCH] APIGOV-23681 - added unit test --- pkg/agent/handler/credential_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pkg/agent/handler/credential_test.go b/pkg/agent/handler/credential_test.go index 5bfddd118..abeb1593a 100644 --- a/pkg/agent/handler/credential_test.go +++ b/pkg/agent/handler/credential_test.go @@ -410,6 +410,12 @@ func Test_creds(t *testing.T) { "def": "789", }, id: "cred-id", + credSchema: map[string]interface{}{ + "properties": "test", + }, + credProvSchema: map[string]interface{}{ + "properties": "test", + }, } assert.Equal(t, c.managedApp, c.GetApplicationName()) @@ -418,11 +424,20 @@ func Test_creds(t *testing.T) { assert.Equal(t, c.credData, c.GetCredentialData()) assert.Equal(t, c.credDetails["abc"], c.GetCredentialDetailsValue("abc")) assert.Equal(t, c.appDetails["def"], c.GetApplicationDetailsValue("def")) + assert.Equal(t, c.credSchema, c.GetCredentialSchema()) + assert.Equal(t, c.credProvSchema, c.GetCredentialProvisionSchema()) + assert.Empty(t, c.GetCredentialSchemaDetailsValue("prop")) + + c.credSchemaDetails = map[string]interface{}{ + "detail": "test", + } + assert.Equal(t, c.credSchemaDetails["prop"], c.GetCredentialSchemaDetailsValue("prop")) c.credDetails = nil c.appDetails = nil assert.Empty(t, c.GetApplicationDetailsValue("app_details_key")) assert.Empty(t, c.GetCredentialDetailsValue("access_details_key")) + assert.Empty(t, c.GetCredentialSchemaDetailsValue("invalid_key")) } func TestIDPCredentialProvisioning(t *testing.T) {