syn_auth_test.go 985 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package service
  2. import (
  3. "testing"
  4. "go-common/app/job/main/passport-auth/model"
  5. . "github.com/smartystreets/goconvey/convey"
  6. )
  7. func Test_HandleToken(t *testing.T) {
  8. once.Do(startService)
  9. Convey("Test del cookie by cookie", t, func() {
  10. token := &tokenBMsg{
  11. Action: "insert",
  12. Table: "asp_app_perm_201701",
  13. New: &model.OldToken{
  14. Mid: 4186264,
  15. AppID: 1,
  16. AccessToken: "test token",
  17. RefreshToken: "test refresh",
  18. AppSubID: 0,
  19. CreateAt: 123456789000,
  20. },
  21. }
  22. err := s.handleToken(token)
  23. So(err, ShouldBeNil)
  24. })
  25. }
  26. func Test_HandleCookie(t *testing.T) {
  27. once.Do(startService)
  28. Convey("Test del cookie by cookie", t, func() {
  29. cookie := &cookieBMsg{
  30. Action: "insert",
  31. Table: "asp_app_perm_201701",
  32. New: &model.OldCookie{
  33. Mid: 4186264,
  34. Session: "test session",
  35. CSRFToken: "test csrf",
  36. Expires: 1234567890000,
  37. },
  38. }
  39. err := s.handleCookie(cookie)
  40. So(err, ShouldBeNil)
  41. })
  42. }