Add SSH Key Acceptance test
This commit is contained in:
parent
ff9b0a1c64
commit
76e6fbba36
2 changed files with 33 additions and 0 deletions
|
|
@ -126,6 +126,15 @@ func TestLabels(t *testing.T) {
|
|||
testscript.Run(t, testScriptParamsFor(tsEnv, "label"))
|
||||
}
|
||||
|
||||
func TestSSHKeys(t *testing.T) {
|
||||
var tsEnv testScriptEnv
|
||||
if err := tsEnv.fromEnv(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
testscript.Run(t, testScriptParamsFor(tsEnv, "ssh-key"))
|
||||
}
|
||||
|
||||
func testScriptParamsFor(tsEnv testScriptEnv, command string) testscript.Params {
|
||||
var files []string
|
||||
if tsEnv.script != "" {
|
||||
|
|
|
|||
24
acceptance/testdata/ssh-key/ssh-key.txtar
vendored
Normal file
24
acceptance/testdata/ssh-key/ssh-key.txtar
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
skip 'it modifies the user''s personal GitHub account SSH keys'
|
||||
|
||||
# scopes admin:ssh_signing_key,admin:public_key
|
||||
|
||||
# Add an SSH key to the account
|
||||
exec gh ssh-key add sshKey.pub --title 'acceptance-test-key'
|
||||
|
||||
# List the SSH keys
|
||||
exec gh ssh-key list
|
||||
stdout 'acceptance-test-key'
|
||||
|
||||
# Get the ID of the key we created
|
||||
exec gh api /user/keys --jq '.[] | select(.title == "acceptance-test-key") | .id'
|
||||
stdout2env SSH_KEY_ID
|
||||
|
||||
# Delete the SSH key
|
||||
exec gh ssh-key delete --yes ${SSH_KEY_ID}
|
||||
|
||||
# Check the key is deleted
|
||||
exec gh ssh-key list
|
||||
! stdout 'acceptance-test-key'
|
||||
|
||||
-- sshKey.pub --
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAZmdeRNskfpvYL5YHB/YJaW8hTEXpnvPMkx5Ri+YwUr acceptance
|
||||
Loading…
Add table
Add a link
Reference in a new issue