Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add example tests #151

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

CheatCod
Copy link

This PR duplicate the existing examples folder that we frequently use as tests, and modify it so that they fetch the test secret reference and vault id from env vars, making testing wtih the examples much, much easier.

itemParams := onepassword.ItemCreateParams{
Title: "Login created with the SDK",
Category: onepassword.ItemCategoryLogin,
VaultID: vaultID,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't this directly be here?

Suggested change
VaultID: vaultID,
VaultID: os.Getenv("CORE_SDK_TEST_VAULT_ID"),

// [developer-docs.sdk.go.resolve-secret]-start
// Retrieves a secret from 1Password.
// Takes a secret reference as input and returns the secret to which it points.
secret, err := client.Secrets.Resolve(context.Background(), secretRef)
Copy link
Contributor

@MOmarMiraj MOmarMiraj Nov 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove L109 and.

Suggested change
secret, err := client.Secrets.Resolve(context.Background(), secretRef)
secret, err := client.Secrets.Resolve(context.Background(), os.GetEnv("CORE_SDK_TEST_SECRET_REF")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants