github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/test/integration/api_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 ApiIntegrationTestSuite struct { 13 tagsuite.Suite 14 } 15 16 func (suite *ApiIntegrationTestSuite) TestRequestHeaders() { 17 suite.OnlyRunForTags(tagsuite.Critical) 18 19 ts := e2e.New(suite.T(), false) 20 defer ts.Close() 21 22 cp := ts.SpawnWithOpts( 23 e2e.OptArgs("checkout", "ActiveState-CLI/Python3", "."), 24 e2e.OptAppendEnv(constants.PlatformApiPrintRequestsEnvVarName+"=true", "VERBOSE=true"), 25 ) 26 // e.g. User-Agent: state/0.38.0-SHA0deadbeef0; release (Windows; 10.0.22621; x86_64) 27 cp.ExpectRe(`User-Agent: state/(\d+\.?)+-SHA[[:xdigit:]]+; \S+ \([^;]+; [^;]+; [^)]+\)`) 28 cp.ExpectRe(`X-Requestor: [[:xdigit:]-]+`) // UUID 29 cp.ExpectExitCode(0) 30 } 31 32 func TestApiIntegrationTestSuite(t *testing.T) { 33 suite.Run(t, new(ApiIntegrationTestSuite)) 34 }