user_test.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDaoGetUsernameAndRole(t *testing.T) {
  8. var (
  9. c = context.TODO()
  10. uids = []int64{1, 74, 241}
  11. )
  12. convey.Convey("GetUsernameAndRole", t, func(ctx convey.C) {
  13. list, err := d.GetUsernameAndRole(c, uids)
  14. ctx.Convey("Then err should be nil.list should not be nil.", func(ctx convey.C) {
  15. ctx.So(err, convey.ShouldBeNil)
  16. ctx.So(list, convey.ShouldNotBeNil)
  17. })
  18. })
  19. }
  20. func TestDaoGetUsernameAndDepartment(t *testing.T) {
  21. var (
  22. c = context.TODO()
  23. uids = []int64{1, 74, 241}
  24. )
  25. convey.Convey("GetUsernameAndDepartment", t, func(ctx convey.C) {
  26. list, err := d.GetUsernameAndDepartment(c, uids)
  27. ctx.Convey("Then err should be nil.list should not be nil.", func(ctx convey.C) {
  28. ctx.So(err, convey.ShouldBeNil)
  29. ctx.So(list, convey.ShouldNotBeNil)
  30. })
  31. })
  32. }
  33. func TestDaoGetUsername(t *testing.T) {
  34. var (
  35. c = context.TODO()
  36. uids = []int64{1, 74, 241}
  37. )
  38. convey.Convey("GetUsername", t, func(ctx convey.C) {
  39. list, err := d.GetUsername(c, uids)
  40. ctx.Convey("Then err should be nil.list should not be nil.", func(ctx convey.C) {
  41. ctx.So(err, convey.ShouldBeNil)
  42. ctx.So(list, convey.ShouldNotBeNil)
  43. })
  44. })
  45. }