auth_test.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package libcobalt
  2. import (
  3. "fmt"
  4. "testing"
  5. )
  6. func TestMain(t *testing.T) {
  7. /*account := NewAccount("")
  8. err := account.GetAuthInfo()
  9. if err != nil {
  10. fmt.Println(err.Error())
  11. return
  12. }
  13. if account.IsTwoFactorNeeded() {
  14. fmt.Println("TOTP needed")
  15. } else {
  16. fmt.Println("TOTP not needed")
  17. }*/
  18. /*account.SetCredentials("", "")
  19. err = account.Authenticate()
  20. if err != nil {
  21. fmt.Println(err.Error())
  22. return
  23. }
  24. if account.IsSecondPasswordNeeded() {
  25. fmt.Println("keypass needed")
  26. } else {
  27. fmt.Println("keypass not needed")
  28. }
  29. err = account.GetAddresses()
  30. if err != nil {
  31. fmt.Println("GetAddresses")
  32. fmt.Println(err.Error())
  33. return
  34. }
  35. message := &Message{
  36. Body: "This is a test",
  37. MimeType: "text/plain",
  38. Subject: "test",
  39. }
  40. message.AddTo(&EmailAddress{Address: ""})
  41. account.SelectAddress("")
  42. err = account.SaveDraft(message)
  43. if err != nil {
  44. fmt.Println("Error:")
  45. fmt.Println(err.Error())
  46. return
  47. }
  48. err = account.Revoke()
  49. if err != nil {
  50. fmt.Println(err.Error())
  51. return
  52. }*/
  53. /*err = account.Refresh()
  54. fmt.Println(err)*/
  55. }