package spooldb import ( "context" "os" "testing" "time" ) // TestSpoolLocation is a live integration test against 3dfilamentprofiles.com. // It is skipped unless SPOOLDB_USER and SPOOLDB_PASS are set. The spool to look // up defaults to the sample spool but can be overridden with SPOOL_ID. func TestSpoolLocation(t *testing.T) { email, pass := os.Getenv("SPOOLDB_USER"), os.Getenv("SPOOLDB_PASS") if email == "" || pass == "" { t.Skip("set SPOOLDB_USER and SPOOLDB_PASS to run the live integration test") } spoolID := os.Getenv("SPOOL_ID") if spoolID == "" { spoolID = "fU9zkaRWB" } c, err := New() if err != nil { t.Fatalf("new client: %v", err) } defer c.Close() ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute) defer cancel() if err := c.Login(ctx, email, pass); err != nil { t.Fatalf("login: %v", err) } info, err := c.SpoolInfo(ctx, spoolID) if err != nil { t.Fatalf("spool info: %v", err) } t.Logf("spool %s: location=%q total=%.0fg remaining=%.0fg emptySpool=%.0fg", spoolID, info.Location, info.TotalGrams, info.RemainingGrams, info.EmptySpoolGrams) }