蛋蛋星球-制度模式
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 line
776 B

  1. package paypal
  2. import (
  3. "context"
  4. "encoding/base64"
  5. "os"
  6. "testing"
  7. "github.com/go-pay/gopay"
  8. "github.com/go-pay/xlog"
  9. )
  10. var (
  11. client *Client
  12. ctx = context.Background()
  13. err error
  14. Clientid = ""
  15. Secret = ""
  16. )
  17. func TestMain(m *testing.M) {
  18. client, err = NewClient(Clientid, Secret, false)
  19. if err != nil {
  20. xlog.Error(err)
  21. return
  22. }
  23. // 打开Debug开关,输出日志
  24. client.DebugSwitch = gopay.DebugOff
  25. xlog.Debugf("Appid: %s", client.Appid)
  26. xlog.Debugf("AccessToken: %s", client.AccessToken)
  27. xlog.Debugf("ExpiresIn: %d", client.ExpiresIn)
  28. os.Exit(m.Run())
  29. }
  30. func TestBasicAuth(t *testing.T) {
  31. uname := "jerry"
  32. passwd := "12346"
  33. auth := base64.StdEncoding.EncodeToString([]byte(uname + ":" + passwd))
  34. xlog.Debugf("Basic %s", auth)
  35. }