github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/test/integration/hello_int_example_test.go (about)

     1  package integration
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/ActiveState/cli/internal/testhelpers/e2e"
     7  	"github.com/ActiveState/cli/internal/testhelpers/suite"
     8  	"github.com/ActiveState/cli/internal/testhelpers/tagsuite"
     9  )
    10  
    11  type HelloIntegrationTestSuite struct {
    12  	tagsuite.Suite
    13  }
    14  
    15  func (suite *HelloIntegrationTestSuite) TestHello() {
    16  	suite.OnlyRunForTags(tagsuite.HelloExample)
    17  
    18  	ts := e2e.New(suite.T(), false)
    19  	defer ts.Close()
    20  
    21  	cp := ts.Spawn("checkout", "ActiveState-CLI/small-python", ".")
    22  	cp.Expect("Checked out project")
    23  	cp.ExpectExitCode(0)
    24  
    25  	cp = ts.Spawn("_hello", "Person")
    26  	cp.Expect("Hello, Person!")
    27  	cp.ExpectExitCode(0)
    28  
    29  	cp = ts.Spawn("_hello", "")
    30  	cp.Expect("Cannot say hello because no name was provided")
    31  	cp.ExpectNotExitCode(0)
    32  	ts.IgnoreLogErrors()
    33  
    34  	cp = ts.Spawn("_hello", "Person", "--extra")
    35  	cp.Expect("Project: ActiveState-CLI/small-python")
    36  	cp.Expect("Current commit message:")
    37  	cp.ExpectExitCode(0)
    38  
    39  	cp = ts.Spawn("_hello", "Person", "--echo", "example")
    40  	cp.Expect("Echoing: example")
    41  	cp.ExpectExitCode(0)
    42  }
    43  
    44  func TestHelloIntegrationTestSuite(t *testing.T) {
    45  	suite.Run(t, new(HelloIntegrationTestSuite))
    46  }