mysql_bugly_cookie_test.go 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package dao
  2. import (
  3. "testing"
  4. "go-common/app/admin/ep/marthe/model"
  5. . "github.com/smartystreets/goconvey/convey"
  6. )
  7. var (
  8. buglyCookie = &model.BuglyCookie{
  9. QQAccount: 246802468,
  10. Cookie: "eas_sid=6105G3k2D0Q428f5u0c6B527B0; pgv_pvi=95820800; RK=kfyEYkBgS6; btcu_id=c64abeb0e4f6485712c0bb79bf16c19d5b6aa5326be74; vc=vc-01c6b914-d8f9-4449-adcb-abba3ebe137c; vc.sig=b8t0PNSdSX1m4wOr-B12whzwaf75BlJjOjz5Jy7YTkE; _ga=GA1.2.1955813367.1533715741; pgv_si=s229603328; _qpsvr_localtk=0.0198901072762101; o_cookie=972360526; pac_uid=1_972360526; csrfToken=gekJ-F5QdGgVTZqLC0NiBEOA; ptui_loginuin=1211712225; ptisp=ctc; ptcz=f45f877d04ce6b659e432a158d35cbc9dea2c565d17eb6ee23640a0c7f82aaf9; uin=o1211712225; skey=@FGItvXrQ6; pt2gguin=o1211712225; IED_LOG_INFO2=userUin%3D1211712225%26nickName%3D%2525E5%2525B0%25258F%2525E7%2525BE%25258E+%26userLoginTime%3D1545802497; midas_openid=1211712225; midas_openkey=@FGItvXrQ6; pgv_info=ssid=s2529006206&pgvReferrer=; pgv_pvid=7939868100; NODINX_SESS=7XIt-RXcFpUaAwKwVFHFbIsssGiryDAw_dF_oP1uVFP2V5vV95jh92eADSSJIq0v; token-skey=771060e7-cd54-f0b3-960c-c8fe485fde10; token-lifeTime=1545828885; bugly_session=eyJpdiI6IldLOHM2V2lhNXFyemdMV1d6YXQ0SHc9PSIsInZhbHVlIjoiekt5UllBZWU4OEltSDVzTzJOeHRESjdQMWY5Y1wveEpYbUlDNmxrV25XTHR3ME5RMkRUdk9VaGlKbGFrQ0cxc2xoUzBOVXdCM0hzVWZIemlFR1BLZXJnPT0iLCJtYWMiOiJhZTI5ZmVjNmVjNzZjMWI2MTMyM2U4NWE5MGZiNWMxMjQzZmEzMWEyMGZhMTcxZjg1N2FiOTY4OTgxNWZjMDExIn0%3D; referrer=eyJpdiI6Im9FZ00yMHdsS2hIeHp3UERSaFVhWlE9PSIsInZhbHVlIjoiZXN6dmZFWmJ4V3R6UmordnowVXZkMXdhbm8zN3QrNzVcL2NSc1I0eWw1ZUVYbVFvTnlwdDB2QWVoaXp4VmZxY2tFV2VSdDIrWG40bEpqb3hvWTZmaVAwXC9vR1JqNEE5NG1MQnlkR1dvV1dkWitSakV6RjV1dWF4dEtzbGpXRFhsNW10SEhrSDVrZk1tRE9EXC9zUEVBRGxwSzhoTHRzSHhuTktFV1g1ckpOTEo0PSIsIm1hYyI6IjAzZWJiMjQ0YjkyNmUyYTk2MDRmNTdjYjY2OWYwNzIzZjZjMmNiMzU0NWRhZmExZWFhYWUzMGFiMTI2MDI4NzIifQ%3D%3F",
  11. Token: "1768129694",
  12. UsageCount: 0,
  13. Status: model.BuglyCookieStatusEnable,
  14. }
  15. queryBuglyCookiesRequest = &model.QueryBuglyCookiesRequest{
  16. Pagination: model.Pagination{
  17. PageSize: 10,
  18. PageNum: 1,
  19. },
  20. QQAccount: buglyCookie.QQAccount,
  21. }
  22. )
  23. func Test_Bugly_cookie(t *testing.T) {
  24. Convey("test insert bugly cookie", t, func() {
  25. err := d.InsertCookie(buglyCookie)
  26. So(err, ShouldBeNil)
  27. })
  28. Convey("test Update Cookie Status", t, func() {
  29. err := d.UpdateCookieStatus(buglyCookie.ID, model.BuglyCookieStatusDisable)
  30. So(err, ShouldBeNil)
  31. })
  32. Convey("test Update Cookie Usage Count", t, func() {
  33. err := d.UpdateCookieUsageCount(buglyCookie.ID, 5)
  34. So(err, ShouldBeNil)
  35. })
  36. Convey("test Find Cookies", t, func() {
  37. total, buglyCookies, err := d.FindCookies(queryBuglyCookiesRequest)
  38. So(err, ShouldBeNil)
  39. So(total, ShouldBeGreaterThan, 0)
  40. So(len(buglyCookies), ShouldBeGreaterThan, 0)
  41. })
  42. }