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

     1  package integration
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/ActiveState/cli/internal/constants"
     7  	"github.com/ActiveState/cli/internal/testhelpers/e2e"
     8  	"github.com/ActiveState/cli/internal/testhelpers/suite"
     9  	"github.com/ActiveState/cli/internal/testhelpers/tagsuite"
    10  )
    11  
    12  type ManifestIntegrationTestSuite struct {
    13  	tagsuite.Suite
    14  }
    15  
    16  func (suite *ManifestIntegrationTestSuite) TestManifest() {
    17  	suite.OnlyRunForTags(tagsuite.Manifest)
    18  	ts := e2e.New(suite.T(), false)
    19  	defer ts.Close()
    20  
    21  	ts.LoginAsPersistentUser()
    22  
    23  	cp := ts.SpawnWithOpts(
    24  		e2e.OptArgs("checkout", "ActiveState/cli#9eee7512-b2ab-4600-b78b-ab0cf2e817d8", "."),
    25  		e2e.OptAppendEnv(constants.DisableRuntime+"=false"),
    26  	)
    27  	cp.Expect("Checked out project", e2e.RuntimeSourcingTimeoutOpt)
    28  
    29  	cp = ts.SpawnWithOpts(
    30  		e2e.OptArgs("manifest"),
    31  		e2e.OptAppendEnv(constants.DisableRuntime+"=false"),
    32  	)
    33  	cp.Expect("Operating on project: ActiveState/cli", e2e.RuntimeSourcingTimeoutOpt)
    34  	cp.Expect("Name")
    35  	cp.Expect("python")
    36  	cp.Expect("3.9.13")
    37  	cp.Expect("1 Critical,")
    38  	cp.Expect("psutil")
    39  	cp.Expect("auto → 5.9.0")
    40  	cp.Expect("None detected")
    41  	cp.ExpectExitCode(0)
    42  }
    43  
    44  func (suite *ManifestIntegrationTestSuite) TestManifest_JSON() {
    45  	suite.OnlyRunForTags(tagsuite.Manifest)
    46  	ts := e2e.New(suite.T(), false)
    47  	defer ts.Close()
    48  
    49  	ts.LoginAsPersistentUser()
    50  
    51  	cp := ts.SpawnWithOpts(
    52  		e2e.OptArgs("checkout", "ActiveState/cli#9eee7512-b2ab-4600-b78b-ab0cf2e817d8", "."),
    53  		e2e.OptAppendEnv(constants.DisableRuntime+"=false"),
    54  	)
    55  	cp.Expect("Checked out project", e2e.RuntimeSourcingTimeoutOpt)
    56  
    57  	cp = ts.SpawnWithOpts(
    58  		e2e.OptArgs("manifest", "--output", "json"),
    59  		e2e.OptAppendEnv(constants.DisableRuntime+"=false"),
    60  	)
    61  	cp.ExpectExitCode(0)
    62  	AssertValidJSON(suite.T(), cp)
    63  	cp.Expect(`"requirements":`)
    64  }
    65  
    66  func TestManifestIntegrationTestSuite(t *testing.T) {
    67  	suite.Run(t, new(ManifestIntegrationTestSuite))
    68  }