Skip to content
This repository has been archived by the owner on Sep 30, 2022. It is now read-only.

Commit

Permalink
check env vars before running tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dannyvankooten committed Apr 5, 2022
1 parent 22c02ee commit f89933d
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions test_values.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,25 @@ package moneybird
import (
"net/http"
"os"
"fmt"
)

var testClient = &Client{
Token: os.Getenv("MONEYBIRD_TEST_TOKEN"),
AdministrationID: os.Getenv("MONEYBIRD_TEST_ADMINISTRATION_ID"),
HTTPClient: &http.Client{},
}
var testClient *Client

func init() {
if os.Getenv("MONEYBIRD_TEST_TOKEN") == "" {
fmt.Printf("Environment value MONEYBIRD_TEST_TOKEN not set\n")
os.Exit(1)
}

if os.Getenv("MONEYBIRD_TEST_ADMINISTRATION_ID") == "" {
fmt.Printf("Environment value MONEYBIRD_TEST_ADMINISTRATION_ID not set\n")
os.Exit(1)
}

testClient = &Client{
Token: os.Getenv("MONEYBIRD_TEST_TOKEN"),
AdministrationID: os.Getenv("MONEYBIRD_TEST_ADMINISTRATION_ID"),
HTTPClient: &http.Client{},
}
}

0 comments on commit f89933d

Please sign in to comment.