mirror of
https://github.com/Voronsky/pterogo.git
synced 2025-12-12 16:46:34 -05:00
Initial call and unit test
This commit is contained in:
25
pterogo_test.go
Normal file
25
pterogo_test.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package pterogo
|
||||
|
||||
import (
|
||||
"log"
|
||||
"log/slog"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/joho/godotenv"
|
||||
)
|
||||
|
||||
func TestListServers(t *testing.T) {
|
||||
logger := slog.New(slog.NewJSONHandler(os.Stdout, nil))
|
||||
//s, err := listServers()
|
||||
err := godotenv.Load()
|
||||
if err != nil {
|
||||
log.Fatalf(`No env file found`)
|
||||
}
|
||||
bearer_auth_token := os.Getenv("PTERO_API_KEY")
|
||||
s, err := listServers(bearer_auth_token)
|
||||
if err != nil {
|
||||
log.Fatalf(`ListServers() = %q, %v, want nil, error`, s, err)
|
||||
}
|
||||
logger.Info("Servers queried", "Servers", s)
|
||||
}
|
||||
Reference in New Issue
Block a user