forked from ernoaapa/fetch-ssh-keys
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ernoaapa#16 from arnested/deploy-key
Add `--deploy-key` parameter
- Loading branch information
Showing
4 changed files
with
80 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// +build deploy_key | ||
|
||
package fetch | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
log "github.com/Sirupsen/logrus" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestFetchDeployKeys(t *testing.T) { | ||
log.SetLevel(log.DebugLevel) | ||
|
||
keys, err := GitHubDeployKeys([]string{"arnested/fetch-ssh-keys"}, os.Getenv("GITHUB_TOKEN")) | ||
|
||
assert.NoError(t, err, "Fetch GitHub keys returned error") | ||
assert.Equal(t, 1, len(keys), "should return SSH keys for 'arnested/fetch-ssh-keys'") | ||
assert.True(t, len(keys["arnested/fetch-ssh-keys"]) > 0, "should return 'arnested/fetch-ssh-keys' deploy SSH key") | ||
assert.True(t, len(keys["arnested/fetch-ssh-keys"][0]) > 0, "should not return empty key for 'arnested/fetch-ssh-keys'") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters