Skip to content

Commit 5a4f617

Browse files
committed
add provisioner test
1 parent 05c8801 commit 5a4f617

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

plugins/akamai/credentials.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ func Credentials() schema.CredentialType {
7272
},
7373
},
7474
DefaultProvisioner: provision.TempFile(configFile,
75+
provision.Filename(".edgerc"),
7576
provision.AddArgs(
7677
"--edgerc", "{{ .Path }}",
7778
"--section", "default",

plugins/akamai/credentials_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,25 @@ import (
88
"github.com/1Password/shell-plugins/sdk/schema/fieldname"
99
)
1010

11+
func TestCredentialsProvisioner(t *testing.T) {
12+
plugintest.TestProvisioner(t, Credentials().DefaultProvisioner, map[string]plugintest.ProvisionCase{
13+
"default": {
14+
ItemFields: map[sdk.FieldName]string{
15+
fieldname.ClientSecret: "abcdE23FNkBxy456z25qx9Yp5CPUxlEfQeTDkfh4QA=I",
16+
fieldname.Host: "akab-lmn789n2k53w7qrs-nfkxaa4lfk3kd6ym.luna.akamaiapis.net",
17+
fieldname.AccessToken: "akab-zyx987xa6osbli4k-e7jf5ikib5jknes3",
18+
fieldname.ClientToken: "akab-nomoflavjuc4422e-fa2xznerxrm3teg7",
19+
},
20+
ExpectedOutput: sdk.ProvisionOutput{
21+
CommandLine: []string{"--edgerc", "/tmp/.edgerc", "--section", "default"},
22+
Files: map[string]sdk.OutputFile{
23+
"/tmp/.edgerc": {Contents: []byte(plugintest.LoadFixture(t, ".edgerc-single"))},
24+
},
25+
},
26+
},
27+
})
28+
}
29+
1130
func TestCredentialsImporter(t *testing.T) {
1231
plugintest.TestImporter(t, Credentials().Importer, map[string]plugintest.ImportCase{
1332
"config file with single credential": {

0 commit comments

Comments
 (0)