github.com/ablease/cli@v6.37.1-0.20180613014814-3adbb7d7fb19+incompatible/actor/v2action/service_instance_summary_test.go (about)

     1  package v2action_test
     2  
     3  import (
     4  	"errors"
     5  
     6  	. "code.cloudfoundry.org/cli/actor/v2action"
     7  	"code.cloudfoundry.org/cli/actor/v2action/v2actionfakes"
     8  	"code.cloudfoundry.org/cli/api/cloudcontroller/ccerror"
     9  	"code.cloudfoundry.org/cli/api/cloudcontroller/ccv2"
    10  	"code.cloudfoundry.org/cli/api/cloudcontroller/ccv2/constant"
    11  
    12  	. "github.com/onsi/ginkgo"
    13  	. "github.com/onsi/gomega"
    14  )
    15  
    16  var _ = Describe("Service Instance Summary Actions", func() {
    17  	var (
    18  		actor                     *Actor
    19  		fakeCloudControllerClient *v2actionfakes.FakeCloudControllerClient
    20  	)
    21  
    22  	BeforeEach(func() {
    23  		fakeCloudControllerClient = new(v2actionfakes.FakeCloudControllerClient)
    24  		actor = NewActor(fakeCloudControllerClient, nil, nil)
    25  	})
    26  
    27  	Describe("ServiceInstanceSummary", func() {
    28  		var summary ServiceInstanceSummary
    29  
    30  		Describe("IsShareable", func() {
    31  			Context("when the 'service_instance_sharing' feature flag is enabled", func() {
    32  				BeforeEach(func() {
    33  					summary.ServiceInstanceSharingFeatureFlag = true
    34  				})
    35  
    36  				Context("when the service broker has enabled sharing", func() {
    37  					BeforeEach(func() {
    38  						summary.Service.Extra.Shareable = true
    39  					})
    40  
    41  					It("returns true", func() {
    42  						Expect(summary.IsShareable()).To(BeTrue())
    43  					})
    44  				})
    45  
    46  				Context("when the service broker has not enabled sharing", func() {
    47  					BeforeEach(func() {
    48  						summary.Service.Extra.Shareable = false
    49  					})
    50  
    51  					It("returns true", func() {
    52  						Expect(summary.IsShareable()).To(BeFalse())
    53  					})
    54  				})
    55  			})
    56  
    57  			Context("when the 'service_instance_sharing' feature flag is not enabled", func() {
    58  				BeforeEach(func() {
    59  					summary.ServiceInstanceSharingFeatureFlag = false
    60  				})
    61  
    62  				Context("when the service broker has enabled sharing", func() {
    63  					BeforeEach(func() {
    64  						summary.Service.Extra.Shareable = true
    65  					})
    66  
    67  					It("returns true", func() {
    68  						Expect(summary.IsShareable()).To(BeFalse())
    69  					})
    70  				})
    71  
    72  				Context("when the service broker has not enabled sharing", func() {
    73  					BeforeEach(func() {
    74  						summary.Service.Extra.Shareable = false
    75  					})
    76  
    77  					It("returns true", func() {
    78  						Expect(summary.IsShareable()).To(BeFalse())
    79  					})
    80  				})
    81  			})
    82  		})
    83  	})
    84  
    85  	Describe("GetServiceInstanceSummaryByNameAndSpace", func() {
    86  		var (
    87  			summary         ServiceInstanceSummary
    88  			summaryWarnings Warnings
    89  			summaryErr      error
    90  		)
    91  
    92  		JustBeforeEach(func() {
    93  			summary, summaryWarnings, summaryErr = actor.GetServiceInstanceSummaryByNameAndSpace("some-service-instance", "some-space-guid")
    94  		})
    95  
    96  		Context("when an error is encountered getting the service instance", func() {
    97  			var expectedErr error
    98  
    99  			BeforeEach(func() {
   100  				expectedErr = errors.New("get space service instance error")
   101  				fakeCloudControllerClient.GetSpaceServiceInstancesReturns(
   102  					[]ccv2.ServiceInstance{},
   103  					ccv2.Warnings{"get-space-service-instance-warning"},
   104  					expectedErr)
   105  			})
   106  
   107  			It("returns the error and all warnings", func() {
   108  				Expect(summaryErr).To(MatchError(expectedErr))
   109  				Expect(summaryWarnings).To(ConsistOf("get-space-service-instance-warning"))
   110  
   111  				Expect(fakeCloudControllerClient.GetSpaceServiceInstancesCallCount()).To(Equal(1))
   112  				spaceGUIDArg, getUserProvidedServicesArg, queriesArg := fakeCloudControllerClient.GetSpaceServiceInstancesArgsForCall(0)
   113  				Expect(spaceGUIDArg).To(Equal("some-space-guid"))
   114  				Expect(getUserProvidedServicesArg).To(BeTrue())
   115  				Expect(queriesArg).To(HaveLen(1))
   116  				Expect(queriesArg[0]).To(Equal(ccv2.Filter{
   117  					Type:     constant.NameFilter,
   118  					Operator: constant.EqualOperator,
   119  					Values:   []string{"some-service-instance"},
   120  				}))
   121  			})
   122  		})
   123  
   124  		Context("when no errors are encountered getting the service instance", func() {
   125  			var (
   126  				returnedServiceInstance ccv2.ServiceInstance
   127  				returnedFeatureFlag     ccv2.FeatureFlag
   128  			)
   129  
   130  			Context("when the service instance is a managed service instance", func() {
   131  				BeforeEach(func() {
   132  					returnedServiceInstance = ccv2.ServiceInstance{
   133  						DashboardURL:    "some-dashboard",
   134  						GUID:            "some-service-instance-guid",
   135  						Name:            "some-service-instance",
   136  						ServiceGUID:     "some-service-guid",
   137  						ServicePlanGUID: "some-service-plan-guid",
   138  						Tags:            []string{"tag-1", "tag-2"},
   139  						Type:            constant.ServiceInstanceTypeManagedService,
   140  					}
   141  					fakeCloudControllerClient.GetSpaceServiceInstancesReturns(
   142  						[]ccv2.ServiceInstance{returnedServiceInstance},
   143  						ccv2.Warnings{"get-space-service-instance-warning"},
   144  						nil)
   145  
   146  					returnedFeatureFlag = ccv2.FeatureFlag{
   147  						Name:    "service_instance_sharing",
   148  						Enabled: true,
   149  					}
   150  					fakeCloudControllerClient.GetConfigFeatureFlagsReturns(
   151  						[]ccv2.FeatureFlag{returnedFeatureFlag},
   152  						ccv2.Warnings{"get-feature-flags-warning"},
   153  						nil)
   154  				})
   155  
   156  				It("returns the service instance info and all warnings", func() {
   157  					Expect(summaryErr).ToNot(HaveOccurred())
   158  					Expect(summary.ServiceInstance).To(Equal(ServiceInstance(returnedServiceInstance)))
   159  					Expect(summaryWarnings).To(ConsistOf("get-space-service-instance-warning", "get-feature-flags-warning"))
   160  
   161  					Expect(fakeCloudControllerClient.GetSpaceServiceInstancesCallCount()).To(Equal(1))
   162  					spaceGUIDArg, getUserProvidedServicesArg, queriesArg := fakeCloudControllerClient.GetSpaceServiceInstancesArgsForCall(0)
   163  					Expect(spaceGUIDArg).To(Equal("some-space-guid"))
   164  					Expect(getUserProvidedServicesArg).To(BeTrue())
   165  					Expect(queriesArg).To(HaveLen(1))
   166  					Expect(queriesArg[0]).To(Equal(ccv2.Filter{
   167  						Type:     constant.NameFilter,
   168  						Operator: constant.EqualOperator,
   169  						Values:   []string{"some-service-instance"},
   170  					}))
   171  				})
   172  
   173  				Context("when the service instance is shared from another space (not created in the currently targeted space)", func() {
   174  					Context("when the source space of the service instance is different from the currently targeted space", func() {
   175  						BeforeEach(func() {
   176  							returnedServiceInstance.SpaceGUID = "not-currently-targeted-space-guid"
   177  							fakeCloudControllerClient.GetSpaceServiceInstancesReturns(
   178  								[]ccv2.ServiceInstance{returnedServiceInstance},
   179  								ccv2.Warnings{"get-space-service-instance-warning"},
   180  								nil)
   181  						})
   182  
   183  						Context("when an error is encountered getting the shared_from information", func() {
   184  							var expectedErr error
   185  
   186  							Context("when the error is generic", func() {
   187  								BeforeEach(func() {
   188  									expectedErr = errors.New("get-service-instance-shared-from-error")
   189  									fakeCloudControllerClient.GetServiceInstanceSharedFromReturns(
   190  										ccv2.ServiceInstanceSharedFrom{},
   191  										ccv2.Warnings{"get-service-instance-shared-from-warning"},
   192  										expectedErr,
   193  									)
   194  								})
   195  
   196  								It("returns the error and all warnings", func() {
   197  									Expect(summaryErr).To(MatchError(expectedErr))
   198  									Expect(summaryWarnings).To(ConsistOf("get-service-instance-shared-from-warning", "get-feature-flags-warning", "get-space-service-instance-warning"))
   199  
   200  									Expect(fakeCloudControllerClient.GetServiceInstanceSharedFromCallCount()).To(Equal(1))
   201  									Expect(fakeCloudControllerClient.GetServiceInstanceSharedFromArgsForCall(0)).To(Equal(returnedServiceInstance.GUID))
   202  									Expect(fakeCloudControllerClient.GetServiceInstanceSharedTosCallCount()).To(Equal(0))
   203  								})
   204  							})
   205  
   206  							Context("when the API version does not support service instance sharing", func() {
   207  								BeforeEach(func() {
   208  									expectedErr = ccerror.ResourceNotFoundError{}
   209  									fakeCloudControllerClient.GetServiceInstanceSharedFromReturns(
   210  										ccv2.ServiceInstanceSharedFrom{},
   211  										ccv2.Warnings{"get-service-instance-shared-from-warning"},
   212  										expectedErr,
   213  									)
   214  								})
   215  
   216  								It("ignores the 404 error and continues without shared_from information", func() {
   217  									Expect(summaryErr).ToNot(HaveOccurred())
   218  									Expect(summaryWarnings).To(ConsistOf("get-service-instance-shared-from-warning", "get-feature-flags-warning", "get-space-service-instance-warning"))
   219  									Expect(summary.ServiceInstanceSharedFrom).To(Equal(ServiceInstanceSharedFrom{}))
   220  									Expect(fakeCloudControllerClient.GetServiceInstanceSharedFromCallCount()).To(Equal(1))
   221  									Expect(fakeCloudControllerClient.GetServiceInstanceSharedFromArgsForCall(0)).To(Equal(returnedServiceInstance.GUID))
   222  									Expect(fakeCloudControllerClient.GetServiceInstanceSharedTosCallCount()).To(Equal(0))
   223  								})
   224  							})
   225  						})
   226  
   227  						Context("when no errors are encountered getting the shared_from information", func() {
   228  							Context("when the shared_from info is NOT empty", func() {
   229  								var returnedServiceSharedFrom ccv2.ServiceInstanceSharedFrom
   230  
   231  								BeforeEach(func() {
   232  									returnedServiceSharedFrom = ccv2.ServiceInstanceSharedFrom{
   233  										SpaceGUID:        "some-space-guid",
   234  										SpaceName:        "some-space-name",
   235  										OrganizationName: "some-org-name",
   236  									}
   237  									fakeCloudControllerClient.GetServiceInstanceSharedFromReturns(
   238  										returnedServiceSharedFrom,
   239  										ccv2.Warnings{"get-service-instance-shared-from-warning"},
   240  										nil)
   241  								})
   242  
   243  								It("returns the service instance share type, shared_from info, and all warnings", func() {
   244  									Expect(summaryErr).ToNot(HaveOccurred())
   245  									Expect(summary.ServiceInstance).To(Equal(ServiceInstance(returnedServiceInstance)))
   246  									Expect(summary.ServiceInstanceSharingFeatureFlag).To(BeTrue())
   247  									Expect(summary.ServiceInstanceShareType).To(Equal(ServiceInstanceIsSharedFrom))
   248  									Expect(summary.ServiceInstanceSharedFrom).To(Equal(ServiceInstanceSharedFrom(returnedServiceSharedFrom)))
   249  									Expect(summaryWarnings).To(ConsistOf("get-service-instance-shared-from-warning", "get-feature-flags-warning", "get-space-service-instance-warning"))
   250  
   251  									Expect(fakeCloudControllerClient.GetConfigFeatureFlagsCallCount()).To(Equal(1))
   252  
   253  									Expect(fakeCloudControllerClient.GetServiceInstanceSharedFromCallCount()).To(Equal(1))
   254  									Expect(fakeCloudControllerClient.GetServiceInstanceSharedFromArgsForCall(0)).To(Equal(returnedServiceInstance.GUID))
   255  									Expect(fakeCloudControllerClient.GetServiceInstanceSharedTosCallCount()).To(Equal(0))
   256  								})
   257  							})
   258  
   259  							Context("when the shared_from info is empty", func() {
   260  								It("sets the share type to not shared", func() {
   261  									Expect(summaryErr).ToNot(HaveOccurred())
   262  									Expect(summary.ServiceInstanceShareType).To(Equal(ServiceInstanceIsNotShared))
   263  								})
   264  							})
   265  						})
   266  					})
   267  
   268  					Context("when the source space of the service instance is 'null'", func() {
   269  						BeforeEach(func() {
   270  							// API returns a json null value that is unmarshalled into the empty string
   271  							returnedServiceInstance.SpaceGUID = ""
   272  							fakeCloudControllerClient.GetSpaceServiceInstancesReturns(
   273  								[]ccv2.ServiceInstance{returnedServiceInstance},
   274  								ccv2.Warnings{"get-space-service-instance-warning"},
   275  								nil)
   276  						})
   277  
   278  						Context("when an error is encountered getting the shared_from information", func() {
   279  							var expectedErr error
   280  
   281  							Context("when the error is generic", func() {
   282  								BeforeEach(func() {
   283  									expectedErr = errors.New("get-service-instance-shared-from-error")
   284  									fakeCloudControllerClient.GetServiceInstanceSharedFromReturns(
   285  										ccv2.ServiceInstanceSharedFrom{},
   286  										ccv2.Warnings{"get-service-instance-shared-from-warning"},
   287  										expectedErr,
   288  									)
   289  								})
   290  
   291  								It("returns the error and all warnings", func() {
   292  									Expect(summaryErr).To(MatchError(expectedErr))
   293  									Expect(summaryWarnings).To(ConsistOf("get-service-instance-shared-from-warning", "get-feature-flags-warning", "get-space-service-instance-warning"))
   294  									Expect(fakeCloudControllerClient.GetServiceInstanceSharedFromCallCount()).To(Equal(1))
   295  									Expect(fakeCloudControllerClient.GetServiceInstanceSharedFromArgsForCall(0)).To(Equal(returnedServiceInstance.GUID))
   296  								})
   297  							})
   298  
   299  							Context("when the API version does not support service instance sharing", func() {
   300  								BeforeEach(func() {
   301  									expectedErr = ccerror.ResourceNotFoundError{}
   302  									fakeCloudControllerClient.GetServiceInstanceSharedFromReturns(
   303  										ccv2.ServiceInstanceSharedFrom{},
   304  										ccv2.Warnings{"get-service-instance-shared-from-warning"},
   305  										expectedErr,
   306  									)
   307  								})
   308  
   309  								It("ignores the 404 error and continues without shared_from information", func() {
   310  									Expect(summaryErr).ToNot(HaveOccurred())
   311  									Expect(summaryWarnings).To(ConsistOf("get-service-instance-shared-from-warning", "get-feature-flags-warning", "get-space-service-instance-warning"))
   312  									Expect(summary.ServiceInstanceSharedFrom).To(Equal(ServiceInstanceSharedFrom{}))
   313  									Expect(fakeCloudControllerClient.GetServiceInstanceSharedFromCallCount()).To(Equal(1))
   314  									Expect(fakeCloudControllerClient.GetServiceInstanceSharedFromArgsForCall(0)).To(Equal(returnedServiceInstance.GUID))
   315  								})
   316  							})
   317  						})
   318  
   319  						Context("when no errors are encountered getting the shared_from information", func() {
   320  							Context("when the shared_from info is NOT empty", func() {
   321  								var returnedServiceSharedFrom ccv2.ServiceInstanceSharedFrom
   322  
   323  								BeforeEach(func() {
   324  									returnedServiceSharedFrom = ccv2.ServiceInstanceSharedFrom{
   325  										SpaceGUID:        "some-space-guid",
   326  										SpaceName:        "some-space-name",
   327  										OrganizationName: "some-org-name",
   328  									}
   329  									fakeCloudControllerClient.GetServiceInstanceSharedFromReturns(
   330  										returnedServiceSharedFrom,
   331  										ccv2.Warnings{"get-service-instance-shared-from-warning"},
   332  										nil)
   333  								})
   334  
   335  								It("returns the service instance share type, shared_from info, and all warnings", func() {
   336  									Expect(summaryErr).ToNot(HaveOccurred())
   337  									Expect(summary.ServiceInstance).To(Equal(ServiceInstance(returnedServiceInstance)))
   338  									Expect(summary.ServiceInstanceSharingFeatureFlag).To(BeTrue())
   339  									Expect(summary.ServiceInstanceShareType).To(Equal(ServiceInstanceIsSharedFrom))
   340  									Expect(summary.ServiceInstanceSharedFrom).To(Equal(ServiceInstanceSharedFrom(returnedServiceSharedFrom)))
   341  									Expect(summaryWarnings).To(ConsistOf("get-space-service-instance-warning", "get-feature-flags-warning", "get-service-instance-shared-from-warning"))
   342  
   343  									Expect(fakeCloudControllerClient.GetConfigFeatureFlagsCallCount()).To(Equal(1))
   344  
   345  									Expect(fakeCloudControllerClient.GetServiceInstanceSharedFromCallCount()).To(Equal(1))
   346  									Expect(fakeCloudControllerClient.GetServiceInstanceSharedFromArgsForCall(0)).To(Equal(returnedServiceInstance.GUID))
   347  									Expect(fakeCloudControllerClient.GetServiceInstanceSharedTosCallCount()).To(Equal(0))
   348  								})
   349  							})
   350  
   351  							Context("when the shared_from info is empty", func() {
   352  								It("sets the share type to not shared", func() {
   353  									Expect(summaryErr).ToNot(HaveOccurred())
   354  									Expect(summary.ServiceInstanceShareType).To(Equal(ServiceInstanceIsNotShared))
   355  								})
   356  							})
   357  						})
   358  					})
   359  				})
   360  
   361  				Context("when the service instance is shared to other spaces", func() {
   362  					Context("when the source space of the service instance is the same as the currently targeted space", func() {
   363  						BeforeEach(func() {
   364  							returnedServiceInstance.SpaceGUID = "some-space-guid"
   365  							fakeCloudControllerClient.GetSpaceServiceInstancesReturns(
   366  								[]ccv2.ServiceInstance{returnedServiceInstance},
   367  								ccv2.Warnings{"get-space-service-instance-warning"},
   368  								nil)
   369  						})
   370  
   371  						Context("when an error is encountered getting the shared_to information", func() {
   372  							var expectedErr error
   373  
   374  							Context("when the error is generic", func() {
   375  								BeforeEach(func() {
   376  									expectedErr = errors.New("get-service-instance-shared-tos-error")
   377  									fakeCloudControllerClient.GetServiceInstanceSharedTosReturns(
   378  										[]ccv2.ServiceInstanceSharedTo{},
   379  										ccv2.Warnings{"get-service-instance-shared-tos-warning"},
   380  										expectedErr,
   381  									)
   382  								})
   383  
   384  								It("returns the error and all warnings", func() {
   385  									Expect(summaryErr).To(MatchError(expectedErr))
   386  									Expect(summaryWarnings).To(ConsistOf("get-service-instance-shared-tos-warning", "get-feature-flags-warning", "get-space-service-instance-warning"))
   387  									Expect(fakeCloudControllerClient.GetServiceInstanceSharedTosCallCount()).To(Equal(1))
   388  									Expect(fakeCloudControllerClient.GetServiceInstanceSharedTosArgsForCall(0)).To(Equal(returnedServiceInstance.GUID))
   389  									Expect(fakeCloudControllerClient.GetServiceInstanceSharedFromCallCount()).To(Equal(0))
   390  								})
   391  							})
   392  
   393  							Context("when the API version does not support service instance sharing", func() {
   394  								BeforeEach(func() {
   395  									expectedErr = ccerror.ResourceNotFoundError{}
   396  									fakeCloudControllerClient.GetServiceInstanceSharedTosReturns(
   397  										[]ccv2.ServiceInstanceSharedTo{},
   398  										ccv2.Warnings{"get-service-instance-shared-tos-warning"},
   399  										expectedErr,
   400  									)
   401  								})
   402  
   403  								It("ignores the 404 error and continues without shared_to information", func() {
   404  									Expect(summaryErr).ToNot(HaveOccurred())
   405  									Expect(summaryWarnings).To(ConsistOf("get-service-instance-shared-tos-warning", "get-feature-flags-warning", "get-space-service-instance-warning"))
   406  									Expect(fakeCloudControllerClient.GetServiceInstanceSharedTosCallCount()).To(Equal(1))
   407  									Expect(fakeCloudControllerClient.GetServiceInstanceSharedTosArgsForCall(0)).To(Equal(returnedServiceInstance.GUID))
   408  									Expect(fakeCloudControllerClient.GetServiceInstanceSharedFromCallCount()).To(Equal(0))
   409  								})
   410  							})
   411  						})
   412  
   413  						Context("when no errors are encountered getting the shared_to information", func() {
   414  							Context("when the shared_to info is NOT an empty list", func() {
   415  								var returnedServiceSharedTos []ccv2.ServiceInstanceSharedTo
   416  
   417  								BeforeEach(func() {
   418  									returnedServiceSharedTos = []ccv2.ServiceInstanceSharedTo{
   419  										{
   420  											SpaceGUID:        "some-space-guid",
   421  											SpaceName:        "some-space-name",
   422  											OrganizationName: "some-org-name",
   423  										},
   424  										{
   425  											SpaceGUID:        "some-space-guid2",
   426  											SpaceName:        "some-space-name2",
   427  											OrganizationName: "some-org-name2",
   428  										},
   429  									}
   430  
   431  									fakeCloudControllerClient.GetServiceInstanceSharedTosReturns(
   432  										returnedServiceSharedTos,
   433  										ccv2.Warnings{"get-service-instance-shared-tos-warning"},
   434  										nil)
   435  								})
   436  
   437  								It("returns the service instance share type, shared_to info, and all warnings", func() {
   438  									Expect(summaryErr).ToNot(HaveOccurred())
   439  									Expect(summary.ServiceInstance).To(Equal(ServiceInstance(returnedServiceInstance)))
   440  									Expect(summary.ServiceInstanceSharingFeatureFlag).To(BeTrue())
   441  									Expect(summary.ServiceInstanceShareType).To(Equal(ServiceInstanceIsSharedTo))
   442  									Expect(summary.ServiceInstanceSharedTos).To(ConsistOf(ServiceInstanceSharedTo(returnedServiceSharedTos[0]), ServiceInstanceSharedTo(returnedServiceSharedTos[1])))
   443  									Expect(summaryWarnings).To(ConsistOf("get-service-instance-shared-tos-warning", "get-feature-flags-warning", "get-space-service-instance-warning"))
   444  
   445  									Expect(fakeCloudControllerClient.GetConfigFeatureFlagsCallCount()).To(Equal(1))
   446  
   447  									Expect(fakeCloudControllerClient.GetServiceInstanceSharedTosCallCount()).To(Equal(1))
   448  									Expect(fakeCloudControllerClient.GetServiceInstanceSharedTosArgsForCall(0)).To(Equal(returnedServiceInstance.GUID))
   449  									Expect(fakeCloudControllerClient.GetServiceInstanceSharedFromCallCount()).To(Equal(0))
   450  								})
   451  							})
   452  
   453  							Context("when the shared_to info is an empty list", func() {
   454  								It("sets the share type to not shared", func() {
   455  									Expect(summaryErr).ToNot(HaveOccurred())
   456  									Expect(summary.ServiceInstanceShareType).To(Equal(ServiceInstanceIsNotShared))
   457  								})
   458  							})
   459  						})
   460  					})
   461  				})
   462  
   463  				Context("when an error is encountered getting the service plan", func() {
   464  					Describe("a generic error", func() {
   465  						var expectedErr error
   466  
   467  						BeforeEach(func() {
   468  							expectedErr = errors.New("get-service-plan-error")
   469  							fakeCloudControllerClient.GetServicePlanReturns(
   470  								ccv2.ServicePlan{},
   471  								ccv2.Warnings{"get-service-plan-warning"},
   472  								expectedErr)
   473  						})
   474  
   475  						It("returns the error and all warnings", func() {
   476  							Expect(summaryErr).To(MatchError(expectedErr))
   477  							Expect(summaryWarnings).To(ConsistOf("get-space-service-instance-warning", "get-feature-flags-warning", "get-service-plan-warning"))
   478  						})
   479  					})
   480  
   481  					Describe("a Forbidden error", func() {
   482  						var expectedErr error
   483  
   484  						BeforeEach(func() {
   485  							expectedErr = errors.New("get-service-plan-error")
   486  							fakeCloudControllerClient.GetServicePlanReturns(
   487  								ccv2.ServicePlan{},
   488  								ccv2.Warnings{"get-service-plan-warning"},
   489  								ccerror.ForbiddenError{})
   490  						})
   491  
   492  						It("returns warnings and continues on", func() {
   493  							Expect(summaryErr).ToNot(HaveOccurred())
   494  							Expect(summaryWarnings).To(ConsistOf("get-space-service-instance-warning", "get-feature-flags-warning", "get-service-plan-warning", "This org is not authorized to view necessary data about this service plan. Contact your administrator regarding service GUID some-service-plan-guid."))
   495  
   496  							Expect(fakeCloudControllerClient.GetServiceCallCount()).To(Equal(1))
   497  							Expect(fakeCloudControllerClient.GetServiceArgsForCall(0)).To(Equal("some-service-guid"))
   498  						})
   499  					})
   500  				})
   501  
   502  				Context("when no errors are encountered getting the service plan", func() {
   503  					var returnedServicePlan ccv2.ServicePlan
   504  
   505  					BeforeEach(func() {
   506  						returnedServicePlan = ccv2.ServicePlan{
   507  							GUID:        "some-service-plan-guid",
   508  							Name:        "some-service-plan",
   509  							ServiceGUID: "some-service-guid",
   510  						}
   511  						fakeCloudControllerClient.GetServicePlanReturns(
   512  							returnedServicePlan,
   513  							ccv2.Warnings{"get-service-plan-warning"},
   514  							nil)
   515  					})
   516  
   517  					It("returns the service plan info and all warnings", func() {
   518  						Expect(summaryErr).ToNot(HaveOccurred())
   519  						Expect(summary.ServiceInstance).To(Equal(ServiceInstance(returnedServiceInstance)))
   520  						Expect(summary.ServicePlan).To(Equal(ServicePlan(returnedServicePlan)))
   521  						Expect(summaryWarnings).To(ConsistOf("get-space-service-instance-warning", "get-feature-flags-warning", "get-service-plan-warning"))
   522  
   523  						Expect(fakeCloudControllerClient.GetServicePlanCallCount()).To(Equal(1))
   524  						Expect(fakeCloudControllerClient.GetServicePlanArgsForCall(0)).To(Equal(returnedServiceInstance.ServicePlanGUID))
   525  					})
   526  
   527  					Context("when an error is encountered getting the service", func() {
   528  						Describe("a generic error", func() {
   529  							var expectedErr error
   530  
   531  							BeforeEach(func() {
   532  								expectedErr = errors.New("get service error")
   533  								fakeCloudControllerClient.GetServiceReturns(
   534  									ccv2.Service{},
   535  									ccv2.Warnings{"get-service-warning"},
   536  									expectedErr)
   537  							})
   538  
   539  							It("returns the error and all warnings", func() {
   540  								Expect(summaryErr).To(MatchError(expectedErr))
   541  								Expect(summaryWarnings).To(ConsistOf("get-space-service-instance-warning", "get-feature-flags-warning", "get-service-plan-warning", "get-service-warning"))
   542  
   543  								Expect(fakeCloudControllerClient.GetServiceCallCount()).To(Equal(1))
   544  								Expect(fakeCloudControllerClient.GetServiceArgsForCall(0)).To(Equal(returnedServicePlan.ServiceGUID))
   545  							})
   546  						})
   547  
   548  						Describe("a Forbidden error", func() {
   549  							BeforeEach(func() {
   550  								fakeCloudControllerClient.GetServiceReturns(
   551  									ccv2.Service{},
   552  									ccv2.Warnings{"get-service-warning"},
   553  									ccerror.ForbiddenError{})
   554  							})
   555  
   556  							It("returns warnings and continues on", func() {
   557  								Expect(summaryErr).ToNot(HaveOccurred())
   558  								Expect(summaryWarnings).To(ConsistOf("get-space-service-instance-warning", "get-feature-flags-warning", "get-service-plan-warning", "get-service-warning", "This org is not authorized to view necessary data about this service. Contact your administrator regarding service GUID some-service-guid."))
   559  
   560  								Expect(fakeCloudControllerClient.GetServiceInstanceServiceBindingsCallCount()).To(BeNumerically(">=", 1))
   561  							})
   562  						})
   563  					})
   564  
   565  					Context("when no errors are encountered getting the service", func() {
   566  						var returnedService ccv2.Service
   567  
   568  						BeforeEach(func() {
   569  							returnedService = ccv2.Service{
   570  								GUID:             "some-service-guid",
   571  								Label:            "some-service",
   572  								Description:      "some-description",
   573  								DocumentationURL: "some-url",
   574  								Extra: ccv2.ServiceExtra{
   575  									Shareable: true,
   576  								},
   577  							}
   578  
   579  							fakeCloudControllerClient.GetServiceReturns(
   580  								returnedService,
   581  								ccv2.Warnings{"get-service-warning"},
   582  								nil)
   583  						})
   584  
   585  						It("returns the service info and all warnings", func() {
   586  							Expect(summaryErr).ToNot(HaveOccurred())
   587  							Expect(summary.ServiceInstance).To(Equal(ServiceInstance(returnedServiceInstance)))
   588  							Expect(summary.ServicePlan).To(Equal(ServicePlan(returnedServicePlan)))
   589  							Expect(summary.Service).To(Equal(Service(returnedService)))
   590  							Expect(summaryWarnings).To(ConsistOf("get-space-service-instance-warning", "get-feature-flags-warning", "get-service-plan-warning", "get-service-warning"))
   591  
   592  							Expect(fakeCloudControllerClient.GetServiceCallCount()).To(Equal(1))
   593  							Expect(fakeCloudControllerClient.GetServiceArgsForCall(0)).To(Equal(returnedServicePlan.ServiceGUID))
   594  						})
   595  
   596  						Context("when an error is encountered getting the service bindings", func() {
   597  							var expectedErr error
   598  
   599  							BeforeEach(func() {
   600  								expectedErr = errors.New("get service bindings error")
   601  								fakeCloudControllerClient.GetServiceInstanceServiceBindingsReturns(
   602  									[]ccv2.ServiceBinding{},
   603  									ccv2.Warnings{"get-service-bindings-warning"},
   604  									expectedErr)
   605  							})
   606  
   607  							It("returns the error and all warnings", func() {
   608  								Expect(summaryErr).To(MatchError(expectedErr))
   609  								Expect(summaryWarnings).To(ConsistOf("get-space-service-instance-warning", "get-feature-flags-warning", "get-service-plan-warning", "get-service-warning", "get-service-bindings-warning"))
   610  
   611  								Expect(fakeCloudControllerClient.GetServiceInstanceServiceBindingsCallCount()).To(Equal(1))
   612  								Expect(fakeCloudControllerClient.GetServiceInstanceServiceBindingsArgsForCall(0)).To(Equal(returnedServiceInstance.GUID))
   613  							})
   614  						})
   615  
   616  						Context("when no errors are encountered getting the service bindings", func() {
   617  							var returnedServiceBindings []ccv2.ServiceBinding
   618  
   619  							BeforeEach(func() {
   620  								returnedServiceBindings = []ccv2.ServiceBinding{
   621  									{
   622  										GUID:    "some-service-binding-1-guid",
   623  										Name:    "some-service-binding-1",
   624  										AppGUID: "some-app-1-guid",
   625  									},
   626  									{
   627  										GUID:    "some-service-binding-2-guid",
   628  										Name:    "some-service-binding-2",
   629  										AppGUID: "some-app-2-guid",
   630  									},
   631  								}
   632  								fakeCloudControllerClient.GetServiceInstanceServiceBindingsReturns(
   633  									returnedServiceBindings,
   634  									ccv2.Warnings{"get-service-bindings-warning"},
   635  									nil)
   636  							})
   637  
   638  							Context("when an error is encountered getting bound application info", func() {
   639  								var expectedErr error
   640  
   641  								BeforeEach(func() {
   642  									expectedErr = errors.New("get application error")
   643  									fakeCloudControllerClient.GetApplicationReturns(
   644  										ccv2.Application{},
   645  										ccv2.Warnings{"get-application-warning"},
   646  										expectedErr)
   647  								})
   648  
   649  								It("returns the error", func() {
   650  									Expect(summaryErr).To(MatchError(expectedErr))
   651  									Expect(summaryWarnings).To(ConsistOf("get-space-service-instance-warning", "get-feature-flags-warning", "get-service-plan-warning", "get-service-warning", "get-service-bindings-warning", "get-application-warning"))
   652  
   653  									Expect(fakeCloudControllerClient.GetApplicationCallCount()).To(Equal(1))
   654  									Expect(fakeCloudControllerClient.GetApplicationArgsForCall(0)).To(Equal(returnedServiceBindings[0].AppGUID))
   655  								})
   656  							})
   657  
   658  							Context("when no errors are encountered getting bound application info", func() {
   659  								BeforeEach(func() {
   660  									fakeCloudControllerClient.GetApplicationReturnsOnCall(
   661  										0,
   662  										ccv2.Application{
   663  											GUID: "some-app-1-guid",
   664  											Name: "some-app-1",
   665  										},
   666  										ccv2.Warnings{"get-application-warning-1"},
   667  										nil)
   668  									fakeCloudControllerClient.GetApplicationReturnsOnCall(
   669  										1,
   670  										ccv2.Application{
   671  											GUID: "some-app-2-guid",
   672  											Name: "some-app-2",
   673  										},
   674  										ccv2.Warnings{"get-application-warning-2"},
   675  										nil)
   676  								})
   677  
   678  								It("returns a list of applications bound to the service instance and all warnings", func() {
   679  									Expect(summaryErr).ToNot(HaveOccurred())
   680  									Expect(summary.ServiceInstance).To(Equal(ServiceInstance(returnedServiceInstance)))
   681  									Expect(summary.ServicePlan).To(Equal(ServicePlan(returnedServicePlan)))
   682  									Expect(summary.Service).To(Equal(Service(returnedService)))
   683  									Expect(summary.BoundApplications).To(Equal([]BoundApplication{
   684  										{
   685  											AppName:            "some-app-1",
   686  											ServiceBindingName: "some-service-binding-1",
   687  										},
   688  										{
   689  											AppName:            "some-app-2",
   690  											ServiceBindingName: "some-service-binding-2",
   691  										},
   692  									}))
   693  									Expect(summaryWarnings).To(ConsistOf("get-space-service-instance-warning", "get-feature-flags-warning", "get-service-plan-warning", "get-service-warning", "get-service-bindings-warning", "get-application-warning-1", "get-application-warning-2"))
   694  
   695  									Expect(fakeCloudControllerClient.GetServiceInstanceServiceBindingsCallCount()).To(Equal(1))
   696  									Expect(fakeCloudControllerClient.GetServiceInstanceServiceBindingsArgsForCall(0)).To(Equal(returnedServiceInstance.GUID))
   697  
   698  									Expect(fakeCloudControllerClient.GetApplicationCallCount()).To(Equal(2))
   699  									Expect(fakeCloudControllerClient.GetApplicationArgsForCall(0)).To(Equal(returnedServiceBindings[0].AppGUID))
   700  									Expect(fakeCloudControllerClient.GetApplicationArgsForCall(1)).To(Equal(returnedServiceBindings[1].AppGUID))
   701  
   702  									Expect(fakeCloudControllerClient.GetUserProvidedServiceInstanceServiceBindingsCallCount()).To(Equal(0))
   703  								})
   704  							})
   705  						})
   706  					})
   707  				})
   708  			})
   709  
   710  			Context("when the service instance is a user provided service instance", func() {
   711  				BeforeEach(func() {
   712  					returnedServiceInstance = ccv2.ServiceInstance{
   713  						GUID: "some-user-provided-service-instance-guid",
   714  						Name: "some-user-provided-service-instance",
   715  						Type: constant.ServiceInstanceTypeUserProvidedService,
   716  					}
   717  					fakeCloudControllerClient.GetSpaceServiceInstancesReturns(
   718  						[]ccv2.ServiceInstance{returnedServiceInstance},
   719  						ccv2.Warnings{"get-space-service-instance-warning"},
   720  						nil)
   721  				})
   722  
   723  				Context("getting the service bindings errors", func() {
   724  					BeforeEach(func() {
   725  						fakeCloudControllerClient.GetUserProvidedServiceInstanceServiceBindingsReturns(
   726  							nil,
   727  							ccv2.Warnings{"some-get-user-provided-si-bindings-warnings"},
   728  							errors.New("some-get-user-provided-si-bindings-error"))
   729  					})
   730  
   731  					It("should return the error and return all warnings", func() {
   732  						Expect(summaryErr).To(MatchError("some-get-user-provided-si-bindings-error"))
   733  						Expect(summaryWarnings).To(ConsistOf("some-get-user-provided-si-bindings-warnings",
   734  							"get-space-service-instance-warning"))
   735  					})
   736  				})
   737  
   738  				Context("when no errors are encountered getting the service bindings", func() {
   739  					var returnedServiceBindings []ccv2.ServiceBinding
   740  
   741  					BeforeEach(func() {
   742  						returnedServiceBindings = []ccv2.ServiceBinding{
   743  							{
   744  								GUID:    "some-service-binding-1-guid",
   745  								Name:    "some-service-binding-1",
   746  								AppGUID: "some-app-1-guid",
   747  							},
   748  							{
   749  								GUID:    "some-service-binding-2-guid",
   750  								Name:    "some-service-binding-2",
   751  								AppGUID: "some-app-2-guid",
   752  							},
   753  						}
   754  						fakeCloudControllerClient.GetUserProvidedServiceInstanceServiceBindingsReturns(
   755  							returnedServiceBindings,
   756  							ccv2.Warnings{"get-service-bindings-warning"},
   757  							nil)
   758  					})
   759  
   760  					Context("when no errors are encountered getting bound application info", func() {
   761  						BeforeEach(func() {
   762  							fakeCloudControllerClient.GetApplicationReturnsOnCall(
   763  								0,
   764  								ccv2.Application{
   765  									GUID: "some-app-1-guid",
   766  									Name: "some-app-1",
   767  								},
   768  								ccv2.Warnings{"get-application-warning-1"},
   769  								nil)
   770  							fakeCloudControllerClient.GetApplicationReturnsOnCall(
   771  								1,
   772  								ccv2.Application{
   773  									GUID: "some-app-2-guid",
   774  									Name: "some-app-2",
   775  								},
   776  								ccv2.Warnings{"get-application-warning-2"},
   777  								nil)
   778  						})
   779  
   780  						It("returns a list of applications bound to the service instance and all warnings", func() {
   781  							Expect(summaryErr).ToNot(HaveOccurred())
   782  							Expect(summary).To(Equal(ServiceInstanceSummary{
   783  								ServiceInstance: ServiceInstance(returnedServiceInstance),
   784  								BoundApplications: []BoundApplication{
   785  									{
   786  										AppName:            "some-app-1",
   787  										ServiceBindingName: "some-service-binding-1",
   788  									},
   789  									{
   790  										AppName:            "some-app-2",
   791  										ServiceBindingName: "some-service-binding-2",
   792  									},
   793  								},
   794  							}))
   795  							Expect(summaryWarnings).To(ConsistOf("get-space-service-instance-warning", "get-service-bindings-warning", "get-application-warning-1", "get-application-warning-2"))
   796  
   797  							Expect(fakeCloudControllerClient.GetSpaceServiceInstancesCallCount()).To(Equal(1))
   798  							spaceGUIDArg, getUserProvidedServicesArg, queriesArg := fakeCloudControllerClient.GetSpaceServiceInstancesArgsForCall(0)
   799  							Expect(spaceGUIDArg).To(Equal("some-space-guid"))
   800  							Expect(getUserProvidedServicesArg).To(BeTrue())
   801  							Expect(queriesArg).To(HaveLen(1))
   802  							Expect(queriesArg[0]).To(Equal(ccv2.Filter{
   803  								Type:     constant.NameFilter,
   804  								Operator: constant.EqualOperator,
   805  								Values:   []string{"some-service-instance"},
   806  							}))
   807  
   808  							Expect(fakeCloudControllerClient.GetUserProvidedServiceInstanceServiceBindingsCallCount()).To(Equal(1))
   809  							Expect(fakeCloudControllerClient.GetUserProvidedServiceInstanceServiceBindingsArgsForCall(0)).To(Equal(returnedServiceInstance.GUID))
   810  
   811  							Expect(fakeCloudControllerClient.GetApplicationCallCount()).To(Equal(2))
   812  							Expect(fakeCloudControllerClient.GetApplicationArgsForCall(0)).To(Equal(returnedServiceBindings[0].AppGUID))
   813  							Expect(fakeCloudControllerClient.GetApplicationArgsForCall(1)).To(Equal(returnedServiceBindings[1].AppGUID))
   814  
   815  							Expect(fakeCloudControllerClient.GetServicePlanCallCount()).To(Equal(0))
   816  							Expect(fakeCloudControllerClient.GetServiceCallCount()).To(Equal(0))
   817  							Expect(fakeCloudControllerClient.GetServiceInstanceServiceBindingsCallCount()).To(Equal(0))
   818  						})
   819  					})
   820  				})
   821  			})
   822  		})
   823  	})
   824  
   825  	Describe("GetServiceInstancesSummaryBySpace", func() {
   826  		var (
   827  			serviceInstancesSummary []ServiceInstanceSummary
   828  			warnings                Warnings
   829  			executeErr              error
   830  		)
   831  
   832  		JustBeforeEach(func() {
   833  			serviceInstancesSummary, warnings, executeErr = actor.GetServiceInstancesSummaryBySpace("some-space-GUID")
   834  		})
   835  
   836  		Context("when an error is encountered getting a space's service instances", func() {
   837  			var expectedErr error
   838  			BeforeEach(func() {
   839  				expectedErr = errors.New("get by space service instance summary error")
   840  				fakeCloudControllerClient.GetSpaceServiceInstancesReturns(
   841  					[]ccv2.ServiceInstance{},
   842  					ccv2.Warnings{"get-by-space-service-instances-warning"},
   843  					expectedErr,
   844  				)
   845  			})
   846  
   847  			It("returns the error and all warnings", func() {
   848  				Expect(executeErr).To(MatchError(expectedErr))
   849  				Expect(warnings).To(ConsistOf("get-by-space-service-instances-warning"))
   850  			})
   851  		})
   852  
   853  		Context("when no errors are encountered getting a space's service instances", func() {
   854  			var (
   855  				serviceInstance1 ccv2.ServiceInstance
   856  				serviceInstance2 ccv2.ServiceInstance
   857  				application1     ccv2.Application
   858  				application2     ccv2.Application
   859  				bindings1        []ccv2.ServiceBinding
   860  				bindings2        []ccv2.ServiceBinding
   861  			)
   862  
   863  			BeforeEach(func() {
   864  				serviceInstance1 = ccv2.ServiceInstance{
   865  					GUID:            "some-si-GUID-1",
   866  					Name:            "some-si-name-1",
   867  					ServiceGUID:     "some-service-GUID-1",
   868  					ServicePlanGUID: "some-si-sp-GUID-1",
   869  					Type:            constant.ServiceInstanceTypeManagedService,
   870  					LastOperation: ccv2.LastOperation{
   871  						Type:  "some-lo-type",
   872  						State: "some-lo-state",
   873  					},
   874  				}
   875  				serviceInstance2 = ccv2.ServiceInstance{
   876  					GUID:            "some-si-GUID-3",
   877  					Name:            "some-si-name-3",
   878  					ServiceGUID:     "some-service-GUID-3",
   879  					ServicePlanGUID: "some-si-sp-GUID-3",
   880  					Type:            constant.ServiceInstanceTypeUserProvidedService,
   881  					LastOperation: ccv2.LastOperation{
   882  						Type:  "some-lo-type",
   883  						State: "some-lo-state",
   884  					},
   885  				}
   886  
   887  				fakeCloudControllerClient.GetSpaceServiceInstancesReturns(
   888  					[]ccv2.ServiceInstance{serviceInstance2, serviceInstance1},
   889  					ccv2.Warnings{"get-by-space-service-instances-warning"},
   890  					nil)
   891  
   892  				bindings1 = []ccv2.ServiceBinding{
   893  					{
   894  						GUID:                "some-sb-GUID-1",
   895  						Name:                "some-service-binding-2",
   896  						AppGUID:             "2-app-GUID", // we are testing that the app name will be sorted alphanumerically
   897  						ServiceInstanceGUID: "some-si-GUID-1",
   898  					},
   899  					{
   900  						GUID:                "some-sb-GUID-2",
   901  						Name:                "some-service-binding-1",
   902  						AppGUID:             "1-app-GUID", // we are testing that the app name will be sorted alphanumerically
   903  						ServiceInstanceGUID: "some-si-GUID-3",
   904  					},
   905  				}
   906  				bindings2 = []ccv2.ServiceBinding{
   907  					{
   908  						GUID:                "some-sb-GUID-1",
   909  						Name:                "some-service-binding-1",
   910  						AppGUID:             "1-app-GUID",
   911  						ServiceInstanceGUID: "some-si-GUID-1",
   912  					},
   913  				}
   914  				fakeCloudControllerClient.GetServiceInstanceServiceBindingsReturns(
   915  					bindings1,
   916  					ccv2.Warnings{"some-bindings-warning"},
   917  					nil)
   918  				fakeCloudControllerClient.GetUserProvidedServiceInstanceServiceBindingsReturns(
   919  					bindings2,
   920  					ccv2.Warnings{"some-bindings-warning"},
   921  					nil)
   922  
   923  				application1 = ccv2.Application{Name: "1-app-name", GUID: "1-app-GUID"}
   924  				application2 = ccv2.Application{Name: "2-app-name", GUID: "2-app-GUID"}
   925  
   926  				fakeCloudControllerClient.GetApplicationStub = func(appGUID string) (ccv2.Application, ccv2.Warnings, error) {
   927  					switch appGUID {
   928  					case application1.GUID:
   929  						return application1, ccv2.Warnings{"some-get-app-warning"}, nil
   930  					case application2.GUID:
   931  						return application2, ccv2.Warnings{"some-get-app-warning"}, nil
   932  					default:
   933  						Fail("got an app guid that does not exist")
   934  					}
   935  
   936  					return ccv2.Application{}, nil, nil
   937  				}
   938  			})
   939  
   940  			It("returns the service instances summary with bound apps in alphanumeric sorted order and all warnings", func() {
   941  				Expect(executeErr).ToNot(HaveOccurred())
   942  				Expect(serviceInstancesSummary).To(Equal(
   943  					[]ServiceInstanceSummary{
   944  						{
   945  							ServiceInstance: ServiceInstance(serviceInstance1),
   946  							BoundApplications: []BoundApplication{
   947  								{
   948  									AppName:            "1-app-name",
   949  									ServiceBindingName: "some-service-binding-1",
   950  								},
   951  								{
   952  									AppName:            "2-app-name",
   953  									ServiceBindingName: "some-service-binding-2",
   954  								},
   955  							},
   956  						},
   957  						{
   958  							ServiceInstance: ServiceInstance(serviceInstance2),
   959  							BoundApplications: []BoundApplication{
   960  								{
   961  									AppName:            "1-app-name",
   962  									ServiceBindingName: "some-service-binding-1",
   963  								},
   964  							},
   965  						}}))
   966  				Expect(warnings).To(ConsistOf("get-by-space-service-instances-warning",
   967  					"some-get-app-warning", "some-get-app-warning", "some-get-app-warning",
   968  					"some-bindings-warning", "some-bindings-warning"))
   969  
   970  				Expect(fakeCloudControllerClient.GetSpaceServiceInstancesCallCount()).To(Equal(1))
   971  				passedSpaceGUID, includeUPS, filters := fakeCloudControllerClient.GetSpaceServiceInstancesArgsForCall(0)
   972  				Expect(passedSpaceGUID).To(Equal("some-space-GUID"))
   973  				Expect(includeUPS).To(BeTrue())
   974  				Expect(filters).To(BeEmpty())
   975  
   976  				Expect(fakeCloudControllerClient.GetConfigFeatureFlagsCallCount()).To(Equal(0))
   977  
   978  				//Managed expectations
   979  				Expect(fakeCloudControllerClient.GetServicePlanCallCount()).To(Equal(1))
   980  				Expect(fakeCloudControllerClient.GetServiceCallCount()).To(Equal(1))
   981  				Expect(fakeCloudControllerClient.GetServiceInstanceServiceBindingsCallCount()).To(Equal(1))
   982  				//User-Provided expectations
   983  				Expect(fakeCloudControllerClient.GetUserProvidedServiceInstanceServiceBindingsCallCount()).To(Equal(1))
   984  				//Both types expectations
   985  				Expect(fakeCloudControllerClient.GetApplicationCallCount()).To(Equal(3))
   986  			})
   987  		})
   988  	})
   989  })