github.com/franc20/ayesa_sap@v7.0.0-beta.28.0.20200124003224-302d4d52fa6c+incompatible/command/v6/bind_security_group_command_test.go (about) 1 package v6_test 2 3 import ( 4 "errors" 5 6 "code.cloudfoundry.org/cli/actor/actionerror" 7 "code.cloudfoundry.org/cli/actor/v2action" 8 "code.cloudfoundry.org/cli/api/cloudcontroller/ccv2/constant" 9 "code.cloudfoundry.org/cli/command/commandfakes" 10 "code.cloudfoundry.org/cli/command/flag" 11 . "code.cloudfoundry.org/cli/command/v6" 12 "code.cloudfoundry.org/cli/command/v6/v6fakes" 13 "code.cloudfoundry.org/cli/util/configv3" 14 "code.cloudfoundry.org/cli/util/ui" 15 . "github.com/onsi/ginkgo" 16 . "github.com/onsi/gomega" 17 . "github.com/onsi/gomega/gbytes" 18 ) 19 20 var _ = Describe("bind-security-group Command", func() { 21 var ( 22 cmd BindSecurityGroupCommand 23 testUI *ui.UI 24 fakeConfig *commandfakes.FakeConfig 25 fakeSharedActor *commandfakes.FakeSharedActor 26 fakeActor *v6fakes.FakeBindSecurityGroupActor 27 binaryName string 28 executeErr error 29 ) 30 31 BeforeEach(func() { 32 testUI = ui.NewTestUI(nil, NewBuffer(), NewBuffer()) 33 fakeConfig = new(commandfakes.FakeConfig) 34 fakeSharedActor = new(commandfakes.FakeSharedActor) 35 fakeActor = new(v6fakes.FakeBindSecurityGroupActor) 36 37 cmd = BindSecurityGroupCommand{ 38 UI: testUI, 39 Config: fakeConfig, 40 SharedActor: fakeSharedActor, 41 Actor: fakeActor, 42 } 43 44 binaryName = "faceman" 45 fakeConfig.BinaryNameReturns(binaryName) 46 47 // Stubs for the happy path. 48 cmd.RequiredArgs.SecurityGroupName = "some-security-group" 49 cmd.RequiredArgs.OrganizationName = "some-org" 50 51 fakeConfig.CurrentUserReturns( 52 configv3.User{Name: "some-user"}, 53 nil) 54 fakeActor.GetSecurityGroupByNameReturns( 55 v2action.SecurityGroup{Name: "some-security-group", GUID: "some-security-group-guid"}, 56 v2action.Warnings{"get security group warning"}, 57 nil) 58 fakeActor.GetOrganizationByNameReturns( 59 v2action.Organization{Name: "some-org", GUID: "some-org-guid"}, 60 v2action.Warnings{"get org warning"}, 61 nil) 62 }) 63 64 JustBeforeEach(func() { 65 executeErr = cmd.Execute(nil) 66 }) 67 68 When("lifecycle is 'running'", func() { 69 BeforeEach(func() { 70 cmd.Lifecycle = flag.SecurityGroupLifecycle(constant.SecurityGroupLifecycleRunning) 71 }) 72 73 When("checking target fails", func() { 74 BeforeEach(func() { 75 fakeSharedActor.CheckTargetReturns(actionerror.NotLoggedInError{BinaryName: binaryName}) 76 }) 77 78 It("returns an error", func() { 79 Expect(executeErr).To(MatchError(actionerror.NotLoggedInError{BinaryName: "faceman"})) 80 81 Expect(fakeSharedActor.CheckTargetCallCount()).To(Equal(1)) 82 checkTargetedOrg, checkTargetedSpace := fakeSharedActor.CheckTargetArgsForCall(0) 83 Expect(checkTargetedOrg).To(BeFalse()) 84 Expect(checkTargetedSpace).To(BeFalse()) 85 }) 86 }) 87 88 When("getting the current user returns an error", func() { 89 var expectedErr error 90 91 BeforeEach(func() { 92 expectedErr = errors.New("getting current user error") 93 fakeConfig.CurrentUserReturns( 94 configv3.User{}, 95 expectedErr) 96 }) 97 98 It("returns the error", func() { 99 Expect(executeErr).To(MatchError(expectedErr)) 100 }) 101 }) 102 103 When("the provided security group does not exist", func() { 104 BeforeEach(func() { 105 fakeActor.GetSecurityGroupByNameReturns( 106 v2action.SecurityGroup{}, 107 v2action.Warnings{"get security group warning"}, 108 actionerror.SecurityGroupNotFoundError{Name: "some-security-group"}) 109 }) 110 111 It("returns a SecurityGroupNotFoundError and displays all warnings", func() { 112 Expect(executeErr).To(MatchError(actionerror.SecurityGroupNotFoundError{Name: "some-security-group"})) 113 Expect(testUI.Err).To(Say("get security group warning")) 114 }) 115 }) 116 117 When("an error is encountered getting the provided security group", func() { 118 var expectedErr error 119 120 BeforeEach(func() { 121 expectedErr = errors.New("get security group error") 122 fakeActor.GetSecurityGroupByNameReturns( 123 v2action.SecurityGroup{}, 124 v2action.Warnings{"get security group warning"}, 125 expectedErr) 126 }) 127 128 It("returns the error and displays all warnings", func() { 129 Expect(executeErr).To(MatchError(expectedErr)) 130 Expect(testUI.Err).To(Say("get security group warning")) 131 }) 132 }) 133 134 When("the provided org does not exist", func() { 135 BeforeEach(func() { 136 fakeActor.GetOrganizationByNameReturns( 137 v2action.Organization{}, 138 v2action.Warnings{"get organization warning"}, 139 actionerror.OrganizationNotFoundError{Name: "some-org"}) 140 }) 141 142 It("returns an OrganizationNotFoundError and displays all warnings", func() { 143 Expect(executeErr).To(MatchError(actionerror.OrganizationNotFoundError{Name: "some-org"})) 144 Expect(testUI.Err).To(Say("get security group warning")) 145 Expect(testUI.Err).To(Say("get organization warning")) 146 }) 147 }) 148 149 When("an error is encountered getting the provided org", func() { 150 var expectedErr error 151 152 BeforeEach(func() { 153 expectedErr = errors.New("get org error") 154 fakeActor.GetOrganizationByNameReturns( 155 v2action.Organization{}, 156 v2action.Warnings{"get org warning"}, 157 expectedErr) 158 }) 159 160 It("returns the error and displays all warnings", func() { 161 Expect(executeErr).To(MatchError(expectedErr)) 162 Expect(testUI.Err).To(Say("get security group warning")) 163 Expect(testUI.Err).To(Say("get org warning")) 164 }) 165 }) 166 167 When("a space is provided", func() { 168 BeforeEach(func() { 169 cmd.RequiredArgs.SpaceName = "some-space" 170 }) 171 172 When("the space does not exist", func() { 173 BeforeEach(func() { 174 fakeActor.GetSpaceByOrganizationAndNameReturns( 175 v2action.Space{}, 176 v2action.Warnings{"get space warning"}, 177 actionerror.SpaceNotFoundError{Name: "some-space"}) 178 }) 179 180 It("returns a SpaceNotFoundError", func() { 181 Expect(executeErr).To(MatchError(actionerror.SpaceNotFoundError{Name: "some-space"})) 182 Expect(testUI.Err).To(Say("get security group warning")) 183 Expect(testUI.Err).To(Say("get org warning")) 184 Expect(testUI.Err).To(Say("get space warning")) 185 }) 186 }) 187 188 When("the space exists", func() { 189 BeforeEach(func() { 190 fakeActor.GetSpaceByOrganizationAndNameReturns( 191 v2action.Space{ 192 GUID: "some-space-guid", 193 Name: "some-space", 194 }, 195 v2action.Warnings{"get space by org warning"}, 196 nil) 197 }) 198 199 When("no errors are encountered binding the security group to the space", func() { 200 BeforeEach(func() { 201 fakeActor.BindSecurityGroupToSpaceReturns( 202 v2action.Warnings{"bind security group to space warning"}, 203 nil) 204 }) 205 206 It("binds the security group to the space and displays all warnings", func() { 207 Expect(executeErr).NotTo(HaveOccurred()) 208 209 Expect(testUI.Out).To(Say(`Assigning security group some-security-group to space some-space in org some-org as some-user\.\.\.`)) 210 Expect(testUI.Out).To(Say("OK")) 211 Expect(testUI.Out).To(Say(`TIP: Changes require an app restart \(for running\) or restage \(for staging\) to apply to existing applications\.`)) 212 213 Expect(testUI.Err).To(Say("get security group warning")) 214 Expect(testUI.Err).To(Say("get org warning")) 215 Expect(testUI.Err).To(Say("get space by org warning")) 216 Expect(testUI.Err).To(Say("bind security group to space warning")) 217 218 Expect(fakeActor.CloudControllerAPIVersionCallCount()).To(Equal(0)) 219 220 Expect(fakeActor.GetSecurityGroupByNameCallCount()).To(Equal(1)) 221 Expect(fakeActor.GetSecurityGroupByNameArgsForCall(0)).To(Equal("some-security-group")) 222 223 Expect(fakeActor.GetOrganizationByNameCallCount()).To(Equal(1)) 224 Expect(fakeActor.GetOrganizationByNameArgsForCall(0)).To(Equal("some-org")) 225 226 Expect(fakeActor.GetSpaceByOrganizationAndNameCallCount()).To(Equal(1)) 227 orgGUID, spaceName := fakeActor.GetSpaceByOrganizationAndNameArgsForCall(0) 228 Expect(orgGUID).To(Equal("some-org-guid")) 229 Expect(spaceName).To(Equal("some-space")) 230 231 Expect(fakeActor.BindSecurityGroupToSpaceCallCount()).To(Equal(1)) 232 securityGroupGUID, spaceGUID, lifecycle := fakeActor.BindSecurityGroupToSpaceArgsForCall(0) 233 Expect(securityGroupGUID).To(Equal("some-security-group-guid")) 234 Expect(spaceGUID).To(Equal("some-space-guid")) 235 Expect(lifecycle).To(Equal(constant.SecurityGroupLifecycleRunning)) 236 }) 237 }) 238 239 When("an error is encountered binding the security group to the space", func() { 240 var expectedErr error 241 242 BeforeEach(func() { 243 expectedErr = errors.New("bind error") 244 fakeActor.BindSecurityGroupToSpaceReturns( 245 v2action.Warnings{"bind security group to space warning"}, 246 expectedErr) 247 }) 248 249 It("returns the error and displays all warnings", func() { 250 Expect(executeErr).To(MatchError(expectedErr)) 251 252 Expect(testUI.Out).NotTo(Say("OK")) 253 254 Expect(testUI.Err).To(Say("get security group warning")) 255 Expect(testUI.Err).To(Say("get org warning")) 256 Expect(testUI.Err).To(Say("get space by org warning")) 257 Expect(testUI.Err).To(Say("bind security group to space warning")) 258 }) 259 }) 260 }) 261 262 When("an error is encountered getting the space", func() { 263 var expectedErr error 264 265 BeforeEach(func() { 266 expectedErr = errors.New("get org error") 267 fakeActor.GetSpaceByOrganizationAndNameReturns( 268 v2action.Space{}, 269 v2action.Warnings{"get space by org warning"}, 270 expectedErr) 271 }) 272 273 It("returns the error and displays all warnings", func() { 274 Expect(executeErr).To(MatchError(expectedErr)) 275 Expect(testUI.Err).To(Say("get security group warning")) 276 Expect(testUI.Err).To(Say("get org warning")) 277 Expect(testUI.Err).To(Say("get space by org warning")) 278 }) 279 }) 280 }) 281 282 When("a space is not provided", func() { 283 When("there are no spaces in the org", func() { 284 BeforeEach(func() { 285 fakeActor.GetOrganizationSpacesReturns( 286 []v2action.Space{}, 287 v2action.Warnings{"get org spaces warning"}, 288 nil) 289 }) 290 291 It("does not perform any bindings and displays all warnings", func() { 292 Expect(executeErr).NotTo(HaveOccurred()) 293 294 Expect(testUI.Out).NotTo(Say("Assigning security group")) 295 Expect(testUI.Out).NotTo(Say("OK")) 296 297 Expect(testUI.Err).To(Say("get security group warning")) 298 Expect(testUI.Err).To(Say("get org warning")) 299 Expect(testUI.Err).To(Say("get org spaces warning")) 300 }) 301 }) 302 303 When("there are spaces in the org", func() { 304 BeforeEach(func() { 305 fakeActor.GetOrganizationSpacesReturns( 306 []v2action.Space{ 307 { 308 GUID: "some-space-guid-1", 309 Name: "some-space-1", 310 }, 311 { 312 GUID: "some-space-guid-2", 313 Name: "some-space-2", 314 }, 315 }, 316 v2action.Warnings{"get org spaces warning"}, 317 nil) 318 }) 319 320 When("no errors are encountered binding the security group to the spaces", func() { 321 BeforeEach(func() { 322 fakeActor.BindSecurityGroupToSpaceReturnsOnCall( 323 0, 324 v2action.Warnings{"bind security group to space warning 1"}, 325 nil) 326 fakeActor.BindSecurityGroupToSpaceReturnsOnCall( 327 1, 328 v2action.Warnings{"bind security group to space warning 2"}, 329 nil) 330 }) 331 332 It("binds the security group to each space and displays all warnings", func() { 333 Expect(executeErr).NotTo(HaveOccurred()) 334 335 Expect(testUI.Out).To(Say(`Assigning security group some-security-group to space some-space-1 in org some-org as some-user\.\.\.`)) 336 Expect(testUI.Out).To(Say("OK")) 337 Expect(testUI.Out).To(Say(`Assigning security group some-security-group to space some-space-2 in org some-org as some-user\.\.\.`)) 338 Expect(testUI.Out).To(Say("OK")) 339 Expect(testUI.Out).To(Say(`TIP: Changes require an app restart \(for running\) or restage \(for staging\) to apply to existing applications\.`)) 340 341 Expect(testUI.Err).To(Say("get security group warning")) 342 Expect(testUI.Err).To(Say("get org warning")) 343 Expect(testUI.Err).To(Say("get org spaces warning")) 344 Expect(testUI.Err).To(Say("bind security group to space warning 1")) 345 Expect(testUI.Err).To(Say("bind security group to space warning 2")) 346 347 Expect(fakeActor.GetSecurityGroupByNameCallCount()).To(Equal(1)) 348 Expect(fakeActor.GetSecurityGroupByNameArgsForCall(0)).To(Equal("some-security-group")) 349 350 Expect(fakeActor.GetOrganizationByNameCallCount()).To(Equal(1)) 351 Expect(fakeActor.GetOrganizationByNameArgsForCall(0)).To(Equal("some-org")) 352 353 Expect(fakeActor.BindSecurityGroupToSpaceCallCount()).To(Equal(2)) 354 securityGroupGUID, spaceGUID, lifecycle := fakeActor.BindSecurityGroupToSpaceArgsForCall(0) 355 Expect(securityGroupGUID).To(Equal("some-security-group-guid")) 356 Expect(spaceGUID).To(Equal("some-space-guid-1")) 357 Expect(lifecycle).To(Equal(constant.SecurityGroupLifecycleRunning)) 358 securityGroupGUID, spaceGUID, lifecycle = fakeActor.BindSecurityGroupToSpaceArgsForCall(1) 359 Expect(securityGroupGUID).To(Equal("some-security-group-guid")) 360 Expect(spaceGUID).To(Equal("some-space-guid-2")) 361 Expect(lifecycle).To(Equal(constant.SecurityGroupLifecycleRunning)) 362 }) 363 }) 364 365 When("an error is encountered binding the security group to a space", func() { 366 var expectedErr error 367 368 BeforeEach(func() { 369 expectedErr = errors.New("bind security group to space error") 370 fakeActor.BindSecurityGroupToSpaceReturns( 371 v2action.Warnings{"bind security group to space warning"}, 372 expectedErr) 373 }) 374 375 It("returns the error and displays all warnings", func() { 376 Expect(executeErr).To(MatchError(expectedErr)) 377 378 Expect(testUI.Out).NotTo(Say("OK")) 379 380 Expect(testUI.Err).To(Say("get security group warning")) 381 Expect(testUI.Err).To(Say("get org warning")) 382 Expect(testUI.Err).To(Say("get org spaces warning")) 383 Expect(testUI.Err).To(Say("bind security group to space warning")) 384 }) 385 }) 386 }) 387 388 When("an error is encountered getting spaces in the org", func() { 389 var expectedErr error 390 391 BeforeEach(func() { 392 expectedErr = errors.New("get org spaces error") 393 fakeActor.GetOrganizationSpacesReturns( 394 nil, 395 v2action.Warnings{"get org spaces warning"}, 396 expectedErr) 397 }) 398 399 It("returns the error and displays all warnings", func() { 400 Expect(executeErr).To(MatchError(expectedErr)) 401 Expect(testUI.Err).To(Say("get security group warning")) 402 Expect(testUI.Err).To(Say("get org warning")) 403 Expect(testUI.Err).To(Say("get org spaces warning")) 404 }) 405 }) 406 }) 407 }) 408 409 When("lifecycle is 'staging'", func() { 410 BeforeEach(func() { 411 cmd.Lifecycle = "staging" 412 }) 413 414 When("a space is provided", func() { 415 BeforeEach(func() { 416 cmd.RequiredArgs.SpaceName = "some-space" 417 }) 418 419 When("the space exists", func() { 420 BeforeEach(func() { 421 fakeActor.GetSpaceByOrganizationAndNameReturns( 422 v2action.Space{ 423 GUID: "some-space-guid", 424 Name: "some-space", 425 }, 426 v2action.Warnings{"get space by org warning"}, 427 nil) 428 }) 429 430 When("no errors are encountered binding the security group to the space", func() { 431 BeforeEach(func() { 432 fakeActor.BindSecurityGroupToSpaceReturns( 433 v2action.Warnings{"bind security group to space warning"}, 434 nil) 435 }) 436 437 It("binds the security group to the space and displays all warnings", func() { 438 Expect(executeErr).NotTo(HaveOccurred()) 439 440 Expect(testUI.Out).To(Say(`Assigning security group some-security-group to space some-space in org some-org as some-user\.\.\.`)) 441 Expect(testUI.Out).To(Say("OK")) 442 Expect(testUI.Out).To(Say(`TIP: Changes require an app restart \(for running\) or restage \(for staging\) to apply to existing applications\.`)) 443 444 Expect(testUI.Err).To(Say("get security group warning")) 445 Expect(testUI.Err).To(Say("get org warning")) 446 Expect(testUI.Err).To(Say("get space by org warning")) 447 Expect(testUI.Err).To(Say("bind security group to space warning")) 448 449 Expect(fakeActor.CloudControllerAPIVersionCallCount()).To(Equal(0)) 450 Expect(fakeActor.GetSecurityGroupByNameCallCount()).To(Equal(1)) 451 Expect(fakeActor.GetSecurityGroupByNameArgsForCall(0)).To(Equal("some-security-group")) 452 453 Expect(fakeActor.GetOrganizationByNameCallCount()).To(Equal(1)) 454 Expect(fakeActor.GetOrganizationByNameArgsForCall(0)).To(Equal("some-org")) 455 456 Expect(fakeActor.GetSpaceByOrganizationAndNameCallCount()).To(Equal(1)) 457 orgGUID, spaceName := fakeActor.GetSpaceByOrganizationAndNameArgsForCall(0) 458 Expect(orgGUID).To(Equal("some-org-guid")) 459 Expect(spaceName).To(Equal("some-space")) 460 461 Expect(fakeActor.BindSecurityGroupToSpaceCallCount()).To(Equal(1)) 462 securityGroupGUID, spaceGUID, lifecycle := fakeActor.BindSecurityGroupToSpaceArgsForCall(0) 463 Expect(securityGroupGUID).To(Equal("some-security-group-guid")) 464 Expect(spaceGUID).To(Equal("some-space-guid")) 465 Expect(lifecycle).To(Equal(constant.SecurityGroupLifecycleStaging)) 466 }) 467 }) 468 }) 469 }) 470 471 When("a space is not provided", func() { 472 When("there are no spaces in the org", func() { 473 BeforeEach(func() { 474 fakeActor.GetOrganizationSpacesReturns( 475 []v2action.Space{}, 476 v2action.Warnings{"get org spaces warning"}, 477 nil) 478 }) 479 480 It("does not perform any bindings and displays all warnings", func() { 481 Expect(executeErr).NotTo(HaveOccurred()) 482 483 Expect(testUI.Out).NotTo(Say("Assigning security group")) 484 Expect(testUI.Out).NotTo(Say("OK")) 485 486 Expect(testUI.Err).To(Say("get security group warning")) 487 Expect(testUI.Err).To(Say("get org warning")) 488 Expect(testUI.Err).To(Say("get org spaces warning")) 489 }) 490 }) 491 492 When("there are spaces in the org", func() { 493 BeforeEach(func() { 494 fakeActor.GetOrganizationSpacesReturns( 495 []v2action.Space{ 496 { 497 GUID: "some-space-guid-1", 498 Name: "some-space-1", 499 }, 500 { 501 GUID: "some-space-guid-2", 502 Name: "some-space-2", 503 }, 504 }, 505 v2action.Warnings{"get org spaces warning"}, 506 nil) 507 }) 508 509 When("no errors are encountered binding the security group to the spaces", func() { 510 BeforeEach(func() { 511 fakeActor.BindSecurityGroupToSpaceReturnsOnCall( 512 0, 513 v2action.Warnings{"bind security group to space warning 1"}, 514 nil) 515 fakeActor.BindSecurityGroupToSpaceReturnsOnCall( 516 1, 517 v2action.Warnings{"bind security group to space warning 2"}, 518 nil) 519 }) 520 521 It("binds the security group to each space and displays all warnings", func() { 522 Expect(executeErr).NotTo(HaveOccurred()) 523 524 Expect(testUI.Out).To(Say(`Assigning security group some-security-group to space some-space-1 in org some-org as some-user\.\.\.`)) 525 Expect(testUI.Out).To(Say("OK")) 526 Expect(testUI.Out).To(Say(`Assigning security group some-security-group to space some-space-2 in org some-org as some-user\.\.\.`)) 527 Expect(testUI.Out).To(Say("OK")) 528 Expect(testUI.Out).To(Say(`TIP: Changes require an app restart \(for running\) or restage \(for staging\) to apply to existing applications\.`)) 529 530 Expect(testUI.Err).To(Say("get security group warning")) 531 Expect(testUI.Err).To(Say("get org warning")) 532 Expect(testUI.Err).To(Say("get org spaces warning")) 533 Expect(testUI.Err).To(Say("bind security group to space warning 1")) 534 Expect(testUI.Err).To(Say("bind security group to space warning 2")) 535 536 Expect(fakeActor.GetSecurityGroupByNameCallCount()).To(Equal(1)) 537 Expect(fakeActor.GetSecurityGroupByNameArgsForCall(0)).To(Equal("some-security-group")) 538 539 Expect(fakeActor.GetOrganizationByNameCallCount()).To(Equal(1)) 540 Expect(fakeActor.GetOrganizationByNameArgsForCall(0)).To(Equal("some-org")) 541 542 Expect(fakeActor.BindSecurityGroupToSpaceCallCount()).To(Equal(2)) 543 securityGroupGUID, spaceGUID, lifecycle := fakeActor.BindSecurityGroupToSpaceArgsForCall(0) 544 Expect(securityGroupGUID).To(Equal("some-security-group-guid")) 545 Expect(spaceGUID).To(Equal("some-space-guid-1")) 546 Expect(lifecycle).To(Equal(constant.SecurityGroupLifecycleStaging)) 547 securityGroupGUID, spaceGUID, lifecycle = fakeActor.BindSecurityGroupToSpaceArgsForCall(1) 548 Expect(securityGroupGUID).To(Equal("some-security-group-guid")) 549 Expect(spaceGUID).To(Equal("some-space-guid-2")) 550 Expect(lifecycle).To(Equal(constant.SecurityGroupLifecycleStaging)) 551 }) 552 }) 553 554 When("an error is encountered binding the security group to a space", func() { 555 var expectedErr error 556 557 BeforeEach(func() { 558 expectedErr = errors.New("bind security group to space error") 559 fakeActor.BindSecurityGroupToSpaceReturns( 560 v2action.Warnings{"bind security group to space warning"}, 561 expectedErr) 562 }) 563 564 It("returns the error and displays all warnings", func() { 565 Expect(executeErr).To(MatchError(expectedErr)) 566 567 Expect(testUI.Out).NotTo(Say("OK")) 568 569 Expect(testUI.Err).To(Say("get security group warning")) 570 Expect(testUI.Err).To(Say("get org warning")) 571 Expect(testUI.Err).To(Say("get org spaces warning")) 572 Expect(testUI.Err).To(Say("bind security group to space warning")) 573 }) 574 }) 575 }) 576 577 When("an error is encountered getting spaces in the org", func() { 578 var expectedErr error 579 580 BeforeEach(func() { 581 expectedErr = errors.New("get org spaces error") 582 fakeActor.GetOrganizationSpacesReturns( 583 nil, 584 v2action.Warnings{"get org spaces warning"}, 585 expectedErr) 586 }) 587 588 It("returns the error and displays all warnings", func() { 589 Expect(executeErr).To(MatchError(expectedErr)) 590 Expect(testUI.Err).To(Say("get security group warning")) 591 Expect(testUI.Err).To(Say("get org warning")) 592 Expect(testUI.Err).To(Say("get org spaces warning")) 593 }) 594 }) 595 }) 596 }) 597 })