update
This commit is contained in:
parent
63460dc78d
commit
5eb0e931b2
20
go.mod
20
go.mod
@ -4,27 +4,38 @@ go 1.21.4
|
||||
|
||||
require (
|
||||
github.com/gofiber/fiber/v2 v2.52.0
|
||||
github.com/golang-jwt/jwt/v5 v5.2.0
|
||||
github.com/joho/godotenv v1.5.1
|
||||
github.com/lib/pq v1.10.9
|
||||
github.com/pioz/faker v1.7.3
|
||||
github.com/skeris/appInit v1.0.2
|
||||
github.com/stretchr/testify v1.8.4
|
||||
github.com/tealeg/xlsx v1.0.5
|
||||
github.com/themakers/bdd v0.0.0-20210316111417-6b1dfe326f33
|
||||
github.com/themakers/hlog v0.0.0-20191205140925-235e0e4baddf
|
||||
go.uber.org/zap v1.26.0
|
||||
penahub.gitlab.yandexcloud.net/backend/penahub_common v0.0.0-20240202120244-c4ef330cfe5d
|
||||
penahub.gitlab.yandexcloud.net/backend/quiz/common.git v0.0.0-20240313164312-4560248259a0
|
||||
penahub.gitlab.yandexcloud.net/backend/quiz/worker.git v0.0.0-20240313171802-7da5fbb4caf3
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/andybalholm/brotli v1.0.5 // indirect
|
||||
github.com/golang-jwt/jwt/v5 v5.2.0 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||
github.com/fatih/color v1.10.0 // indirect
|
||||
github.com/go-redis/redis/v8 v8.11.5 // indirect
|
||||
github.com/golang-migrate/migrate/v4 v4.17.0 // indirect
|
||||
github.com/golang/protobuf v1.5.3 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/klauspost/compress v1.17.0 // indirect
|
||||
github.com/klauspost/compress v1.17.4 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.15 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/rivo/uniseg v0.2.0 // indirect
|
||||
github.com/rs/xid v1.5.0 // indirect
|
||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||
@ -32,6 +43,11 @@ require (
|
||||
github.com/valyala/tcplisten v1.0.0 // indirect
|
||||
go.uber.org/atomic v1.7.0 // indirect
|
||||
go.uber.org/multierr v1.10.0 // indirect
|
||||
golang.org/x/net v0.18.0 // indirect
|
||||
golang.org/x/sys v0.15.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 // indirect
|
||||
google.golang.org/grpc v1.61.1 // indirect
|
||||
google.golang.org/protobuf v1.32.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
50
go.sum
50
go.sum
@ -5,9 +5,13 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc
|
||||
github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
|
||||
github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs=
|
||||
github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
|
||||
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
|
||||
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
|
||||
github.com/dhui/dktest v0.4.0 h1:z05UmuXZHO/bgj/ds2bGMBu8FI4WA+Ag/m3ghL+om7M=
|
||||
github.com/dhui/dktest v0.4.0/go.mod h1:v/Dbz1LgCBOi2Uki2nUqLBGa83hWBGFMu5MrgMDCc78=
|
||||
github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8=
|
||||
@ -18,6 +22,12 @@ github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKoh
|
||||
github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
|
||||
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
|
||||
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
|
||||
github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg=
|
||||
github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
|
||||
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
|
||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
||||
github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI=
|
||||
github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo=
|
||||
github.com/gofiber/fiber/v2 v2.52.0 h1:S+qXi7y+/Pgvqq4DrSmREGiFwtB7Bu6+QFLuIHYw/UE=
|
||||
github.com/gofiber/fiber/v2 v2.52.0/go.mod h1:KEOE+cXMhXG0zHc9d8+E38hoX+ZN7bhOtgeF2oT6jrQ=
|
||||
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
|
||||
@ -29,8 +39,9 @@ github.com/golang-migrate/migrate/v4 v4.17.0/go.mod h1:+Cp2mtLP4/aXDTKb9wmXYitdr
|
||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
|
||||
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
@ -39,9 +50,11 @@ github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY
|
||||
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
|
||||
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
|
||||
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
|
||||
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/klauspost/compress v1.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM=
|
||||
github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
|
||||
github.com/klauspost/compress v1.17.4 h1:Ej5ixsIri7BrIjBkRZLTo6ghwrEtHFk7ijlczPW4fZ4=
|
||||
github.com/klauspost/compress v1.17.4/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM=
|
||||
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
@ -50,8 +63,10 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
|
||||
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
||||
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
||||
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
@ -61,10 +76,18 @@ github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0=
|
||||
github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y=
|
||||
github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A=
|
||||
github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc=
|
||||
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
|
||||
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
|
||||
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
|
||||
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
|
||||
github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE=
|
||||
github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs=
|
||||
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
|
||||
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
|
||||
github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM=
|
||||
github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
|
||||
github.com/pioz/faker v1.7.3 h1:Tez8Emuq0UN+/d6mo3a9m/9ZZ/zdfJk0c5RtRatrceM=
|
||||
github.com/pioz/faker v1.7.3/go.mod h1:xSpay5w/oz1a6+ww0M3vfpe40pSIykeUPeWEc3TvVlc=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
@ -80,10 +103,13 @@ github.com/skeris/appInit v1.0.2/go.mod h1:4ElEeXWVGzU3dlYq/eMWJ/U5hd+LKisc1z3+y
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/tealeg/xlsx v1.0.5 h1:+f8oFmvY8Gw1iUXzPk+kz+4GpbDZPK1FhPiQRd+ypgE=
|
||||
github.com/tealeg/xlsx v1.0.5/go.mod h1:btRS8dz54TDnvKNosuAqxrM1QgN1udgk9O34bDCnORM=
|
||||
github.com/themakers/bdd v0.0.0-20210316111417-6b1dfe326f33 h1:N9f/Q+2Ssa+yDcbfaoLTYvXmdeyUUxsJKdPUVsjSmiA=
|
||||
github.com/themakers/bdd v0.0.0-20210316111417-6b1dfe326f33/go.mod h1:rpcH99JknBh8seZmlOlUg51gasZH6QH34oXNsIwYT6E=
|
||||
github.com/themakers/hlog v0.0.0-20191205140925-235e0e4baddf h1:TJJm6KcBssmbWzplF5lzixXl1RBAi/ViPs1GaSOkhwo=
|
||||
github.com/themakers/hlog v0.0.0-20191205140925-235e0e4baddf/go.mod h1:1FsorU3vnXO9xS9SrhUp8fRb/6H/Zfll0rPt1i4GWaA=
|
||||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||
@ -118,11 +144,16 @@ golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
|
||||
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
@ -131,8 +162,10 @@ golang.org/x/tools v0.10.0 h1:tvDr/iQoUqNdohiYm0LmmKcBk+q86lb9EprIUFhHHGg=
|
||||
golang.org/x/tools v0.10.0/go.mod h1:UJwyiVBsOA2uwvK/e5OY3GTpDUJriEd+/YlqAwLPmyM=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk=
|
||||
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 h1:Jyp0Hsi0bmHXG6k9eATXoYtjd6e2UzZ1SCn/wIupY14=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:oQ5rr10WTTMvP4A36n8JpR1OrO1BEiV4f78CneXZxkA=
|
||||
google.golang.org/grpc v1.61.1 h1:kLAiWrZs7YeDM6MumDe7m3y4aM6wacLzM1Y/wiLP9XY=
|
||||
google.golang.org/grpc v1.61.1/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I=
|
||||
@ -142,7 +175,12 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
@ -150,3 +188,5 @@ penahub.gitlab.yandexcloud.net/backend/penahub_common v0.0.0-20240202120244-c4ef
|
||||
penahub.gitlab.yandexcloud.net/backend/penahub_common v0.0.0-20240202120244-c4ef330cfe5d/go.mod h1:lTmpjry+8evVkXWbEC+WMOELcFkRD1lFMc7J09mOndM=
|
||||
penahub.gitlab.yandexcloud.net/backend/quiz/common.git v0.0.0-20240313164312-4560248259a0 h1:YbffFOWneoINvEqCWClf5Zatu/a0VNo9RM0nYveCzhk=
|
||||
penahub.gitlab.yandexcloud.net/backend/quiz/common.git v0.0.0-20240313164312-4560248259a0/go.mod h1:JgbH8cdAJBr3jx3BuY5nnuTyMdZ1XkRxo8a3w4Y3C0Y=
|
||||
penahub.gitlab.yandexcloud.net/backend/quiz/worker.git v0.0.0-20240313171802-7da5fbb4caf3 h1:BLHIUnJAttW9OAW7A63H9ON/HPhXdpBa/YPUQWD4ORA=
|
||||
penahub.gitlab.yandexcloud.net/backend/quiz/worker.git v0.0.0-20240313171802-7da5fbb4caf3/go.mod h1:/BFcX4F10DRuFuAHlwkKO+1QAXPL4i49x1tsrTwxlqE=
|
||||
|
6
tests/Dockerfile
Normal file
6
tests/Dockerfile
Normal file
@ -0,0 +1,6 @@
|
||||
FROM golang:alpine
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
RUN ls
|
||||
RUN apk add --no-cache git && go mod download
|
||||
CMD ["go", "test", "./tests"]
|
10
tests/chunk.css
Normal file
10
tests/chunk.css
Normal file
@ -0,0 +1,10 @@
|
||||
@font-face{font-family:"Gilroy-UltraLight";src:url(/static/media/gilroy-ultralight.e7028e6c.eot);src:url(/static/media/gilroy-ultralight.e7028e6c.eot?#iefix) format("embedded-opentype"),url(/static/media/gilroy-ultralight.af5f82c8.woff2) format("woff2"),url(/static/media/gilroy-ultralight.d23a0edf.woff) format("woff"),url(/static/media/gilroy-ultralight.68e17ccd.ttf) format("truetype"),url(/static/media/gilroy-ultralight.b06ae671.svg#gilroy-ultralight) format("svg")}@font-face{font-family:"Gilroy-Bold";src:url(/static/media/gilroy-bold.a732fed1.eot);src:url(/static/media/gilroy-bold.a732fed1.eot?#iefix) format("embedded-opentype"),url(/static/media/gilroy-bold.0ad1eb91.woff2) format("woff2"),url(/static/media/gilroy-bold.5fb38b9f.woff) format("woff"),url(/static/media/gilroy-bold.b900325e.ttf) format("truetype"),url(/static/media/gilroy-bold.dc2b9be1.svg#gilroy-bold) format("svg")}@font-face{font-family:"Gilroy-Regular";src:url(/static/media/gilroy-regular.1d051d9d.eot);src:url(/static/media/gilroy-regular.1d051d9d.eot?#iefix) format("embedded-opentype"),url(/static/media/gilroy-regular.00b02679.woff2) format("woff2"),url(/static/media/gilroy-regular.31d54a4b.woff) format("woff"),url(/static/media/gilroy-regular.b91b0127.ttf) format("truetype"),url(/static/media/gilroy-regular.752586d2.svg#gilroy-regular) format("svg")}@font-face{font-family:"/gilroyRegular/gilroy-regular";src:url(/static/media/gilroy-regular.1d051d9d.eot);src:url(/static/media/gilroy-regular.1d051d9d.eot?#iefix) format("embedded-opentype"),url(/static/media/gilroy-regular.00b02679.woff2) format("woff2"),url(/static/media/gilroy-regular.31d54a4b.woff) format("woff"),url(/static/media/gilroy-regular.b91b0127.ttf) format("truetype"),url(/static/media/gilroy-regular.752586d2.svg#gilroy-regular) format("svg")}:root{--grayL:#2f3339;--grayM:#1d2025;--grayD:#101217;--chartButton:#22252b;--green:#74b13e;--gold:#f7c873}body{margin:0;overflow-x:hidden;z-index:1;background-color:#101217;background-color:var(--grayD)}body *{color:#fff}a{cursor:pointer;text-decoration:none}.goldText{color:#f7c873!important;color:var(--gold)!important}path{color:inherit}.inline{display:-webkit-inline-flex;display:inline-flex}.errorComponent{height:100%;width:100%;display:-webkit-flex;display:flex;-webkit-justify-content:center;justify-content:center;-webkit-align-items:center;align-items:center}.componentSigninEnterButton{background-color:var(--grayL)}
|
||||
|
||||
/*!*material*!*/.positionInLogoName{display:-webkit-inline-flex;display:inline-flex;-webkit-flex-direction:row;flex-direction:row;-webkit-align-items:center;align-items:center;text-decoration:none;outline:none}.logoNameSVG{width:28px;height:30px;margin-right:17px}.logoNameBlack{font-family:"Gilroy-Bold"}.logoNameBlack,.logoNameBroker{text-transform:uppercase;font-size:14px;font-weight:600}.logoNameBroker{font-family:"Gilroy-UltraLight"}.MuiTypography-colorPrimary{color:#fff!important}.grayTextFieldsPositions{height:77px}.grayFieldBlockPasswords{display:-webkit-flex;display:flex;margin-top:5px}.signinEnvelope{margin-right:11px}
|
||||
|
||||
/*!*material*!*/.grayTextFieldsPositions{height:115px}.signinCastle{margin-right:16px}
|
||||
|
||||
/*!*material*!*/.componentSigninFormWelcomeTexts{margin-top:24px}.componentSigninFormWelcome{margin:0;font-size:21px;font-family:"/gilroyRegular/gilroy-regular"}.componentSigninFormWeHappy{margin-top:6px;font-size:11px;font-weight:800;font-family:"/gilroyRegular/gilroy-regular"}.grayTextFieldsPositions{height:90px;width:209px;margin-top:28px;display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:end;align-items:end;-webkit-justify-content:space-between;justify-content:space-between}.grayFieldBlock{display:-webkit-inline-flex;display:inline-flex}.iconGrayTextField{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center}.iconGrayTextField>img{width:20px}.signinEnvelope{height:15px;margin-right:13px}.signinCastle{height:20px;margin-right:13px}.componentSigninFormCheckbox{margin:23px 0 0 -10px;display:-webkit-inline-flex;display:inline-flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:space-between;justify-content:space-between}.componentSigninFormCheckboxRemember,.componentSigninFormForget{font-size:11px;font-weight:800;font-family:"/gilroyRegular/gilroy-regular"}.componentSigninFormForget{margin:1px 0 0;color:var(--gold)}.componentSigninEnterButton{height:52px;width:209px;margin-top:35px}.componentSigninNoAcc{display:-webkit-inline-flex;display:inline-flex;-webkit-align-items:center;align-items:center;margin-top:22px}.componentSigninNoAcc a,.componentSigninNoAcc p{font-size:11px;font-weight:800;font-family:"/gilroyRegular/gilroy-regular"}.componentSigninNoAcc a,.iHaveAccount{color:var(--gold);border-bottom:1px solid var(--gold)}.iHaveAccount{font-size:12px;font-family:"/gilroyRegular/gilroy-regular"}
|
||||
|
||||
/*!*material*!*/.adminAuthPagePosition{height:100vh;width:100vw;display:-webkit-flex;display:flex;-webkit-justify-content:center;justify-content:center;-webkit-align-items:center;align-items:center;-webkit-flex-direction:column;flex-direction:column}.preloaderPosition{margin:auto}.dashboardSidebarButton{height:30px;width:20px;margin-left:5px}.dashboardSidebarButton1{height:40px;width:30px}.dashboardSidebarButton2{margin-left:4px;height:20px}
|
||||
/*# sourceMappingURL=main.c8146c09.chunk.css.map */
|
3
tests/chunk.js
Normal file
3
tests/chunk.js
Normal file
File diff suppressed because one or more lines are too long
665
tests/db_test.go
Normal file
665
tests/db_test.go
Normal file
@ -0,0 +1,665 @@
|
||||
package tests
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/pioz/faker"
|
||||
"math"
|
||||
"math/rand"
|
||||
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/dal"
|
||||
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/model"
|
||||
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/repository/quiz"
|
||||
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/repository/result"
|
||||
"penahub.gitlab.yandexcloud.net/backend/quiz/core.git/clients/auth"
|
||||
|
||||
//"database/sql"
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
bdd "github.com/themakers/bdd"
|
||||
)
|
||||
|
||||
const baseURL = "http://localhost:"
|
||||
const authClientUrl = "test.com"
|
||||
const postgresCred string = "host=localhost port=35432 user=squiz password=Redalert2 dbname=squiz sslmode=disable"
|
||||
const appPort = "1488"
|
||||
const storerPort = "1489"
|
||||
const answererPort = "1490"
|
||||
const healthChecksPort = "5489"
|
||||
|
||||
var types4testing = []string{
|
||||
model.TypeVariant,
|
||||
model.TypeImages,
|
||||
model.TypeVarImages,
|
||||
model.TypeFile,
|
||||
model.TypeText,
|
||||
model.TypeEmoji,
|
||||
model.TypeSelect,
|
||||
model.TypeDate,
|
||||
model.TypeNumber,
|
||||
model.TypePage,
|
||||
model.TypeRating,
|
||||
}
|
||||
|
||||
func TestDAL(t *testing.T) {
|
||||
//login := "D" + strconv.FormatInt(time.Now().Unix(), 10)
|
||||
//token := registerUser(login)
|
||||
//
|
||||
//m, ok := token.Claims.(jwt.MapClaims)
|
||||
//if !ok {
|
||||
// panic("malformed JWT")
|
||||
//}
|
||||
//
|
||||
//id, ok := m["id"].(string)
|
||||
//if !ok || id == "" {
|
||||
// panic("missing id claim in JWT")
|
||||
//}
|
||||
|
||||
id := "123"
|
||||
|
||||
ctx := context.Background()
|
||||
authClient := auth.NewAuthClient(authClientUrl)
|
||||
fmt.Println(id)
|
||||
|
||||
bdd.Scenario(t, "DAL testing", func(t *testing.T, runID string) {
|
||||
var (
|
||||
err error
|
||||
d *dal.DAL
|
||||
records []model.Quiz
|
||||
questions []model.Question
|
||||
answersSession string
|
||||
)
|
||||
bdd.Act(t, "Postgres Tables Creating", func() {
|
||||
|
||||
bdd.Test(t, "test dbconnect", func() {
|
||||
d, err = dal.New(ctx, postgresCred, authClient)
|
||||
assert.NoError(t, err, nil)
|
||||
assert.NotNil(t, d, nil)
|
||||
})
|
||||
|
||||
//bdd.Test(t, "positive test of table creating", func() {
|
||||
// err = d.Init()
|
||||
// assert.NoError(t, err, nil)
|
||||
//})
|
||||
//
|
||||
//bdd.Test(t, "negative test of table creating", func() {
|
||||
// err = d.Init()
|
||||
// assert.NoError(t, err, nil)
|
||||
//})
|
||||
})
|
||||
|
||||
bdd.Act(t, "create quiz testing", func() {
|
||||
record := model.Quiz{
|
||||
AccountId: id,
|
||||
Fingerprinting: true,
|
||||
Repeatable: true,
|
||||
NotePrevented: true,
|
||||
MailNotifications: true,
|
||||
UniqueAnswers: true,
|
||||
Name: "test",
|
||||
Description: "test",
|
||||
Config: `{"Mailing": {"When": "test","Theme": "Quiz test","Reply": "test","ReplName": "test"}}`,
|
||||
Status: model.StatusDraft,
|
||||
Limit: 100,
|
||||
DueTo: uint64(time.Now().Add(time.Hour).Unix()),
|
||||
TimeOfPassing: 60,
|
||||
Pausable: true,
|
||||
GroupId: 2,
|
||||
}
|
||||
statuses4creating := []string{
|
||||
model.StatusDraft,
|
||||
model.StatusStart,
|
||||
model.StatusStop,
|
||||
model.StatusOffLimit,
|
||||
model.StatusTimeout,
|
||||
model.StatusTemplate,
|
||||
}
|
||||
|
||||
for i := 0; i < 100; i++ {
|
||||
|
||||
record2 := model.Quiz{
|
||||
AccountId: id,
|
||||
Fingerprinting: true,
|
||||
Repeatable: true,
|
||||
NotePrevented: true,
|
||||
MailNotifications: true,
|
||||
UniqueAnswers: true,
|
||||
Name: record.Name + fmt.Sprint(i),
|
||||
Description: "test",
|
||||
Config: `{"Mailing": {"When": "test","Theme": "Quiz test","Reply": "test","ReplName": "test"}}`,
|
||||
Status: statuses4creating[rand.Intn(len(statuses4creating))],
|
||||
Limit: 100,
|
||||
DueTo: uint64(time.Now().Add(time.Hour).Unix()),
|
||||
ParentIds: []int32{},
|
||||
TimeOfPassing: 60,
|
||||
Pausable: true,
|
||||
GroupId: 1,
|
||||
}
|
||||
|
||||
bdd.Test(t, "positive quiz storing", func() {
|
||||
err := d.QuizRepo.CreateQuiz(ctx, &record2)
|
||||
assert.NoError(t, err, nil)
|
||||
assert.NotZero(t, record2.Id, nil)
|
||||
assert.NotEqual(t, record2.CreatedAt, nil)
|
||||
assert.NotEqual(t, record2.UpdatedAt, nil)
|
||||
records = append(records, record2)
|
||||
})
|
||||
}
|
||||
|
||||
for i := 0; i < len(records)-1; i++ {
|
||||
if records[i].Status == model.StatusStart {
|
||||
|
||||
bdd.Test(t, "get quiz by qid", func() {
|
||||
qu, err := d.QuizRepo.GetQuizByQid(ctx, records[i].Qid)
|
||||
assert.Equal(t, records[i].Id, qu.Id)
|
||||
assert.NoError(t, err, nil)
|
||||
})
|
||||
}
|
||||
|
||||
bdd.Test(t, "get quiz by id", func() {
|
||||
qu, err := d.QuizRepo.GetQuizById(ctx, id, records[i].Id)
|
||||
assert.Equal(t, records[i].Id, qu.Id)
|
||||
assert.Equal(t, records[i].Qid, qu.Qid)
|
||||
assert.NoError(t, err, nil)
|
||||
})
|
||||
|
||||
bdd.Test(t, "get quiz config", func() {
|
||||
_, _, err := d.QuizRepo.GetQuizConfig(ctx, records[i].Id)
|
||||
assert.NoError(t, err, nil)
|
||||
})
|
||||
}
|
||||
|
||||
for i := 0; i < len(records)%80; i++ {
|
||||
bdd.Test(t, "update quiz", func() {
|
||||
updquiz := model.Quiz{
|
||||
Id: records[i].Id,
|
||||
Qid: records[i].Qid,
|
||||
AccountId: id,
|
||||
Deleted: records[i].Deleted,
|
||||
Archived: records[i].Archived,
|
||||
Fingerprinting: records[i].Fingerprinting,
|
||||
Repeatable: records[i].Repeatable,
|
||||
NotePrevented: records[i].NotePrevented,
|
||||
MailNotifications: records[i].MailNotifications,
|
||||
UniqueAnswers: records[i].UniqueAnswers,
|
||||
Name: faker.String() + records[i].Name,
|
||||
Description: faker.String() + records[i].Description,
|
||||
Config: faker.String() + records[i].Config,
|
||||
Status: records[i].Status,
|
||||
Limit: records[i].Limit,
|
||||
DueTo: records[i].DueTo,
|
||||
TimeOfPassing: records[i].TimeOfPassing,
|
||||
Pausable: records[i].Pausable,
|
||||
Version: records[i].Version,
|
||||
VersionComment: records[i].VersionComment,
|
||||
ParentIds: records[i].ParentIds,
|
||||
CreatedAt: records[i].CreatedAt,
|
||||
UpdatedAt: records[i].UpdatedAt,
|
||||
QuestionsCount: records[i].QuestionsCount,
|
||||
SessionCount: records[i].SessionCount,
|
||||
PassedCount: records[i].PassedCount,
|
||||
AverageTime: records[i].AverageTime,
|
||||
Super: records[i].Super,
|
||||
GroupId: records[i].GroupId,
|
||||
}
|
||||
err := d.QuizRepo.UpdateQuiz(ctx, id, updquiz)
|
||||
assert.NoError(t, err, nil)
|
||||
})
|
||||
bdd.Test(t, "move to history quiz", func() {
|
||||
qu, err := d.QuizRepo.MoveToHistoryQuiz(ctx, records[i].Id, id)
|
||||
assert.Equal(t, records[i].Id+100, qu.Id)
|
||||
assert.NoError(t, err, nil)
|
||||
})
|
||||
}
|
||||
|
||||
bdd.Test(t, "negative test quiz storing1", func() {
|
||||
record.Name = faker.StringWithSize(300)
|
||||
err := d.QuizRepo.CreateQuiz(ctx, &record)
|
||||
assert.Error(t, err, nil)
|
||||
})
|
||||
|
||||
bdd.Test(t, "negative test quiz storing2", func() {
|
||||
record.Status = model.StatusTemplate
|
||||
err := d.QuizRepo.CreateQuiz(ctx, &record)
|
||||
assert.Error(t, err, nil)
|
||||
})
|
||||
})
|
||||
|
||||
bdd.Act(t, "get list of quizes", func() {
|
||||
bdd.Test(t, "get list of quizes", func() {
|
||||
res, _, err := d.QuizRepo.GetQuizList(ctx, quiz.GetQuizListDeps{
|
||||
Limit: 10,
|
||||
Offset: 0,
|
||||
From: 0,
|
||||
To: 0,
|
||||
Group: 0,
|
||||
Deleted: false,
|
||||
Archived: false,
|
||||
Super: true,
|
||||
Search: "",
|
||||
Status: "",
|
||||
AccountId: id,
|
||||
})
|
||||
assert.NoError(t, err, nil)
|
||||
assert.Equal(t, 0, len(res), nil)
|
||||
//assert.Greater(t, cnt, uint64(0), nil)
|
||||
})
|
||||
})
|
||||
|
||||
bdd.Act(t, "create question testing", func() {
|
||||
quix4filling := records[rand.Intn(len(records))]
|
||||
for _, questionType := range types4testing {
|
||||
bdd.Test(t, fmt.Sprintf("positive question creating: %s", questionType), func() {
|
||||
question := model.Question{
|
||||
Id: 0,
|
||||
QuizId: quix4filling.Id,
|
||||
Title: "testNone",
|
||||
Description: "sample text",
|
||||
Type: questionType,
|
||||
Required: true,
|
||||
Deleted: false,
|
||||
Page: 0,
|
||||
Content: "test",
|
||||
Version: 0,
|
||||
ParentIds: nil,
|
||||
CreatedAt: time.Now(),
|
||||
UpdatedAt: time.Now(),
|
||||
}
|
||||
err := d.QuestionRepo.CreateQuestion(ctx, &question)
|
||||
assert.NoError(t, err, nil)
|
||||
assert.NotZero(t, question.Id, nil)
|
||||
questions = append(questions, question)
|
||||
|
||||
bdd.Test(t, "get question list", func() {
|
||||
ques, count, err := d.QuestionRepo.GetQuestionList(ctx, 0, 10, 1226358000, 1289430000, quix4filling.Id, false, true, "", questionType)
|
||||
fmt.Println(ques)
|
||||
fmt.Println(count)
|
||||
assert.NoError(t, err, nil)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
bdd.Test(t, "test create answers", func() {
|
||||
testanswers := make([]model.Answer, 0)
|
||||
for i := 0; i < 15; i++ {
|
||||
recAns := model.Answer{
|
||||
Content: "test",
|
||||
QuestionId: questions[0].Id,
|
||||
Result: false,
|
||||
Email: faker.String(),
|
||||
QuizId: faker.Uint64(),
|
||||
}
|
||||
testanswers = append(testanswers, recAns)
|
||||
}
|
||||
answersSession = faker.String()
|
||||
|
||||
anss, err := d.AnswerRepo.CreateAnswers(ctx, testanswers, answersSession, "seeeeeeeesssion", questions[0].QuizId)
|
||||
if len(err) != 0 {
|
||||
assert.NoError(t, err[0], nil)
|
||||
}
|
||||
|
||||
if len(anss) != len(testanswers) {
|
||||
panic("test create answers crushed")
|
||||
}
|
||||
})
|
||||
|
||||
bdd.Test(t, "Get All Answers By Quiz ID(session)", func() {
|
||||
ansss, err := d.AnswerRepo.GetAllAnswersByQuizID(ctx, answersSession)
|
||||
assert.NoError(t, err, nil)
|
||||
assert.Equal(t, 1, len(ansss))
|
||||
})
|
||||
|
||||
bdd.Test(t, "update question", func() {
|
||||
for i := 0; i < len(questions)%80; i++ {
|
||||
|
||||
bdd.Test(t, "get question title", func() {
|
||||
title, tipe, err := d.QuestionRepo.GetQuestionTitleByID(ctx, questions[i].Id)
|
||||
assert.NoError(t, err, nil)
|
||||
assert.Equal(t, questions[i].Title, title)
|
||||
assert.Equal(t, questions[i].Type, tipe)
|
||||
})
|
||||
|
||||
updateques := model.Question{
|
||||
Id: questions[i].Id,
|
||||
QuizId: questions[i].QuizId,
|
||||
Title: faker.String() + questions[i].Title,
|
||||
Description: faker.String() + questions[i].Description,
|
||||
Type: questions[i].Type,
|
||||
Required: questions[i].Required,
|
||||
Deleted: questions[i].Deleted,
|
||||
Page: questions[i].Page,
|
||||
Content: faker.String() + questions[i].Content,
|
||||
Version: questions[i].Version,
|
||||
ParentIds: questions[i].ParentIds,
|
||||
CreatedAt: questions[i].CreatedAt,
|
||||
UpdatedAt: questions[i].UpdatedAt,
|
||||
}
|
||||
|
||||
err := d.QuestionRepo.UpdateQuestion(ctx, updateques)
|
||||
assert.NoError(t, err, nil)
|
||||
|
||||
bdd.Test(t, "move to history question", func() {
|
||||
que, err := d.QuestionRepo.MoveToHistoryQuestion(ctx, questions[i].Id)
|
||||
assert.NoError(t, err, nil)
|
||||
assert.Equal(t, questions[i].Id+11, que.Id)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
bdd.Test(t, "negative question creating: overflow title", func() {
|
||||
question := model.Question{
|
||||
Id: 0,
|
||||
QuizId: quix4filling.Id,
|
||||
Title: faker.StringWithSize(1024),
|
||||
Description: "sample text",
|
||||
Type: model.TypeText,
|
||||
Required: true,
|
||||
Deleted: false,
|
||||
Page: 0,
|
||||
Content: "test",
|
||||
Version: 0,
|
||||
ParentIds: nil,
|
||||
CreatedAt: time.Time{},
|
||||
UpdatedAt: time.Time{},
|
||||
}
|
||||
err := d.QuestionRepo.CreateQuestion(ctx, &question)
|
||||
assert.Error(t, err, nil)
|
||||
})
|
||||
bdd.Test(t, "negative question creating: invalid status", func() {
|
||||
question := model.Question{
|
||||
Id: 0,
|
||||
QuizId: quix4filling.Id,
|
||||
Title: `testNonete`,
|
||||
Description: "sample text",
|
||||
Type: "test",
|
||||
Required: true,
|
||||
Deleted: true,
|
||||
Page: 0,
|
||||
Content: "test",
|
||||
Version: 0,
|
||||
ParentIds: nil,
|
||||
CreatedAt: time.Time{},
|
||||
UpdatedAt: time.Time{},
|
||||
}
|
||||
err := d.QuestionRepo.CreateQuestion(ctx, &question)
|
||||
assert.Error(t, err, nil)
|
||||
})
|
||||
})
|
||||
|
||||
bdd.Act(t, "edit some questions", func() {
|
||||
bdd.Test(t, "positive delete question", func() {
|
||||
question, err := d.QuestionRepo.DeleteQuestion(ctx, questions[0].Id)
|
||||
assert.NoError(t, err)
|
||||
assert.True(t, question.Deleted)
|
||||
questions[0] = question
|
||||
})
|
||||
bdd.Test(t, "negative delete question", func() {
|
||||
question, err := d.QuestionRepo.DeleteQuestion(ctx, math.MaxUint64)
|
||||
assert.Error(t, err)
|
||||
assert.Zero(t, question.Id)
|
||||
})
|
||||
bdd.Test(t, "positive create new version of question", func() {
|
||||
questions[0].Deleted = true
|
||||
questions[0].Version += 1
|
||||
questions[0].ParentIds = append(questions[0].ParentIds, int32(questions[0].Id))
|
||||
questions[0].Title = faker.StringWithSize(100)
|
||||
|
||||
err := d.QuestionRepo.CreateQuestion(ctx, &questions[0])
|
||||
assert.NoError(t, err)
|
||||
})
|
||||
})
|
||||
|
||||
bdd.Act(t, "edit some quizes", func() {
|
||||
bdd.Test(t, "positive delete quiz", func() {
|
||||
quiz, err := d.QuizRepo.DeleteQuiz(ctx, id, records[0].Id)
|
||||
fmt.Println(quiz)
|
||||
assert.NoError(t, err)
|
||||
assert.True(t, quiz.Deleted)
|
||||
records[0].Id = quiz.Id
|
||||
})
|
||||
bdd.Test(t, "negative delete question", func() {
|
||||
quiz, err := d.QuizRepo.DeleteQuiz(ctx, id, math.MaxUint64)
|
||||
assert.Error(t, err)
|
||||
assert.Zero(t, quiz.Id)
|
||||
})
|
||||
bdd.Test(t, "positive create new version of question", func() {
|
||||
records[0].Deleted = true
|
||||
records[0].Version += 1
|
||||
records[0].ParentIds = append(records[0].ParentIds, int32(records[0].Id))
|
||||
records[0].Name = faker.StringWithSize(100)
|
||||
|
||||
err := d.QuizRepo.CreateQuiz(ctx, &records[0])
|
||||
assert.NoError(t, err)
|
||||
})
|
||||
})
|
||||
|
||||
bdd.Act(t, "update expired quizes", func() {
|
||||
bdd.Test(t, "check that we have quizes for expiration", func() {
|
||||
record2 := model.Quiz{
|
||||
AccountId: id,
|
||||
Fingerprinting: true,
|
||||
Repeatable: true,
|
||||
NotePrevented: true,
|
||||
MailNotifications: true,
|
||||
UniqueAnswers: true,
|
||||
Name: faker.StringWithSize(100),
|
||||
Description: "test",
|
||||
Config: "test",
|
||||
Status: model.StatusStart,
|
||||
Limit: 0,
|
||||
DueTo: uint64(time.Now().Add(-time.Hour).Unix()),
|
||||
TimeOfPassing: 0,
|
||||
Pausable: false,
|
||||
}
|
||||
err := d.QuizRepo.CreateQuiz(ctx, &record2)
|
||||
assert.NoError(t, err, nil)
|
||||
assert.NotZero(t, record2.Id, nil)
|
||||
assert.NotEqual(t, record2.CreatedAt, nil)
|
||||
assert.NotEqual(t, record2.UpdatedAt, nil)
|
||||
})
|
||||
})
|
||||
|
||||
bdd.Act(t, "copy question flow", func() {
|
||||
bdd.Test(t, "duplicate question", func() {
|
||||
copiedQuestion, err := d.QuestionRepo.CopyQuestion(ctx, questions[4].Id, 0)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, questions[4].QuizId, copiedQuestion.QuizId)
|
||||
assert.NotEqual(t, questions[4].Id, copiedQuestion.Id)
|
||||
})
|
||||
bdd.Test(t, "copy question to another quiz", func() {
|
||||
copiedQuestion, err := d.QuestionRepo.CopyQuestion(ctx, questions[4].Id, records[10].Id)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, records[10].Id, copiedQuestion.QuizId)
|
||||
assert.NotEqual(t, questions[4].Id, copiedQuestion.Id)
|
||||
})
|
||||
})
|
||||
|
||||
bdd.Act(t, "copy quiz flow", func() {
|
||||
bdd.Test(t, "quiz duplication", func() {
|
||||
copiesQuiz, err := d.QuizRepo.CopyQuiz(ctx, records[10].AccountId, records[10].Id)
|
||||
assert.NoError(t, err)
|
||||
assert.NotEqual(t, records[10].Id, copiesQuiz.Id)
|
||||
})
|
||||
})
|
||||
|
||||
bdd.Act(t, "get history for quiz", func() {
|
||||
bdd.Test(t, "positive quiz history", func() {
|
||||
hist, err := d.QuizRepo.QuizHistory(ctx, quiz.QuizHistoryDeps{
|
||||
Id: records[0].Id,
|
||||
Limit: 100,
|
||||
Offset: 0,
|
||||
AccountId: id,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, len(hist), 2)
|
||||
})
|
||||
bdd.Test(t, "negative quiz history", func() {
|
||||
_, err := d.QuizRepo.QuizHistory(ctx, quiz.QuizHistoryDeps{
|
||||
Id: math.MaxUint64,
|
||||
Limit: 100,
|
||||
Offset: 0,
|
||||
AccountId: id,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, nil, nil)
|
||||
})
|
||||
})
|
||||
|
||||
bdd.Act(t, "get history for question", func() {
|
||||
bdd.Test(t, "positive question history", func() {
|
||||
hist, err := d.QuestionRepo.QuestionHistory(ctx, questions[0].Id, 100, 0)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, len(hist), 2)
|
||||
})
|
||||
bdd.Test(t, "negative question history", func() {
|
||||
_, err := d.QuestionRepo.QuestionHistory(ctx, math.MaxUint64, 100, 0)
|
||||
assert.NoError(t, err)
|
||||
})
|
||||
})
|
||||
|
||||
bdd.Act(t, "Worker Stat Process", func() {
|
||||
err := d.WorkerRepo.WorkerStatProcess(ctx)
|
||||
assert.NoError(t, err, nil)
|
||||
})
|
||||
|
||||
bdd.Act(t, "Worker Timeout Process", func() {
|
||||
err := d.WorkerRepo.WorkerTimeoutProcess(ctx)
|
||||
assert.NoError(t, err, nil)
|
||||
})
|
||||
// todo нужно будет обновить эти тесты связать с выше стоящими
|
||||
bdd.Act(t, "Get Account By ID", func() {
|
||||
account, err := d.AccountRepo.GetAccountByID(ctx, "64eb6ce57047f28fdabf69ec")
|
||||
assert.NoError(t, err, nil)
|
||||
fmt.Println(account)
|
||||
})
|
||||
|
||||
bdd.Act(t, "Get Privileges By Account ID", func() {
|
||||
privileges, err := d.AccountRepo.GetPrivilegesByAccountID(ctx, "64eb6ce57047f28fdabf69ec")
|
||||
assert.NoError(t, err, nil)
|
||||
fmt.Println(privileges)
|
||||
})
|
||||
|
||||
bdd.Act(t, "Get Accounts", func() {
|
||||
accounts, count, err := d.AccountRepo.GetAccounts(ctx, 10, 0)
|
||||
assert.NoError(t, err, nil)
|
||||
fmt.Println(accounts)
|
||||
fmt.Println(len(accounts))
|
||||
fmt.Println(count)
|
||||
})
|
||||
|
||||
bdd.Act(t, "Update Privilege", func() {
|
||||
priv := model.ShortPrivilege{
|
||||
PrivilegeID: "quizCnt",
|
||||
PrivilegeName: "Количество Заявок",
|
||||
Amount: 0,
|
||||
CreatedAt: time.Now(),
|
||||
}
|
||||
err := d.AccountRepo.UpdatePrivilege(ctx, &priv, "047c1109-1fba-47d8-b4ec-6ded153a2ea9")
|
||||
assert.NoError(t, err, nil)
|
||||
|
||||
})
|
||||
|
||||
bdd.Act(t, "Insert Privilege", func() {
|
||||
priv := model.ShortPrivilege{
|
||||
PrivilegeID: "quizCnt",
|
||||
PrivilegeName: "123",
|
||||
Amount: 123,
|
||||
CreatedAt: time.Now(),
|
||||
}
|
||||
|
||||
err := d.AccountRepo.InsertPrivilege(ctx, &priv, "047c1109-1fba-47d8-b4ec-6ded153a2ea9")
|
||||
assert.NoError(t, err, nil)
|
||||
})
|
||||
|
||||
bdd.Act(t, "Get Expired", func() {
|
||||
|
||||
priv, err := d.AccountRepo.GetExpired(ctx, "quizCnt")
|
||||
fmt.Println(priv)
|
||||
assert.NoError(t, err, nil)
|
||||
})
|
||||
|
||||
bdd.Act(t, "Delete Privilege By ID", func() {
|
||||
err := d.AccountRepo.DeletePrivilegeByID(ctx, "10")
|
||||
assert.NoError(t, err, nil)
|
||||
})
|
||||
|
||||
bdd.Act(t, "Update Privilege Amount", func() {
|
||||
err := d.AccountRepo.UpdatePrivilegeAmount(ctx, "2", 100000)
|
||||
assert.NoError(t, err, nil)
|
||||
})
|
||||
|
||||
bdd.Act(t, "Get Acc And Privilege By Email(userid)", func() {
|
||||
acc, priv, err := d.AccountRepo.GetAccAndPrivilegeByEmail(ctx, "650061935ad320604ff24cc2")
|
||||
fmt.Println(acc, priv)
|
||||
assert.NoError(t, err, nil)
|
||||
})
|
||||
|
||||
bdd.Act(t, "Get Quiz Results", func() {
|
||||
now := time.Now()
|
||||
|
||||
yearAgo := now.AddDate(-1, 0, 0)
|
||||
|
||||
yearAhead := now.AddDate(1, 0, 0)
|
||||
ansexp, count, err := d.ResultRepo.GetQuizResults(ctx, 9422, result.GetQuizResDeps{
|
||||
To: yearAhead,
|
||||
From: yearAgo,
|
||||
New: false,
|
||||
Page: 1,
|
||||
Limit: 10,
|
||||
}, true)
|
||||
assert.NoError(t, err, nil)
|
||||
fmt.Println(ansexp)
|
||||
fmt.Println(count)
|
||||
})
|
||||
|
||||
bdd.Act(t, "Update Answers Status", func() {
|
||||
err := d.ResultRepo.UpdateAnswersStatus(ctx, "64eb6ce57047f28fdabf69ec", []uint64{1, 2, 3, 4, 5, 6, 7, 8, 9, 10})
|
||||
assert.NoError(t, err, nil)
|
||||
})
|
||||
|
||||
bdd.Act(t, "Get Quiz Results CSV", func() {
|
||||
now := time.Now()
|
||||
|
||||
yearAgo := now.AddDate(-1, 0, 0)
|
||||
|
||||
yearAhead := now.AddDate(1, 0, 0)
|
||||
ans, err := d.ResultRepo.GetQuizResultsCSV(ctx, 14734, result.GetQuizResDeps{
|
||||
To: yearAhead,
|
||||
From: yearAgo,
|
||||
New: false,
|
||||
})
|
||||
fmt.Println(ans)
|
||||
assert.NoError(t, err, nil)
|
||||
})
|
||||
|
||||
bdd.Act(t, "Get Questions", func() {
|
||||
ques, err := d.ResultRepo.GetQuestions(ctx, 14734)
|
||||
fmt.Println(ques)
|
||||
assert.NoError(t, err, nil)
|
||||
})
|
||||
|
||||
bdd.Act(t, "Check Results Owner", func() {
|
||||
anss, err := d.ResultRepo.CheckResultsOwner(ctx, []int64{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, "64eb6ce57047f28fdabf69ec")
|
||||
fmt.Println(anss)
|
||||
assert.NoError(t, err, nil)
|
||||
})
|
||||
|
||||
bdd.Act(t, "Get Result Answers", func() {
|
||||
anss, err := d.ResultRepo.GetResultAnswers(ctx, 1)
|
||||
fmt.Println(anss)
|
||||
assert.NoError(t, err, nil)
|
||||
})
|
||||
|
||||
bdd.Act(t, "Check Result Owner", func() {
|
||||
anss, err := d.ResultRepo.CheckResultOwner(ctx, 1, "64eb6ce57047f28fdabf69ec")
|
||||
assert.Equal(t, anss, true)
|
||||
assert.NoError(t, err, nil)
|
||||
})
|
||||
|
||||
bdd.Act(t, "Soft Delete Result By ID", func() {
|
||||
err := d.ResultRepo.SoftDeleteResultByID(ctx, 10)
|
||||
assert.NoError(t, err, nil)
|
||||
})
|
||||
})
|
||||
}
|
BIN
tests/gilroy-bold.woff2
Normal file
BIN
tests/gilroy-bold.woff2
Normal file
Binary file not shown.
BIN
tests/logo192.png
Normal file
BIN
tests/logo192.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
BIN
tests/logo512.png
Normal file
BIN
tests/logo512.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.4 KiB |
193
tests/mail/reminder.tmpl
Normal file
193
tests/mail/reminder.tmpl
Normal file
File diff suppressed because one or more lines are too long
515
tests/mail/to_client.tmpl
Normal file
515
tests/mail/to_client.tmpl
Normal file
@ -0,0 +1,515 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Document</title>
|
||||
<style>
|
||||
/* Сброс стилей */
|
||||
body,
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
p,
|
||||
div,
|
||||
img,
|
||||
button,
|
||||
table,
|
||||
th,
|
||||
td {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
|
||||
font: inherit;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: #f2f2f7;
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
h1 {
|
||||
font-size: 25px !important;
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-size: 20px !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body style="background-color: #f2f2f7; font-family: Arial, sans-serif">
|
||||
<table style="width: 100%; padding: 16px">
|
||||
<tr>
|
||||
<td>
|
||||
<img class="image" style="width: 103px; height: 40px" src="data:image/png;base64,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
|
||||
" />
|
||||
</td>
|
||||
<td>
|
||||
<p style="text-align: end; color: #9a9aaf; font-size: 14px">Квиз для вашего бизнеса</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2" style="height: 100%">
|
||||
<h1
|
||||
style="
|
||||
font-size: 30px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 13px;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
margin-bottom: 13px;
|
||||
margin-top: 50px;
|
||||
"
|
||||
>
|
||||
Поступила новая заявка с квиза “{{.QuizConfig.Theme}}”!
|
||||
</h1>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" style="height: 100%">
|
||||
<p style="color: #9a9aaf; font-size: 20px; margin-bottom: 50px">
|
||||
Время заявки: {{ .AnswerTime }}
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2" style="height: 100%">
|
||||
<a
|
||||
style="
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
color: #f2f3f7;
|
||||
text-align: center;
|
||||
font-size: 18px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: 24px;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #7e2aea;
|
||||
background: #7e2aea;
|
||||
padding: 10px 43px;
|
||||
max-height: 63px;
|
||||
margin-bottom: 50px;
|
||||
"
|
||||
>
|
||||
Посмотреть в личном кабинете
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2" style="height: 100%">
|
||||
<h1
|
||||
style="font-size: 25px; font-weight: 600; margin-bottom: 15px; width: 100%; margin: 0; margin-bottom: 13px"
|
||||
>
|
||||
Контакты
|
||||
</h1>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2" style="padding: 0">
|
||||
<table
|
||||
style="
|
||||
background-color: #fff;
|
||||
border-radius: 8px;
|
||||
text-align: left;
|
||||
max-width: 480px;
|
||||
width: 100%;
|
||||
padding: 16px;
|
||||
margin-bottom: 30px;
|
||||
"
|
||||
>
|
||||
<tr>
|
||||
<th
|
||||
style="
|
||||
text-align: start;
|
||||
color: #9a9aaf;
|
||||
font-size: 20px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: normal;
|
||||
"
|
||||
>
|
||||
Имя
|
||||
</th>
|
||||
<td>
|
||||
<p
|
||||
style="
|
||||
text-align: start;
|
||||
color: #4d4d4d;
|
||||
font-size: 20px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: normal;
|
||||
margin-bottom: 15px;
|
||||
"
|
||||
>
|
||||
{{ .AnswerContent.Name}}
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
{{ if .AnswerContent.Email }}
|
||||
<tr>
|
||||
<th
|
||||
style="
|
||||
text-align: start;
|
||||
color: #9a9aaf;
|
||||
font-size: 20px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: normal;
|
||||
"
|
||||
>
|
||||
Email
|
||||
</th>
|
||||
<td style="word-break: break-word">
|
||||
<p
|
||||
style="
|
||||
text-align: start;
|
||||
color: #7e2aea;
|
||||
font-size: 20px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: normal;
|
||||
margin-bottom: 15px;
|
||||
"
|
||||
>
|
||||
{{ .AnswerContent.Email }}
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
{{ if .AnswerContent.Phone }}
|
||||
<tr>
|
||||
<th
|
||||
style="
|
||||
text-align: start;
|
||||
color: #9a9aaf;
|
||||
font-size: 20px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: normal;
|
||||
"
|
||||
>
|
||||
Телефон
|
||||
</th>
|
||||
<td
|
||||
style="
|
||||
text-align: start;
|
||||
color: #4d4d4d;
|
||||
font-size: 20px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: normal;
|
||||
"
|
||||
>
|
||||
{{ .AnswerContent.Phone }}
|
||||
</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
|
||||
{{ if .AnswerContent.Telegram }}
|
||||
<tr>
|
||||
<th
|
||||
style="
|
||||
text-align: start;
|
||||
color: #9a9aaf;
|
||||
font-size: 20px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: normal;
|
||||
"
|
||||
>
|
||||
Telegram
|
||||
</th>
|
||||
<td
|
||||
style="
|
||||
text-align: start;
|
||||
color: #4d4d4d;
|
||||
font-size: 20px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: normal;
|
||||
"
|
||||
>
|
||||
{{ .AnswerContent.Telegram }}
|
||||
</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
{{ if .AnswerContent.Wechat }}
|
||||
<tr>
|
||||
<th
|
||||
style="
|
||||
text-align: start;
|
||||
color: #9a9aaf;
|
||||
font-size: 20px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: normal;
|
||||
"
|
||||
>
|
||||
Wechat
|
||||
</th>
|
||||
<td
|
||||
style="
|
||||
text-align: start;
|
||||
color: #4d4d4d;
|
||||
font-size: 20px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: normal;
|
||||
"
|
||||
>
|
||||
{{ .AnswerContent.Wechat }}
|
||||
</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
{{ if .AnswerContent.Viber }}
|
||||
<tr>
|
||||
<th
|
||||
style="
|
||||
text-align: start;
|
||||
color: #9a9aaf;
|
||||
font-size: 20px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: normal;
|
||||
"
|
||||
>
|
||||
Viber
|
||||
</th>
|
||||
<td
|
||||
style="
|
||||
text-align: start;
|
||||
color: #4d4d4d;
|
||||
font-size: 20px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: normal;
|
||||
"
|
||||
>
|
||||
{{ .AnswerContent.Viber }}
|
||||
</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
{{ if .AnswerContent.Vk }}
|
||||
<tr>
|
||||
<th
|
||||
style="
|
||||
text-align: start;
|
||||
color: #9a9aaf;
|
||||
font-size: 20px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: normal;
|
||||
"
|
||||
>
|
||||
Vk
|
||||
</th>
|
||||
<td
|
||||
style="
|
||||
text-align: start;
|
||||
color: #4d4d4d;
|
||||
font-size: 20px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: normal;
|
||||
"
|
||||
>
|
||||
{{ .AnswerContent.Vk }}
|
||||
</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
{{ if .AnswerContent.Skype }}
|
||||
<tr>
|
||||
<th
|
||||
style="
|
||||
text-align: start;
|
||||
color: #9a9aaf;
|
||||
font-size: 20px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: normal;
|
||||
"
|
||||
>
|
||||
Skype
|
||||
</th>
|
||||
<td
|
||||
style="
|
||||
text-align: start;
|
||||
color: #4d4d4d;
|
||||
font-size: 20px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: normal;
|
||||
"
|
||||
>
|
||||
{{ .AnswerContent.Skype }}
|
||||
</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
{{ if .AnswerContent.Whatsup }}
|
||||
<tr>
|
||||
<th
|
||||
style="
|
||||
text-align: start;
|
||||
color: #9a9aaf;
|
||||
font-size: 20px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: normal;
|
||||
"
|
||||
>
|
||||
Whatsup
|
||||
</th>
|
||||
<td
|
||||
style="
|
||||
text-align: start;
|
||||
color: #4d4d4d;
|
||||
font-size: 20px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: normal;
|
||||
"
|
||||
>
|
||||
{{ .AnswerContent.Whatsup }}
|
||||
</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
{{ if .AnswerContent.Messenger }}
|
||||
<tr>
|
||||
<th
|
||||
style="
|
||||
text-align: start;
|
||||
color: #9a9aaf;
|
||||
font-size: 20px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: normal;
|
||||
"
|
||||
>
|
||||
Messenger
|
||||
</th>
|
||||
<td
|
||||
style="
|
||||
text-align: start;
|
||||
color: #4d4d4d;
|
||||
font-size: 20px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: normal;
|
||||
"
|
||||
>
|
||||
{{ .AnswerContent.Messenger }}
|
||||
</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2" style="height: 100%">
|
||||
<h1
|
||||
style="font-size: 25px; font-weight: 600; margin-bottom: 15px; width: 100%; margin: 0; margin-bottom: 13px"
|
||||
>
|
||||
Ответы
|
||||
</h1>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{{ range .AllAnswers }}
|
||||
{{ if index $.QuestionsMap .QuestionID }}
|
||||
<tr>
|
||||
<td colspan="2" style="padding: 0">
|
||||
<table
|
||||
style="
|
||||
background-color: #fff;
|
||||
border-radius: 8px;
|
||||
text-align: left;
|
||||
max-width: 480px;
|
||||
width: 100%;
|
||||
padding: 16px;
|
||||
margin-bottom: 15px;
|
||||
"
|
||||
>
|
||||
<tr>
|
||||
<th colspan="2">
|
||||
<p
|
||||
style="
|
||||
text-align: start;
|
||||
color: #4d4d4d;
|
||||
font-size: 20px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: normal;
|
||||
margin-bottom: 10px;
|
||||
"
|
||||
>
|
||||
{{ index $.QuestionsMap .QuestionID }}
|
||||
</p>
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="color: #9a9aaf; font-size: 20px; font-style: normal; font-weight: 400; line-height: normal">
|
||||
{{ .Content }}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
{{end}}
|
||||
|
||||
<tr>
|
||||
<td colspan="2" style="padding: 0">
|
||||
<table
|
||||
style="
|
||||
background-color: #fff;
|
||||
border-radius: 8px;
|
||||
text-align: left;
|
||||
max-width: 480px;
|
||||
width: 100%;
|
||||
padding: 16px;
|
||||
margin-bottom: 40px;
|
||||
"
|
||||
>
|
||||
<tr>
|
||||
<th
|
||||
style="
|
||||
text-align: start;
|
||||
color: #4d4d4d;
|
||||
font-size: 20px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: normal;
|
||||
"
|
||||
>
|
||||
Страница
|
||||
</th>
|
||||
<td style="color: #7e2aea; font-size: 20px; font-style: normal; font-weight: 400; line-height: normal">
|
||||
Перейти
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2" style="text-align: center; padding: 0">
|
||||
<a style="color: #7e2aea; font-size: 20px; font-style: normal; font-weight: 400; line-height: normal">
|
||||
penaquiz.com
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
28
tests/new.txt
Normal file
28
tests/new.txt
Normal file
@ -0,0 +1,28 @@
|
||||
goos: linux
|
||||
goarch: amd64
|
||||
pkg: squiz/tests
|
||||
cpu: Intel(R) Core(TM) i3-6100H CPU @ 2.70GHz
|
||||
BenchmarkQuizCreation-4 211 7806501 ns/op 3526 B/op 51 allocs/op
|
||||
BenchmarkQuestionCreation-4 206 6187312 ns/op 2759 B/op 40 allocs/op
|
||||
BenchmarkQuestionHistory-4 146 7057323 ns/op 3339 B/op 44 allocs/op
|
||||
BenchmarkQuizCopy-4 98 14264658 ns/op 11907 B/op 167 allocs/op
|
||||
BenchmarkQuestionDuplicate-4 183 6418405 ns/op 1535 B/op 32 allocs/op
|
||||
BenchmarkQuestionCopy-4 211 6203381 ns/op 1457 B/op 31 allocs/op
|
||||
BenchmarkQuiznArchiving-4 201 6179325 ns/op 686 B/op 15 allocs/op
|
||||
BenchmarkQuizHistory-4 262 5225611 ns/op 2484 B/op 45 allocs/op
|
||||
BenchmarkQuizDeleting-4 192 6523611 ns/op 2196 B/op 43 allocs/op
|
||||
panic: runtime error: invalid memory address or nil pointer dereference
|
||||
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xd815d3]
|
||||
|
||||
goroutine 445 [running]:
|
||||
squiz/dal.(*DAL).GetQuizByQid(_, {_, _}, {_, _})
|
||||
/home/skeris/go/src/github.com/skeris/squiz/dal/quiz.go:226 +0x533
|
||||
squiz/tests.BenchmarkQuizGetByQid.func1(0xc00003ab40)
|
||||
/home/skeris/go/src/github.com/skeris/squiz/tests/dalbench_test.go:292 +0x14b
|
||||
testing.(*B).RunParallel.func1()
|
||||
/snap/go/current/src/testing/benchmark.go:788 +0xcb
|
||||
created by testing.(*B).RunParallel
|
||||
/snap/go/current/src/testing/benchmark.go:781 +0x105
|
||||
exit status 2
|
||||
FAIL squiz/tests 17.522s
|
||||
FAIL
|
2
tests/old.txt
Normal file
2
tests/old.txt
Normal file
@ -0,0 +1,2 @@
|
||||
FAIL squiz/tests [build failed]
|
||||
FAIL
|
24
tests/publish_test.go
Normal file
24
tests/publish_test.go
Normal file
@ -0,0 +1,24 @@
|
||||
package tests
|
||||
|
||||
import (
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"penahub.gitlab.yandexcloud.net/backend/penahub_common/privilege"
|
||||
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/model"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestPublishPrivileges(t *testing.T) {
|
||||
clientData := privilege.Client{
|
||||
URL: "http://localhost:8001",
|
||||
ServiceName: "squiz",
|
||||
Privileges: model.Privileges,
|
||||
}
|
||||
fiberClient := &fiber.Client{}
|
||||
privilegeController := privilege.NewPrivilege(clientData, fiberClient)
|
||||
|
||||
t.Run("PublishPrivileges", func(t *testing.T) {
|
||||
err := privilegeController.PublishPrivileges()
|
||||
assert.NoError(t, err)
|
||||
})
|
||||
}
|
159
tests/smtp_test.go
Normal file
159
tests/smtp_test.go
Normal file
@ -0,0 +1,159 @@
|
||||
package tests
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/pioz/faker"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/model"
|
||||
"penahub.gitlab.yandexcloud.net/backend/quiz/worker.git/answerwc"
|
||||
"penahub.gitlab.yandexcloud.net/backend/quiz/worker.git/clients/mailclient"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
//go:embed mail/to_client.tmpl
|
||||
var toClientTemplate string
|
||||
|
||||
//go:embed mail/reminder.tmpl
|
||||
var reminderTemplate string
|
||||
|
||||
func TestProcessMessageToSMTP(t *testing.T) {
|
||||
clientDeps := mailclient.ClientDeps{
|
||||
Host: "connect.mailclient.bz",
|
||||
Port: "587",
|
||||
Sender: "skeris@mailing.pena.digital",
|
||||
Auth: &mailclient.PlainAuth{Username: "kotilion.95@gmail.com", Password: "vWwbCSg4bf0p"},
|
||||
ApiKey: "P0YsjUB137upXrr1NiJefHmXVKW1hmBWlpev",
|
||||
FiberClient: &fiber.Client{},
|
||||
}
|
||||
|
||||
client := mailclient.NewClient(clientDeps)
|
||||
|
||||
recipient := "mullinp@internet.ru"
|
||||
subject := "Test"
|
||||
|
||||
data := mailclient.EmailTemplateData{
|
||||
QuizConfig: model.ResultInfo{
|
||||
Theme: "Taemplste Quiz",
|
||||
},
|
||||
AnswerContent: model.ResultContent{
|
||||
Name: "Pasha",
|
||||
Phone: "+723456789",
|
||||
Email: "test@example.com",
|
||||
//Adress: "chtoto tam",
|
||||
Telegram: "@test",
|
||||
Wechat: "test_wechat",
|
||||
Viber: "+723456789",
|
||||
Vk: "test_vk",
|
||||
Skype: "test_skype",
|
||||
Whatsup: "test_whatsup",
|
||||
Messenger: "test_messenger",
|
||||
},
|
||||
AllAnswers: []model.ResultAnswer{
|
||||
{QuestionID: 1, Content: "Pasha"},
|
||||
{QuestionID: 2, Content: "From a friend"},
|
||||
},
|
||||
QuestionsMap: map[uint64]string{
|
||||
2: "How did you hear about us?",
|
||||
},
|
||||
AnswerTime: time.Now().Format("Monday, 2 January 2006 г., 15:04 UTC-07:00"),
|
||||
}
|
||||
|
||||
err := client.SendMailWithAttachment(recipient, subject, toClientTemplate, data, nil)
|
||||
if err != nil {
|
||||
t.Errorf("Error sending email: %v", err)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestProcessReminderToClient(t *testing.T) {
|
||||
clientDeps := mailclient.ClientDeps{
|
||||
Host: "connect.mailclient.bz",
|
||||
Port: "587",
|
||||
Sender: "skeris@mailing.pena.digital",
|
||||
Auth: &mailclient.PlainAuth{Username: "kotilion.95@gmail.com", Password: "vWwbCSg4bf0p"},
|
||||
ApiKey: "P0YsjUB137upXrr1NiJefHmXVKW1hmBWlpev",
|
||||
FiberClient: &fiber.Client{},
|
||||
}
|
||||
|
||||
client := mailclient.NewClient(clientDeps)
|
||||
|
||||
recipient := "mullinp@internet.ru"
|
||||
subject := "Test Reminder"
|
||||
|
||||
quizConfig := model.ResultInfo{
|
||||
ReplName: "Test Quiz",
|
||||
Reply: "mullinp@internet.ru",
|
||||
Theme: "Reminder Theme",
|
||||
}
|
||||
|
||||
err := client.SendMailWithAttachment(recipient, subject, reminderTemplate, mailclient.EmailTemplateData{
|
||||
QuizConfig: quizConfig,
|
||||
AnswerContent: model.ResultContent{},
|
||||
AllAnswers: []model.ResultAnswer{},
|
||||
QuestionsMap: nil,
|
||||
}, nil)
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("Error sending email: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestProcessMessageToClient(t *testing.T) {
|
||||
|
||||
smtpData := mailclient.ClientDeps{
|
||||
Host: "connect.mailclient.bz",
|
||||
Port: "587",
|
||||
Sender: "skeris@mailing.pena.digital",
|
||||
Auth: &mailclient.PlainAuth{Username: "kotilion.95@gmail.com", Password: "vWwbCSg4bf0p"},
|
||||
ApiKey: "P0YsjUB137upXrr1NiJefHmXVKW1hmBWlpev",
|
||||
FiberClient: &fiber.Client{},
|
||||
}
|
||||
|
||||
mailClient := mailclient.NewClient(smtpData)
|
||||
|
||||
deps := answerwc.DepsSendToClient{
|
||||
Redis: nil,
|
||||
Dal: nil,
|
||||
MailClient: mailClient,
|
||||
}
|
||||
|
||||
errChan := make(chan<- error)
|
||||
|
||||
w := answerwc.NewSendToClient(deps, nil, errChan)
|
||||
|
||||
quizConfig := model.QuizConfig{
|
||||
Mailing: model.ResultInfo{
|
||||
Theme: faker.String(),
|
||||
},
|
||||
}
|
||||
|
||||
questionsMap := map[uint64]string{
|
||||
1: faker.String(),
|
||||
2: faker.String(),
|
||||
}
|
||||
|
||||
account := model.Account{
|
||||
Email: "mullinp@internet.ru",
|
||||
}
|
||||
|
||||
allAnswers := []model.ResultAnswer{
|
||||
{
|
||||
AnswerID: 1,
|
||||
QuestionID: 1,
|
||||
},
|
||||
{
|
||||
AnswerID: 2,
|
||||
QuestionID: 2,
|
||||
},
|
||||
}
|
||||
|
||||
answerContent := model.ResultContent{}
|
||||
|
||||
answerTime := time.Now()
|
||||
|
||||
err := w.ProcessMessageToClient(quizConfig, questionsMap, account, allAnswers, answerContent, answerTime)
|
||||
|
||||
assert.NoError(t, err)
|
||||
}
|
140
tests/utils.go
Normal file
140
tests/utils.go
Normal file
@ -0,0 +1,140 @@
|
||||
package tests
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/golang-jwt/jwt/v5"
|
||||
"github.com/joho/godotenv"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
type JWTClient struct {
|
||||
token *jwt.Token
|
||||
client http.Client
|
||||
}
|
||||
|
||||
func (jc *JWTClient) Get(url string, body io.Reader) (resp *http.Response, err error) {
|
||||
return jc.request(http.MethodGet, url, body, nil)
|
||||
}
|
||||
|
||||
func (jc *JWTClient) Post(url string, body io.Reader) (resp *http.Response, err error) {
|
||||
return jc.request(http.MethodPost, url, body, nil)
|
||||
}
|
||||
|
||||
func (jc *JWTClient) Patch(url string, body io.Reader) (resp *http.Response, err error) {
|
||||
return jc.request(http.MethodPatch, url, body, nil)
|
||||
}
|
||||
|
||||
func (jc *JWTClient) Delete(url string, body io.Reader) (resp *http.Response, err error) {
|
||||
return jc.request(http.MethodDelete, url, body, nil)
|
||||
}
|
||||
|
||||
func (jc *JWTClient) request(method, url string, body io.Reader, callback func(*http.Request)) (resp *http.Response, err error) {
|
||||
req, err := http.NewRequest(method, url, body)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if callback != nil {
|
||||
callback(req)
|
||||
} else if method == http.MethodPost {
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
}
|
||||
|
||||
req.Header.Set("Authorization", "Bearer "+jc.token.Raw)
|
||||
|
||||
return jc.client.Do(req)
|
||||
}
|
||||
|
||||
func (jc *JWTClient) GetExpect(t *testing.T, url string, code int, data interface{}) {
|
||||
t.Helper()
|
||||
jc.expect(t, http.MethodGet, url, code, data)
|
||||
}
|
||||
|
||||
func (jc *JWTClient) PostExpect(t *testing.T, url string, code int, data interface{}) {
|
||||
t.Helper()
|
||||
jc.expect(t, http.MethodPost, url, code, data)
|
||||
}
|
||||
|
||||
func (jc *JWTClient) PatchExpect(t *testing.T, url string, code int, data interface{}) {
|
||||
t.Helper()
|
||||
jc.expect(t, http.MethodPatch, url, code, data)
|
||||
}
|
||||
|
||||
func (jc *JWTClient) expect(t *testing.T, method, url string, code int, data interface{}) {
|
||||
t.Helper()
|
||||
request, err := json.Marshal(&data)
|
||||
assert.NoError(t, err)
|
||||
body := bytes.NewBuffer(request)
|
||||
r, err := jc.request(method, url, body, nil)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, code, r.StatusCode)
|
||||
}
|
||||
|
||||
func registerUser(login string) *jwt.Token {
|
||||
client := &http.Client{}
|
||||
|
||||
err := godotenv.Load("../deployments/test/auth.env.test")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
publicKey := os.Getenv("PUBLIC_ACCESS_SECRET_KEY")
|
||||
if publicKey == "" {
|
||||
panic("no public key found")
|
||||
}
|
||||
|
||||
payload, err := json.Marshal(map[string]string{
|
||||
"login": login,
|
||||
"email": login + "@mail.ru",
|
||||
"password": "887",
|
||||
"phoneNumber": "+9008007766",
|
||||
})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
req, err := http.NewRequest("POST", "http://localhost:8000/auth/register", bytes.NewBuffer(payload))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
bytes, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
var response struct {
|
||||
AccessToken string `json:"accessToken"`
|
||||
RefreshToken string `json:"refreshToken"`
|
||||
}
|
||||
|
||||
err = json.Unmarshal(bytes, &response)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
token, err := jwt.Parse(response.AccessToken, func(token *jwt.Token) (any, error) {
|
||||
return jwt.ParseRSAPublicKeyFromPEM([]byte(publicKey))
|
||||
})
|
||||
fmt.Println(token)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return token
|
||||
}
|
Loading…
Reference in New Issue
Block a user