encoding_test.go 516 B

12345678910111213141516171819202122232425262728
  1. package encoding
  2. import (
  3. "testing"
  4. "github.com/smartystreets/goconvey/convey"
  5. )
  6. var c = &EncryptConfig{Key: "bilibili_key_GYl", IV: "biliBiliIv123456"}
  7. const (
  8. plat = "13291831554"
  9. enc = "dWLVOucFkBBmmXmTm6so5A=="
  10. )
  11. func TestEncrypt(t *testing.T) {
  12. convey.Convey("Encrypt", t, func() {
  13. s, _ := Encrypt(plat, c)
  14. convey.So(s, convey.ShouldEqual, enc)
  15. })
  16. }
  17. func TestDecrypt(t *testing.T) {
  18. convey.Convey("Decrypt", t, func() {
  19. s, _ := Decrypt(enc, c)
  20. convey.So(s, convey.ShouldEqual, plat)
  21. })
  22. }