sign_test.go 850 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package shell
  2. import (
  3. "testing"
  4. "github.com/smartystreets/goconvey/convey"
  5. )
  6. func TestDaoSign(t *testing.T) {
  7. convey.Convey("Sign", t, func(ctx convey.C) {
  8. var (
  9. v struct {
  10. Name string
  11. }
  12. token = "abc"
  13. )
  14. v.Name = "aaa"
  15. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  16. _, err := Sign(v, token)
  17. ctx.Convey("Then err should be nil.id should not be nil.", func(ctx convey.C) {
  18. ctx.So(err, convey.ShouldBeNil)
  19. })
  20. })
  21. })
  22. }
  23. func TestDaoEncode(t *testing.T) {
  24. convey.Convey("Encode", t, func(ctx convey.C) {
  25. var (
  26. v struct {
  27. Name string
  28. }
  29. )
  30. v.Name = "aaa"
  31. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  32. _, err := Encode(v)
  33. ctx.Convey("Then err should be nil.id should not be nil.", func(ctx convey.C) {
  34. ctx.So(err, convey.ShouldBeNil)
  35. })
  36. })
  37. })
  38. }