@@ -2,12 +2,12 @@ package civo
22
33import (
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+
1111func 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) {
2626func 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 })
0 commit comments