@@ -251,11 +251,101 @@ var _ = Describe("revision Command", func() {
251251 })
252252 })
253253
254+ When ("no revision version is provided" , func () {
255+ BeforeEach (func () {
256+ deployedRevisions := []resources.Revision {
257+ {
258+ Version : 3 ,
259+ GUID : "A68F13F7-7E5E-4411-88E8-1FAC54F73F50" ,
260+ Description : "On a different note" ,
261+ CreatedAt : "2020-03-10T17:11:58Z" ,
262+ Deployable : true ,
263+ Droplet : resources.Droplet {
264+ GUID : "droplet-guid" ,
265+ },
266+ Links : resources.APILinks {
267+ "environment_variables" : resources.APILink {
268+ HREF : "revision-environment-variables-link-3" ,
269+ },
270+ },
271+ Metadata : & resources.Metadata {
272+ Labels : map [string ]types.NullString {
273+ "label" : types .NewNullString ("foo3" ),
274+ },
275+ Annotations : map [string ]types.NullString {
276+ "annotation" : types .NewNullString ("foo3" ),
277+ },
278+ },
279+ },
280+ {
281+ Version : 2 ,
282+ GUID : "A89F8259-D32B-491A-ABD6-F100AC42D74C" ,
283+ Description : "Something else" ,
284+ CreatedAt : "2020-03-08T12:43:30Z" ,
285+ Deployable : true ,
286+ Droplet : resources.Droplet {
287+ GUID : "droplet-guid2" ,
288+ },
289+ Metadata : & resources.Metadata {},
290+ },
291+ }
292+ fakeActor .GetApplicationByNameAndSpaceReturns (resources.Application {GUID : "app-guid" }, nil , nil )
293+ fakeActor .GetApplicationRevisionsDeployedReturns (deployedRevisions , nil , nil )
294+
295+ environmentVariableGroup := v7action.EnvironmentVariableGroup {
296+ "foo" : * types .NewFilteredString ("bar3" ),
297+ }
298+ fakeActor .GetEnvironmentVariableGroupByRevisionReturns (
299+ environmentVariableGroup ,
300+ true ,
301+ nil ,
302+ nil ,
303+ )
304+ cmd .Version = flag.Revision {NullInt : types.NullInt {Value : 0 , IsSet : false }}
305+ })
306+
307+ It ("displays all deployed revisions" , func () {
308+ Expect (executeErr ).ToNot (HaveOccurred ())
309+
310+ Expect (testUI .Out ).To (Say (`Showing revisions for app some-app in org some-org / space some-space as banana...` ))
311+ Expect (testUI .Out ).To (Say (`revision: 3` ))
312+ Expect (testUI .Out ).To (Say (`deployed: true` ))
313+ Expect (testUI .Out ).To (Say (`description: On a different note` ))
314+ Expect (testUI .Out ).To (Say (`deployable: true` ))
315+ Expect (testUI .Out ).To (Say (`revision GUID: A68F13F7-7E5E-4411-88E8-1FAC54F73F50` ))
316+ Expect (testUI .Out ).To (Say (`droplet GUID: droplet-guid` ))
317+ Expect (testUI .Out ).To (Say (`created on: 2020-03-10T17:11:58Z` ))
318+
319+ Expect (testUI .Out ).To (Say (`labels:` ))
320+ Expect (testUI .Out ).To (Say (`label: foo3` ))
321+
322+ Expect (testUI .Out ).To (Say (`annotations:` ))
323+ Expect (testUI .Out ).To (Say (`annotation: foo3` ))
324+
325+ Expect (testUI .Out ).To (Say (`application environment variables:` ))
326+ Expect (testUI .Out ).To (Say (`foo: bar3` ))
327+
328+ Expect (testUI .Out ).To (Say (`revision: 2` ))
329+ Expect (testUI .Out ).To (Say (`deployed: true` ))
330+ Expect (testUI .Out ).To (Say (`description: Something else` ))
331+ Expect (testUI .Out ).To (Say (`deployable: true` ))
332+ Expect (testUI .Out ).To (Say (`revision GUID: A89F8259-D32B-491A-ABD6-F100AC42D74C` ))
333+ Expect (testUI .Out ).To (Say (`droplet GUID: droplet-guid2` ))
334+ Expect (testUI .Out ).To (Say (`created on: 2020-03-08T12:43:30Z` ))
335+
336+ Expect (testUI .Out ).To (Say (`labels:` ))
337+ Expect (testUI .Out ).To (Say (`annotations:` ))
338+ Expect (testUI .Out ).To (Say (`application environment variables:` ))
339+ Expect (testUI .Out ).To (Say (`foo: bar3` ))
340+ })
341+ })
342+
254343 When ("there are no revisions available" , func () {
255344 BeforeEach (func () {
256345 revision := resources.Revision {
257346 Version : 120 ,
258347 }
348+ cmd .Version = flag.Revision {NullInt : types.NullInt {Value : 120 , IsSet : true }}
259349 fakeActor .GetRevisionByApplicationAndVersionReturns (
260350 revision ,
261351 nil ,
0 commit comments