@@ -158,7 +158,8 @@ var _ = Describe("login Command", func() {
158
158
When ("config does not have an API endpoint set and the user enters the endpoint at the prompt" , func () {
159
159
BeforeEach (func () {
160
160
cmd .APIEndpoint = ""
161
- input .Write ([]byte ("api.example.com\n " ))
161
+ _ , err := input .Write ([]byte ("api.example.com\n " ))
162
+ Expect (err ).NotTo (HaveOccurred ())
162
163
fakeConfig .TargetReturnsOnCall (0 , "" )
163
164
fakeConfig .TargetReturnsOnCall (1 , "https://api.example.com" )
164
165
})
@@ -209,7 +210,8 @@ var _ = Describe("login Command", func() {
209
210
When ("the user inputs an empty API" , func () {
210
211
BeforeEach (func () {
211
212
cmd .APIEndpoint = ""
212
- input .Write ([]byte ("\n \n api.example.com\n " ))
213
+ _ , err := input .Write ([]byte ("\n \n api.example.com\n " ))
214
+ Expect (err ).NotTo (HaveOccurred ())
213
215
fakeConfig .TargetReturnsOnCall (0 , "" )
214
216
fakeConfig .TargetReturnsOnCall (1 , "https://api.example.com" )
215
217
})
@@ -417,7 +419,8 @@ var _ = Describe("login Command", func() {
417
419
418
420
When ("the password is incorrect" , func () {
419
421
BeforeEach (func () {
420
- input .Write ([]byte ("other-password\n " ))
422
+ _ , err := input .Write ([]byte ("other-password\n " ))
423
+ Expect (err ).NotTo (HaveOccurred ())
421
424
fakeActor .AuthenticateReturns (errors .New ("bad creds" ))
422
425
})
423
426
@@ -429,7 +432,8 @@ var _ = Describe("login Command", func() {
429
432
430
433
When ("there have been too many failed login attempts" , func () {
431
434
BeforeEach (func () {
432
- input .Write ([]byte ("other-password\n " ))
435
+ _ , err := input .Write ([]byte ("other-password\n " ))
436
+ Expect (err ).NotTo (HaveOccurred ())
433
437
fakeActor .AuthenticateReturns (
434
438
uaa.AccountLockedError {
435
439
Message : "Your account has been locked because of too many failed attempts to login." ,
@@ -502,7 +506,8 @@ var _ = Describe("login Command", func() {
502
506
503
507
When ("no authentication flags are set" , func () {
504
508
BeforeEach (func () {
505
- input .Write ([]byte ("faker\n someaccount\n somepassword\n garbage\n " ))
509
+ _ , err := input .Write ([]byte ("faker\n someaccount\n somepassword\n garbage\n " ))
510
+ Expect (err ).NotTo (HaveOccurred ())
506
511
})
507
512
508
513
It ("displays text prompts, starting with username, then password prompts, starting with password" , func () {
@@ -633,7 +638,8 @@ var _ = Describe("login Command", func() {
633
638
When ("authenticating succeeds" , func () {
634
639
BeforeEach (func () {
635
640
fakeConfig .CurrentUserNameReturns ("potatoface" , nil )
636
- input .Write ([]byte ("faker\n someaccount\n somepassword\n garbage\n " ))
641
+ _ , err := input .Write ([]byte ("faker\n someaccount\n somepassword\n garbage\n " ))
642
+ Expect (err ).NotTo (HaveOccurred ())
637
643
})
638
644
639
645
It ("displays OK and a status summary" , func () {
@@ -649,7 +655,8 @@ var _ = Describe("login Command", func() {
649
655
When ("authenticating fails" , func () {
650
656
BeforeEach (func () {
651
657
fakeActor .AuthenticateReturns (errors .New ("something died" ))
652
- input .Write ([]byte ("faker\n someaccount\n somepassword\n garbage\n faker\n someaccount\n somepassword\n garbage\n faker\n someaccount\n somepassword\n garbage\n " ))
658
+ _ , err := input .Write ([]byte ("faker\n someaccount\n somepassword\n garbage\n faker\n someaccount\n somepassword\n garbage\n faker\n someaccount\n somepassword\n garbage\n " ))
659
+ Expect (err ).NotTo (HaveOccurred ())
653
660
})
654
661
655
662
It ("prints the error message three times" , func () {
@@ -678,7 +685,8 @@ var _ = Describe("login Command", func() {
678
685
When ("authenticating fails with a bad credentials error" , func () {
679
686
BeforeEach (func () {
680
687
fakeActor .AuthenticateReturns (uaa.UnauthorizedError {Message : "Bad credentials" })
681
- input .Write ([]byte ("faker\n someaccount\n somepassword\n garbage\n faker\n someaccount\n somepassword\n garbage\n faker\n someaccount\n somepassword\n garbage\n " ))
688
+ _ , err := input .Write ([]byte ("faker\n someaccount\n somepassword\n garbage\n faker\n someaccount\n somepassword\n garbage\n faker\n someaccount\n somepassword\n garbage\n " ))
689
+ Expect (err ).NotTo (HaveOccurred ())
682
690
})
683
691
684
692
It ("converts the error before printing it" , func () {
@@ -719,7 +727,8 @@ var _ = Describe("login Command", func() {
719
727
BeforeEach (func () {
720
728
fakeConfig .TargetReturns (fakeAPI )
721
729
722
- input .Write ([]byte ("some-passcode\n " ))
730
+ _ , err := input .Write ([]byte ("some-passcode\n " ))
731
+ Expect (err ).NotTo (HaveOccurred ())
723
732
fakeActor .GetLoginPromptsReturns (map [string ]coreconfig.AuthPrompt {
724
733
"passcode" : {
725
734
DisplayName : "some-sso-prompt" ,
@@ -809,7 +818,8 @@ var _ = Describe("login Command", func() {
809
818
Message : "Bad credentials" ,
810
819
})
811
820
fakeConfig .CurrentUserNameReturns ("" , nil )
812
- input .Write ([]byte ("some-passcode\n " ))
821
+ _ , err := input .Write ([]byte ("some-passcode\n " ))
822
+ Expect (err ).NotTo (HaveOccurred ())
813
823
})
814
824
815
825
It ("re-prompts two more times" , func () {
@@ -1043,7 +1053,8 @@ var _ = Describe("login Command", func() {
1043
1053
fakeConfig .TargetedOrganizationReturns (configv3.Organization {
1044
1054
GUID : "targeted-org-guid1" })
1045
1055
fakeConfig .TargetedOrganizationNameReturns ("targeted-org-name" )
1046
- input .Write ([]byte ("2\n " ))
1056
+ _ , err := input .Write ([]byte ("2\n " ))
1057
+ Expect (err ).NotTo (HaveOccurred ())
1047
1058
})
1048
1059
1049
1060
It ("prompts the user to select an org" , func () {
@@ -1070,7 +1081,8 @@ var _ = Describe("login Command", func() {
1070
1081
1071
1082
When ("the position is invalid" , func () {
1072
1083
BeforeEach (func () {
1073
- input .Write ([]byte ("4\n " ))
1084
+ _ , err := input .Write ([]byte ("4\n " ))
1085
+ Expect (err ).NotTo (HaveOccurred ())
1074
1086
})
1075
1087
1076
1088
It ("reprompts the user" , func () {
@@ -1091,7 +1103,8 @@ var _ = Describe("login Command", func() {
1091
1103
When ("the user selects an org by name" , func () {
1092
1104
When ("the list contains that org" , func () {
1093
1105
BeforeEach (func () {
1094
- input .Write ([]byte ("some-org-name2\n " ))
1106
+ _ , err := input .Write ([]byte ("some-org-name2\n " ))
1107
+ Expect (err ).NotTo (HaveOccurred ())
1095
1108
})
1096
1109
1097
1110
It ("prompts the user to select an org" , func () {
@@ -1113,7 +1126,8 @@ var _ = Describe("login Command", func() {
1113
1126
1114
1127
When ("the org is not in the list" , func () {
1115
1128
BeforeEach (func () {
1116
- input .Write ([]byte ("invalid-org\n " ))
1129
+ _ , err := input .Write ([]byte ("invalid-org\n " ))
1130
+ Expect (err ).NotTo (HaveOccurred ())
1117
1131
})
1118
1132
1119
1133
It ("returns an error" , func () {
@@ -1166,7 +1180,8 @@ var _ = Describe("login Command", func() {
1166
1180
When ("the user selects an org by name" , func () {
1167
1181
When ("the list contains that org" , func () {
1168
1182
BeforeEach (func () {
1169
- input .Write ([]byte ("org37\n " ))
1183
+ _ , err := input .Write ([]byte ("org37\n " ))
1184
+ Expect (err ).NotTo (HaveOccurred ())
1170
1185
})
1171
1186
1172
1187
It ("prompts the user to select an org" , func () {
@@ -1185,7 +1200,8 @@ var _ = Describe("login Command", func() {
1185
1200
1186
1201
When ("the org is not in the list" , func () {
1187
1202
BeforeEach (func () {
1188
- input .Write ([]byte ("invalid-org\n " ))
1203
+ _ , err := input .Write ([]byte ("invalid-org\n " ))
1204
+ Expect (err ).NotTo (HaveOccurred ())
1189
1205
})
1190
1206
1191
1207
It ("returns an error" , func () {
@@ -1421,7 +1437,8 @@ var _ = Describe("login Command", func() {
1421
1437
When ("the user selects a space by list position" , func () {
1422
1438
When ("the position is valid" , func () {
1423
1439
BeforeEach (func () {
1424
- input .Write ([]byte ("2\n " ))
1440
+ _ , err := input .Write ([]byte ("2\n " ))
1441
+ Expect (err ).NotTo (HaveOccurred ())
1425
1442
})
1426
1443
1427
1444
It ("targets that space" , func () {
@@ -1436,7 +1453,8 @@ var _ = Describe("login Command", func() {
1436
1453
1437
1454
When ("the position is invalid" , func () {
1438
1455
BeforeEach (func () {
1439
- input .Write ([]byte ("-1\n " ))
1456
+ _ , err := input .Write ([]byte ("-1\n " ))
1457
+ Expect (err ).NotTo (HaveOccurred ())
1440
1458
})
1441
1459
1442
1460
It ("reprompts the user" , func () {
@@ -1463,7 +1481,8 @@ var _ = Describe("login Command", func() {
1463
1481
When ("the user selects a space by name" , func () {
1464
1482
When ("the list contains that space" , func () {
1465
1483
BeforeEach (func () {
1466
- input .Write ([]byte ("some-space-name2\n " ))
1484
+ _ , err := input .Write ([]byte ("some-space-name2\n " ))
1485
+ Expect (err ).NotTo (HaveOccurred ())
1467
1486
})
1468
1487
1469
1488
It ("targets that space" , func () {
@@ -1478,7 +1497,8 @@ var _ = Describe("login Command", func() {
1478
1497
1479
1498
When ("the space is not in the list" , func () {
1480
1499
BeforeEach (func () {
1481
- input .Write ([]byte ("invalid-space\n " ))
1500
+ _ , err := input .Write ([]byte ("invalid-space\n " ))
1501
+ Expect (err ).NotTo (HaveOccurred ())
1482
1502
})
1483
1503
1484
1504
It ("returns an error" , func () {
@@ -1515,7 +1535,8 @@ var _ = Describe("login Command", func() {
1515
1535
When ("the user enters text which is both a space name and a digit" , func () {
1516
1536
When ("the entry is a valid position" , func () {
1517
1537
BeforeEach (func () {
1518
- input .Write ([]byte ("3\n " ))
1538
+ _ , err := input .Write ([]byte ("3\n " ))
1539
+ Expect (err ).NotTo (HaveOccurred ())
1519
1540
})
1520
1541
1521
1542
It ("targets the space at the index specified" , func () {
@@ -1530,7 +1551,8 @@ var _ = Describe("login Command", func() {
1530
1551
1531
1552
When ("the entry is an invalid position" , func () {
1532
1553
BeforeEach (func () {
1533
- input .Write ([]byte ("100\n " ))
1554
+ _ , err := input .Write ([]byte ("100\n " ))
1555
+ Expect (err ).NotTo (HaveOccurred ())
1534
1556
})
1535
1557
1536
1558
It ("reprompts the user" , func () {
@@ -1578,7 +1600,8 @@ var _ = Describe("login Command", func() {
1578
1600
When ("the user selects an space by name" , func () {
1579
1601
When ("the list contains that space" , func () {
1580
1602
BeforeEach (func () {
1581
- input .Write ([]byte ("space-37\n " ))
1603
+ _ , err := input .Write ([]byte ("space-37\n " ))
1604
+ Expect (err ).NotTo (HaveOccurred ())
1582
1605
})
1583
1606
1584
1607
It ("targets that space" , func () {
@@ -1592,7 +1615,8 @@ var _ = Describe("login Command", func() {
1592
1615
1593
1616
When ("the name is a valid list position, but it does not match a space name" , func () {
1594
1617
BeforeEach (func () {
1595
- input .Write ([]byte ("31\n " ))
1618
+ _ , err := input .Write ([]byte ("31\n " ))
1619
+ Expect (err ).NotTo (HaveOccurred ())
1596
1620
})
1597
1621
1598
1622
It ("returns an error" , func () {
@@ -1607,7 +1631,8 @@ var _ = Describe("login Command", func() {
1607
1631
1608
1632
When ("the space is not in the list" , func () {
1609
1633
BeforeEach (func () {
1610
- input .Write ([]byte ("invalid-space\n " ))
1634
+ _ , err := input .Write ([]byte ("invalid-space\n " ))
1635
+ Expect (err ).NotTo (HaveOccurred ())
1611
1636
})
1612
1637
1613
1638
It ("returns an error" , func () {
@@ -1671,7 +1696,8 @@ var _ = Describe("login Command", func() {
1671
1696
nil ,
1672
1697
)
1673
1698
1674
- input .Write ([]byte ("2\n " ))
1699
+ _ , err := input .Write ([]byte ("2\n " ))
1700
+ Expect (err ).NotTo (HaveOccurred ())
1675
1701
})
1676
1702
1677
1703
It ("outputs targeted org" , func () {
0 commit comments