github.com/kyma-project/kyma-environment-broker@v0.0.1/internal/process/deprovisioning/ias_deregistration_test.go (about) 1 package deprovisioning 2 3 import ( 4 "testing" 5 "time" 6 7 "github.com/kyma-project/kyma-environment-broker/internal" 8 "github.com/kyma-project/kyma-environment-broker/internal/ias" 9 "github.com/kyma-project/kyma-environment-broker/internal/ias/automock" 10 "github.com/kyma-project/kyma-environment-broker/internal/logger" 11 "github.com/kyma-project/kyma-environment-broker/internal/storage" 12 13 "github.com/stretchr/testify/assert" 14 ) 15 16 const iasInstanceID = "9b130e29-7f1c-4778-8f0a-b9110304cf27" 17 18 func TestIASDeregistration_Run(t *testing.T) { 19 // given 20 memoryStorage := storage.NewMemoryStorage() 21 22 bundleBuilder := &automock.BundleBuilder{} 23 defer bundleBuilder.AssertExpectations(t) 24 25 for inputID := range ias.ServiceProviderInputs { 26 bundle := &automock.Bundle{} 27 defer bundle.AssertExpectations(t) 28 bundle.On("DeleteServiceProvider").Return(nil).Once() 29 bundle.On("ServiceProviderName").Return("MockServiceProvider") 30 bundleBuilder.On("NewBundle", iasInstanceID, inputID).Return(bundle, nil).Once() 31 } 32 operation := internal.DeprovisioningOperation{ 33 Operation: internal.Operation{ 34 InstanceID: iasInstanceID, 35 }, 36 } 37 38 step := NewIASDeregistrationStep(memoryStorage.Operations(), bundleBuilder) 39 40 // when 41 _, repeat, err := step.Run(operation.Operation, logger.NewLogDummy()) 42 43 // then 44 assert.Equal(t, time.Duration(0), repeat) 45 assert.NoError(t, err) 46 }