github.com/sleungcy-sap/cli@v7.1.0+incompatible/integration/v7/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  	When("output is in English", func() {
    17  		BeforeEach(func() {
    18  			helpers.LoginCF()
    19  			helpers.TargetOrgAndSpace(ReadOnlyOrg, ReadOnlySpace)
    20  		})
    21  
    22  		// Developer note: The spacing in this test is significant and explicit. Do
    23  		// not replace with a regex.
    24  		It("aligns the table correctly", func() {
    25  			username, _ := helpers.GetCredentials()
    26  			session := helpers.CF("target")
    27  			Eventually(session).Should(Say("API endpoint:   %s", apiURL))
    28  			Eventually(session).Should(Say(`API version:    [\d.]+`))
    29  			Eventually(session).Should(Say("user:           %s", username))
    30  			Eventually(session).Should(Say("org:            %s", ReadOnlyOrg))
    31  			Eventually(session).Should(Say("space:          %s", ReadOnlySpace))
    32  			Eventually(session).Should(Exit(0))
    33  		})
    34  	})
    35  
    36  	// TODO: un-pend when we have a translation for "API version:"
    37  	PWhen("output is in language with multibyte characters", func() {
    38  		BeforeEach(func() {
    39  			helpers.LoginCF()
    40  			helpers.TargetOrgAndSpace(ReadOnlyOrg, ReadOnlySpace)
    41  		})
    42  
    43  		// Developer note: The spacing in this test is significant and explicit. Do
    44  		// not replace with a regex.
    45  		It("aligns the table correctly", func() {
    46  			username, _ := helpers.GetCredentials()
    47  			session := helpers.CFWithEnv(map[string]string{"LANG": "ja-JP.utf8"}, "target")
    48  			Eventually(session).Should(Say("API エンドポイント   %s", apiURL))
    49  			Eventually(session).Should(Say(`API バージョン:      [\d.]+`))
    50  			Eventually(session).Should(Say("ユーザー:            %s", username))
    51  			Eventually(session).Should(Say("組織:                %s", ReadOnlyOrg))
    52  			Eventually(session).Should(Say("スペース:            %s", ReadOnlySpace))
    53  			Eventually(session).Should(Exit(0))
    54  		})
    55  	})
    56  })