@@ -84,5 +84,81 @@ var _ = Describe("Replica partners", func() {
8484 Expect (fakeUI .Outputs ()).To (ContainSubstring ("There are no replication partners for volume 1234." ))
8585 })
8686 })
87+ Context ("Replica partners with correct volume id and --sortby id" , func () {
88+ BeforeEach (func () {
89+ FakeStorageManager .GetReplicationPartnersReturns (nil , nil )
90+ })
91+ It ("return table" , func () {
92+ err := testhelpers .RunCobraCommand (cliCommand .Command , "442707460" , "--sortby=id" )
93+ Expect (err ).NotTo (HaveOccurred ())
94+ Expect (fakeUI .Outputs ()).To (ContainSubstring ("442707460" ))
95+ })
96+ })
97+
98+ Context ("Replica partners with correct volume id and --sortby accountId" , func () {
99+ BeforeEach (func () {
100+ FakeStorageManager .GetReplicationPartnersReturns (nil , nil )
101+ })
102+ It ("return table" , func () {
103+ err := testhelpers .RunCobraCommand (cliCommand .Command , "307608" , "--sortby=accountId" )
104+ Expect (err ).NotTo (HaveOccurred ())
105+ Expect (fakeUI .Outputs ()).To (ContainSubstring ("307608" ))
106+ })
107+ })
108+
109+ Context ("Replica partners with correct volume id and --sortby capacityGb" , func () {
110+ BeforeEach (func () {
111+ FakeStorageManager .GetReplicationPartnersReturns (nil , nil )
112+ })
113+ It ("return table" , func () {
114+ err := testhelpers .RunCobraCommand (cliCommand .Command , "25" , "--sortby=capacityGb" )
115+ Expect (err ).NotTo (HaveOccurred ())
116+ Expect (fakeUI .Outputs ()).To (ContainSubstring ("25" ))
117+ })
118+ })
119+
120+ Context ("Replica partners with correct volume id and --sortby hardwareId" , func () {
121+ BeforeEach (func () {
122+ FakeStorageManager .GetReplicationPartnersReturns (nil , nil )
123+ })
124+ It ("return table" , func () {
125+ err := testhelpers .RunCobraCommand (cliCommand .Command , "1234" , "--sortby=hardwareId" )
126+ Expect (err ).NotTo (HaveOccurred ())
127+ Expect (fakeUI .Outputs ()).To (ContainSubstring ("1234" ))
128+ })
129+ })
130+
131+ Context ("Replica partners with correct volume id and --sortby guestId" , func () {
132+ BeforeEach (func () {
133+ FakeStorageManager .GetReplicationPartnersReturns (nil , nil )
134+ })
135+ It ("return table" , func () {
136+ err := testhelpers .RunCobraCommand (cliCommand .Command , "1234" , "--sortby=guestId" )
137+ Expect (err ).NotTo (HaveOccurred ())
138+ Expect (fakeUI .Outputs ()).To (ContainSubstring ("1234" ))
139+ })
140+ })
141+
142+ Context ("Replica partners with correct volume id and --sortby hostId" , func () {
143+ BeforeEach (func () {
144+ FakeStorageManager .GetReplicationPartnersReturns (nil , nil )
145+ })
146+ It ("return table" , func () {
147+ err := testhelpers .RunCobraCommand (cliCommand .Command , "1234" , "--sortby=hostId" )
148+ Expect (err ).NotTo (HaveOccurred ())
149+ Expect (fakeUI .Outputs ()).To (ContainSubstring ("1234" ))
150+ })
151+ })
152+
153+ Context ("Replica partners with correct volume id and --sortby abcd" , func () {
154+ BeforeEach (func () {
155+ FakeStorageManager .GetReplicationPartnersReturns (nil , nil )
156+ })
157+ It ("return error" , func () {
158+ err := testhelpers .RunCobraCommand (cliCommand .Command , "1234" , "--sortby=abcd" )
159+ Expect (err ).To (HaveOccurred ())
160+ Expect (err .Error ()).To (ContainSubstring ("Incorrect Usage: --sortby 'abcd' is not supported." ))
161+ })
162+ })
87163 })
88164})
0 commit comments