Skip to content

Commit

Permalink
fixing the Lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
bala-ceg committed Jun 29, 2023
1 parent aca5ec0 commit 8d69215
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
9 changes: 4 additions & 5 deletions plugins/binance/api_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
func APIKey() schema.CredentialType {
return schema.CredentialType{
Name: credname.APIKey,
DocsURL: sdk.URL("https://github.com/binance/binance-cli"),
ManagementURL: sdk.URL("https://www.binance.com/en/my/settings/api-management"),
DocsURL: sdk.URL("https://github.com/binance/binance-cli"),
ManagementURL: sdk.URL("https://www.binance.com/en/my/settings/api-management"),
Fields: []schema.CredentialField{
{
Name: fieldname.APIKey,
Expand Down Expand Up @@ -49,7 +49,6 @@ func APIKey() schema.CredentialType {
}

var defaultEnvVarMapping = map[string]sdk.FieldName{
"BINANCE_API_KEY": fieldname.APIKey,
"BINANCE_API_SECRET": fieldname.APISecret,
"BINANCE_API_KEY": fieldname.APIKey,
"BINANCE_API_SECRET": fieldname.APISecret,
}

17 changes: 8 additions & 9 deletions plugins/binance/api_key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,23 @@ package binance

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{
fieldname.APIKey: "jThmEycY2J0RgJgNNrWQBq2raPzKvxCkcwPQFk8AuWUu5QxQSWaItIB1qEXAMPLE",
ItemFields: map[sdk.FieldName]string{
fieldname.APIKey: "jThmEycY2J0RgJgNNrWQBq2raPzKvxCkcwPQFk8AuWUu5QxQSWaItIB1qEXAMPLE",
fieldname.APISecret: "jThmEycY2J0RgJgNNrWQBq2raPzKvxCkcwPQFk8AuWUu5QxQSWaItIB1qEXAMPLE",
},
ExpectedOutput: sdk.ProvisionOutput{
Environment: map[string]string{
"BINANCE_API_KEY": "jThmEycY2J0RgJgNNrWQBq2raPzKvxCkcwPQFk8AuWUu5QxQSWaItIB1qEXAMPLE",
"BINANCE_API_KEY": "jThmEycY2J0RgJgNNrWQBq2raPzKvxCkcwPQFk8AuWUu5QxQSWaItIB1qEXAMPLE",
"BINANCE_API_SECRET": "jThmEycY2J0RgJgNNrWQBq2raPzKvxCkcwPQFk8AuWUu5QxQSWaItIB1qEXAMPLE",

},
},
},
Expand All @@ -29,14 +28,14 @@ func TestAPIKeyProvisioner(t *testing.T) {
func TestAPIKeyImporter(t *testing.T) {
plugintest.TestImporter(t, APIKey().Importer, map[string]plugintest.ImportCase{
"environment": {
Environment: map[string]string{
"BINANCE_API_KEY": "jThmEycY2J0RgJgNNrWQBq2raPzKvxCkcwPQFk8AuWUu5QxQSWaItIB1qEXAMPLE",
Environment: map[string]string{
"BINANCE_API_KEY": "jThmEycY2J0RgJgNNrWQBq2raPzKvxCkcwPQFk8AuWUu5QxQSWaItIB1qEXAMPLE",
"BINANCE_API_SECRET": "jThmEycY2J0RgJgNNrWQBq2raPzKvxCkcwPQFk8AuWUu5QxQSWaItIB1qEXAMPLE",
},
ExpectedCandidates: []sdk.ImportCandidate{
{
Fields: map[sdk.FieldName]string{
fieldname.APIKey: "jThmEycY2J0RgJgNNrWQBq2raPzKvxCkcwPQFk8AuWUu5QxQSWaItIB1qEXAMPLE",
fieldname.APIKey: "jThmEycY2J0RgJgNNrWQBq2raPzKvxCkcwPQFk8AuWUu5QxQSWaItIB1qEXAMPLE",
fieldname.APISecret: "jThmEycY2J0RgJgNNrWQBq2raPzKvxCkcwPQFk8AuWUu5QxQSWaItIB1qEXAMPLE",
},
},
Expand Down
6 changes: 3 additions & 3 deletions plugins/binance/binance_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (

func BinanceCLI() schema.Executable {
return schema.Executable{
Name: "Binance CLI",
Runs: []string{"binance-cli"},
DocsURL: sdk.URL("https://github.com/binance/binance-cli"),
Name: "Binance CLI",
Runs: []string{"binance-cli"},
DocsURL: sdk.URL("https://github.com/binance/binance-cli"),
NeedsAuth: needsauth.IfAll(
needsauth.NotForHelpOrVersion(),
needsauth.NotWithoutArgs(),
Expand Down
2 changes: 1 addition & 1 deletion plugins/binance/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ func New() schema.Plugin {
Name: "binance",
Platform: schema.PlatformInfo{
Name: "Binance",
Homepage: sdk.URL("https://binance.com"),
Homepage: sdk.URL("https://binance.com"),
},
Credentials: []schema.CredentialType{
APIKey(),
Expand Down

0 comments on commit 8d69215

Please sign in to comment.