clean_cache_test.go 677 B

1234567891011121314151617181920212223242526
  1. package service
  2. import (
  3. "encoding/base64"
  4. "encoding/hex"
  5. "testing"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestServiceBase64Decode(t *testing.T) {
  9. convey.Convey("", t, func() {
  10. bytes, err := base64.StdEncoding.DecodeString("igIDgs/yFxaFI+oiu2HoDw==")
  11. convey.So(bytes, convey.ShouldNotBeEmpty)
  12. convey.So(err, convey.ShouldBeNil)
  13. convey.So(hex.EncodeToString(bytes), convey.ShouldEqual, "8a020382cff217168523ea22bb61e80f")
  14. })
  15. }
  16. func TestService_cleanTokenCache(t *testing.T) {
  17. once.Do(startService)
  18. convey.Convey("cleanTokenCache", t, func() {
  19. err := s.cleanTokenCache("igIDgs/yFxaFI+oiu2HoDw==", 0)
  20. convey.So(err, convey.ShouldNotBeNil)
  21. })
  22. }