github.com/dcarley/cf-cli@v6.24.1-0.20170220111324-4225ff346898+incompatible/integration/isolated/table_alignment_test.go (about)

     1  package isolated
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/integration/helpers"
     5  	. "github.com/onsi/ginkgo"
     6  	. "github.com/onsi/gomega"
     7  	. "github.com/onsi/gomega/gbytes"
     8  	. "github.com/onsi/gomega/gexec"
     9  )
    10  
    11  var _ = Describe("table alignment", func() {
    12  	BeforeEach(func() {
    13  		helpers.LoginCF()
    14  	})
    15  
    16  	Context("when output is in English", func() {
    17  		BeforeEach(func() {
    18  			setupCF(ReadOnlyOrg, ReadOnlySpace)
    19  		})
    20  
    21  		It("aligns the table correctly", func() {
    22  			username, _ := helpers.GetCredentials()
    23  			session := helpers.CF("target")
    24  			Eventually(session.Out).Should(Say("API endpoint:   %s", apiURL))
    25  			Eventually(session.Out).Should(Say(`API version:    [\d.]+`))
    26  			Eventually(session.Out).Should(Say("User:           %s", username))
    27  			Eventually(session.Out).Should(Say("Org:            %s", ReadOnlyOrg))
    28  			Eventually(session.Out).Should(Say("Space:          %s", ReadOnlySpace))
    29  			Eventually(session).Should(Exit(0))
    30  		})
    31  	})
    32  
    33  	Context("when output is in language with multibyte characters", func() {
    34  		BeforeEach(func() {
    35  			setupCF(ReadOnlyOrg, ReadOnlySpace)
    36  		})
    37  
    38  		It("aligns the table correctly", func() {
    39  			username, _ := helpers.GetCredentials()
    40  			session := helpers.CFWithEnv(map[string]string{"LANG": "ja-JP.utf8"}, "target")
    41  			Eventually(session.Out).Should(Say("API エンドポイント:   %s", apiURL))
    42  			Eventually(session.Out).Should(Say(`API version:          [\d.]+`))
    43  			Eventually(session.Out).Should(Say("ユーザー:             %s", username))
    44  			Eventually(session.Out).Should(Say("組織:                 %s", ReadOnlyOrg))
    45  			Eventually(session.Out).Should(Say("スペース:             %s", ReadOnlySpace))
    46  			Eventually(session).Should(Exit(0))
    47  		})
    48  	})
    49  })