Skip to content

Commit

Permalink
civo plugin added
Browse files Browse the repository at this point in the history
  • Loading branch information
itsCheithanya committed Jun 15, 2023
1 parent 8941afc commit 5ed6665
Showing 1 changed file with 23 additions and 16 deletions.
39 changes: 23 additions & 16 deletions plugins/civo/api_key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@ package civo

import (
"testing"

"github.com/1Password/shell-plugins/sdk"
"github.com/1Password/shell-plugins/sdk/plugintest"
"github.com/1Password/shell-plugins/sdk/schema/fieldname"
)

func TestAPIKeyProvisioner(t *testing.T) {
plugintest.TestProvisioner(t, APIKey().DefaultProvisioner, map[string]plugintest.ProvisionCase{
"default": {
ItemFields: map[sdk.FieldName]string{ // TODO: Check if this is correct
fieldname.APIKey: "amqsmbexample",
ItemFields: map[sdk.FieldName]string{
fieldname.APIKey: "XFIx85McyfCQc490j1tBa5b5s2XiWerNdOdfnkrOnchEXAMPLE",
fieldname.APIKeyID: "testdemoname",
},
ExpectedOutput: sdk.ProvisionOutput{
Environment: map[string]string{
"CIVO_API_KEY": "amqsmbexample",
"CIVO_API_KEY": "XFIx85McyfCQc490j1tBa5b5s2XiWerNdOdfnkrOnchEXAMPLE",
"CIVO_API_KEY_NAME": "testdemoname",
},
},
},
Expand All @@ -26,29 +28,34 @@ func TestAPIKeyProvisioner(t *testing.T) {
func TestAPIKeyImporter(t *testing.T) {
plugintest.TestImporter(t, APIKey().Importer, map[string]plugintest.ImportCase{
"environment": {
Environment: map[string]string{ // TODO: Check if this is correct
"CIVO_API_KEY": "amqsmbexample",
Environment: map[string]string{
"CIVO_API_KEY": "XFIx85McyfCQc490j1tBa5b5s2XiWerNdOdfnkrOnchEXAMPLE",
"CIVO_API_KEY_NAME": "testdemoname",
},
ExpectedCandidates: []sdk.ImportCandidate{
{
Fields: map[sdk.FieldName]string{
fieldname.APIKey: "amqsmbexample",
fieldname.APIKey: "XFIx85McyfCQc490j1tBa5b5s2XiWerNdOdfnkrOnchEXAMPLE",
fieldname.APIKeyID: "testdemoname",
},
},
},
},
// TODO: If you implemented a config file importer, add a test file example in civo/test-fixtures
// and fill the necessary details in the test template below.

"config file": {
Files: map[string]string{
// "~/path/to/config.yml": plugintest.LoadFixture(t, "config.yml"),

"~/.civo.json": plugintest.LoadFixture(t, "civo.json"),
},
ExpectedCandidates: []sdk.ImportCandidate{
// {
// Fields: map[sdk.FieldName]string{
// fieldname.Token: "amqsmbexample",
// },
// },

{
Fields: map[sdk.FieldName]string{
fieldname.APIKey: "XFIx85McyfCQc490j1tBa5b5s2XiWerNdOdfnkrOnchEXAMPLE",
fieldname.APIKeyID: "testdemoname",
fieldname.DefaultRegion: "LON1",
},
},
},
},
})
Expand Down

0 comments on commit 5ed6665

Please sign in to comment.