Merge pull request #9770 from cli/kw/github-cli-591-add-acceptance-tests-for-api-commands

Add basic `api` acceptance tests
This commit is contained in:
William Martin 2024-10-17 16:05:26 +02:00 committed by GitHub
commit d2559f007f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 0 deletions

View file

@ -55,6 +55,15 @@ func TestWorkflows(t *testing.T) {
testscript.Run(t, testScriptParamsFor(tsEnv, "workflow"))
}
func TestAPI(t *testing.T) {
var tsEnv testScriptEnv
if err := tsEnv.fromEnv(); err != nil {
t.Fatal(err)
}
testscript.Run(t, testScriptParamsFor(tsEnv, "api"))
}
func testScriptParamsFor(tsEnv testScriptEnv, command string) testscript.Params {
var files []string
if tsEnv.script != "" {

View file

@ -0,0 +1,3 @@
# Basic graphql request
exec gh api graphql -f query='query { viewer { login } }'
stdout '"login":'

View file

@ -0,0 +1,3 @@
# Basic REST request
exec gh api /user
stdout '"login":'