account_test.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package resource
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestResourceMidByNickname(t *testing.T) {
  8. convey.Convey("MidByNickname", t, func(ctx convey.C) {
  9. var (
  10. c = context.Background()
  11. name = "name"
  12. )
  13. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  14. mid, err := MidByNickname(c, name)
  15. ctx.Convey("Then err should be nil.mid should not be nil.", func(ctx convey.C) {
  16. ctx.So(err, convey.ShouldBeNil)
  17. ctx.So(mid, convey.ShouldNotBeNil)
  18. })
  19. })
  20. })
  21. }
  22. func TestResourceNamesByMIDs(t *testing.T) {
  23. convey.Convey("NamesByMIDs", t, func(ctx convey.C) {
  24. var (
  25. c = context.Background()
  26. mids = []int64{1, 2}
  27. )
  28. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  29. res, err := NamesByMIDs(c, mids)
  30. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  31. ctx.So(err, convey.ShouldBeNil)
  32. ctx.So(res, convey.ShouldNotBeNil)
  33. })
  34. })
  35. })
  36. }
  37. func TestResourceNameByMID(t *testing.T) {
  38. convey.Convey("NameByMID", t, func(ctx convey.C) {
  39. var (
  40. c = context.Background()
  41. mid = int64(1)
  42. )
  43. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  44. nickname, err := NameByMID(c, mid)
  45. ctx.Convey("Then err should be nil.nickname should not be nil.", func(ctx convey.C) {
  46. ctx.So(err, convey.ShouldBeNil)
  47. ctx.So(nickname, convey.ShouldNotBeNil)
  48. })
  49. })
  50. })
  51. }