From 5ed666574953a1d8b2f7e135f15a681274a5aeab Mon Sep 17 00:00:00 2001 From: Cheithanya Date: Fri, 16 Jun 2023 01:18:43 +0530 Subject: [PATCH] civo plugin added --- plugins/civo/api_key_test.go | 39 +++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/plugins/civo/api_key_test.go b/plugins/civo/api_key_test.go index 900820ea8..453a75c3c 100644 --- a/plugins/civo/api_key_test.go +++ b/plugins/civo/api_key_test.go @@ -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", }, }, }, @@ -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", + }, + }, }, }, })