github.com/kyma-project/kyma-environment-broker@v0.0.1/internal/ias/assertion_attribute_test.go (about)

     1  package ias
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  )
     8  
     9  func TestAssertionAttributeDeliver_GenerateAssertionAttribute(t *testing.T) {
    10  	// given
    11  	attr := NewAssertionAttributeDeliver()
    12  
    13  	// when
    14  	attributes := attr.GenerateAssertionAttribute(ServiceProvider{
    15  		AssertionAttributes: []AssertionAttribute{
    16  			{
    17  				AssertionAttribute: "last_name",
    18  				UserAttribute:      "lastName",
    19  			},
    20  			{
    21  				AssertionAttribute: "should_be_removed",
    22  				UserAttribute:      "shouldBeRemoved",
    23  			},
    24  		},
    25  	})
    26  
    27  	// then
    28  	assert.ElementsMatch(t, []AssertionAttribute{
    29  		{
    30  			AssertionAttribute: "first_name",
    31  			UserAttribute:      "firstName",
    32  		},
    33  		{
    34  			AssertionAttribute: "last_name",
    35  			UserAttribute:      "lastName",
    36  		},
    37  		{
    38  			AssertionAttribute: "email",
    39  			UserAttribute:      "mail",
    40  		},
    41  		{
    42  			AssertionAttribute: "groups",
    43  			UserAttribute:      "companyGroups",
    44  		},
    45  	}, attributes)
    46  }