mysql_test.go 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. package roomAdmin
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestRoomAdminGetByUserMysql(t *testing.T) {
  8. convey.Convey("GetByUserMysql", t, func(ctx convey.C) {
  9. var (
  10. c = context.Background()
  11. uid = int64(0)
  12. )
  13. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  14. admins, err := d.GetByUserMysql(c, uid)
  15. ctx.Convey("Then err should be nil.admins should not be nil.", func(ctx convey.C) {
  16. ctx.So(err, convey.ShouldBeNil)
  17. ctx.So(admins, convey.ShouldNotBeNil)
  18. })
  19. })
  20. })
  21. }
  22. func TestRoomAdminGetByRoomIdMysql(t *testing.T) {
  23. convey.Convey("GetByRoomIdMysql", t, func(ctx convey.C) {
  24. var (
  25. c = context.Background()
  26. roomId = int64(0)
  27. )
  28. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  29. admins, err := d.GetByRoomIdMysql(c, roomId)
  30. ctx.Convey("Then err should be nil.admins should not be nil.", func(ctx convey.C) {
  31. ctx.So(err, convey.ShouldBeNil)
  32. ctx.So(admins, convey.ShouldNotBeNil)
  33. })
  34. })
  35. })
  36. }
  37. func TestRoomAdminDelDbAdmin(t *testing.T) {
  38. convey.Convey("DelDbAdminMysql", t, func(ctx convey.C) {
  39. var (
  40. c = context.Background()
  41. id = int64(0)
  42. )
  43. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  44. err := d.DelDbAdminMysql(c, id)
  45. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  46. ctx.So(err, convey.ShouldBeNil)
  47. })
  48. })
  49. })
  50. }
  51. func TestRoomAdminAddAdminMysql(t *testing.T) {
  52. convey.Convey("AddAdminMysql", t, func(ctx convey.C) {
  53. var (
  54. c = context.Background()
  55. uid = int64(0)
  56. roomId = int64(0)
  57. )
  58. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  59. err := d.AddAdminMysql(c, uid, roomId)
  60. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  61. ctx.So(err, convey.ShouldBeNil)
  62. })
  63. })
  64. })
  65. }
  66. func TestRoomAdminGetByRoomIdUidDb(t *testing.T) {
  67. convey.Convey("GetByRoomIdUidMysql", t, func(ctx convey.C) {
  68. var (
  69. c = context.Background()
  70. uid = int64(0)
  71. roomId = int64(0)
  72. )
  73. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  74. resp, err := d.GetByRoomIdUidMysql(c, uid, roomId)
  75. ctx.Convey("Then err should be nil.resp should not be nil.", func(ctx convey.C) {
  76. ctx.So(err, convey.ShouldBeNil)
  77. ctx.So(resp, convey.ShouldNotBeNil)
  78. })
  79. })
  80. })
  81. }