From 80ca94381b48d5766c5bcf7897a804d6e2443a69 Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Tue, 2 Jun 2026 13:13:08 -0400 Subject: credentials struct --- lulu_test.go | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) (limited to 'lulu_test.go') diff --git a/lulu_test.go b/lulu_test.go index 420033c..063d5aa 100644 --- a/lulu_test.go +++ b/lulu_test.go @@ -2,10 +2,9 @@ package lulu import ( "context" + _ "embed" "encoding/json" "flag" - "fmt" - "os" "strings" "testing" "time" @@ -14,9 +13,6 @@ import ( ) const ( - clientKeyPath = "testdata/clientkey" - clientSecretPath = "testdata/clientsecret" - interiorUrl = "https://www.dropbox.com/sh/p3zh22vzsaegiri/AACOUn3LFKsITDzylh13bQpsa/161025/thesis2.pdf?dl=1" coverUrl = "https://www.dropbox.com/sh/p3zh22vzsaegiri/AADP367j0bTWlt8fCu-_tm2ia/161025/139056_cover.pdf?dl=1" @@ -24,35 +20,26 @@ const ( ) var ( - clientKey string + //go:embed testdata/clientkey + clientKey string + //go:embed testdata/clientsecret clientSecret string ) func TestMain(m *testing.M) { flag.BoolVar(&Debug, "d", false, "Print debug info to stderr.") flag.Parse() - Sandbox() - - if b, err := os.ReadFile(clientKeyPath); err == nil { - clientKey = strings.TrimSpace(string(b)) - } else { - fmt.Fprintf(os.Stderr, "%v\nCopy and paste your \"client key\" from the API Keys page into %s\n%s\n", err, clientKeyPath, SandboxApiKeyPage) - os.Exit(1) - } - if b, err := os.ReadFile(clientSecretPath); err == nil { - clientSecret = strings.TrimSpace(string(b)) - } else { - fmt.Fprintf(os.Stderr, "%v\nCopy and paste your \"client secret\" from the API Keys page into %s\n%s\n", err, clientSecretPath, SandboxApiKeyPage) - os.Exit(1) - } - m.Run() } func newClient(t *testing.T) *Client { t.Helper() - c, err := NewClient(t.Context(), clientKey, clientSecret) + creds := Credentials{ + Key: strings.TrimSpace(clientKey), + Secret: strings.TrimSpace(clientSecret), + } + c, err := NewClient(t.Context(), creds) require.NoError(t, err) return c } -- cgit v1.2.3