Skip to content

Commit 8cc8baf

Browse files
committed
civo test case added
1 parent 51f994c commit 8cc8baf

File tree

4 files changed

+35
-17
lines changed

4 files changed

+35
-17
lines changed

plugins/civo/api_key_test.go

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ package civo
22

33
import (
44
"testing"
5-
5+
66
"github.com/1Password/shell-plugins/sdk"
77
"github.com/1Password/shell-plugins/sdk/plugintest"
88
"github.com/1Password/shell-plugins/sdk/schema/fieldname"
99
)
10-
10+
1111
func TestAPIKeyProvisioner(t *testing.T) {
1212
plugintest.TestProvisioner(t, APIKey().DefaultProvisioner, map[string]plugintest.ProvisionCase{
1313
"default": {
@@ -26,29 +26,34 @@ func TestAPIKeyProvisioner(t *testing.T) {
2626
func TestAPIKeyImporter(t *testing.T) {
2727
plugintest.TestImporter(t, APIKey().Importer, map[string]plugintest.ImportCase{
2828
"environment": {
29-
Environment: map[string]string{ // TODO: Check if this is correct
30-
"CIVO_API_KEY": "XFIx85McyfCQc490j1tBa5b5s2XiWerNdOdfnkrOnchEXAMPLE",
29+
Environment: map[string]string{
30+
"CIVO_API_KEY": "XFIx85McyfCQc490j1tBa5b5s2XiWerNdOdfnkrOnchEXAMPLE",
31+
"CIVO_API_KEY_NAME": "testdemoname",
3132
},
3233
ExpectedCandidates: []sdk.ImportCandidate{
3334
{
3435
Fields: map[sdk.FieldName]string{
35-
fieldname.APIKey: "XFIx85McyfCQc490j1tBa5b5s2XiWerNdOdfnkrOnchEXAMPLE",
36+
fieldname.APIKey: "XFIx85McyfCQc490j1tBa5b5s2XiWerNdOdfnkrOnchEXAMPLE",
37+
fieldname.APIKeyID: "testdemoname",
3638
},
3739
},
3840
},
3941
},
40-
// TODO: If you implemented a config file importer, add a test file example in civo/test-fixtures
41-
// and fill the necessary details in the test template below.
42+
4243
"config file": {
4344
Files: map[string]string{
44-
// "~/path/to/config.yml": plugintest.LoadFixture(t, "config.yml"),
45+
46+
"~/.civo.json": plugintest.LoadFixture(t, "civo.json"),
4547
},
4648
ExpectedCandidates: []sdk.ImportCandidate{
47-
// {
48-
// Fields: map[sdk.FieldName]string{
49-
// fieldname.Token: "XFIx85McyfCQc490j1tBa5b5s2XiWerNdOdfnkrOnchEXAMPLE",
50-
// },
51-
// },
49+
50+
{
51+
Fields: map[sdk.FieldName]string{
52+
fieldname.APIKey: "XFIx85McyfCQc490j1tBa5b5s2XiWerNdOdfnkrOnchEXAMPLE",
53+
fieldname.APIKeyID: "testdemoname",
54+
fieldname.DefaultRegion: "LON1",
55+
},
56+
},
5257
},
5358
},
5459
})

plugins/civo/civo.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import (
99

1010
func CivoCLI() schema.Executable {
1111
return schema.Executable{
12-
Name: "Civo CLI", // TODO: Check if this is correct
13-
Runs: []string{"civo"},
14-
DocsURL: sdk.URL("https://civo.com/docs/cli"), // TODO: Replace with actual URL
12+
Name: "Civo CLI",
13+
Runs: []string{"civo"},
14+
DocsURL: sdk.URL("https://civo.com/docs/cli"),
1515
NeedsAuth: needsauth.IfAll(
1616
needsauth.NotForHelpOrVersion(),
1717
needsauth.NotWithoutArgs(),

plugins/civo/plugin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ func New() schema.Plugin {
1010
Name: "civo",
1111
Platform: schema.PlatformInfo{
1212
Name: "Civo",
13-
Homepage: sdk.URL("https://civo.com"), // TODO: Check if this is correct
13+
Homepage: sdk.URL("https://civo.com"),
1414
},
1515
Credentials: []schema.CredentialType{
1616
APIKey(),
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"apikeys": {
3+
"newspidey": "XFIx85McyfCQc490j1tBa5b5s2XiWerNdOdfnkrOnchEXAMPLE"
4+
},
5+
"meta": {
6+
"admin": false,
7+
"current_apikey": "newspidey",
8+
"default_region": "LON1",
9+
"latest_release_check": "2023-06-11T20:25:06.916682112+05:30",
10+
"url": "https://api.civo.com",
11+
"last_command_executed": "2023-06-11T20:25:06.916237569+05:30"
12+
}
13+
}

0 commit comments

Comments
 (0)