bump mockery, add test stub for oidc_auth.go, align mock generation (#8321)

* bump mockery, add test stub for oidc_auth.go

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* use .mockery.yaml for all mocks

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* drop legacy go:generate mockery

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* align mock placement

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

---------

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
Jörn Friedrich Dreyer
2024-02-01 10:07:44 +01:00
committed by GitHub
parent 1281a730e8
commit fad94d2038
60 changed files with 6676 additions and 1463 deletions

View File

@@ -65,11 +65,11 @@ $(HUGO): $(BINGO_DIR)/hugo.mod
@echo "(re)installing $(GOBIN)/hugo-v0.115.2"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=hugo.mod -o=$(GOBIN)/hugo-v0.115.2 "github.com/gohugoio/hugo"
MOCKERY := $(GOBIN)/mockery-v2.22.1
MOCKERY := $(GOBIN)/mockery-v2.40.1
$(MOCKERY): $(BINGO_DIR)/mockery.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
@echo "(re)installing $(GOBIN)/mockery-v2.22.1"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=mockery.mod -o=$(GOBIN)/mockery-v2.22.1 "github.com/vektra/mockery/v2"
@echo "(re)installing $(GOBIN)/mockery-v2.40.1"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=mockery.mod -o=$(GOBIN)/mockery-v2.40.1 "github.com/vektra/mockery/v2"
MUTAGEN := $(GOBIN)/mutagen-v0.13.1
$(MUTAGEN): $(BINGO_DIR)/mutagen.mod

View File

@@ -1,5 +1,5 @@
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT
go 1.20
go 1.21.6
require github.com/vektra/mockery/v2 v2.22.1
require github.com/vektra/mockery/v2 v2.40.1

View File

@@ -39,8 +39,8 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/chigopher/pathlib v0.12.0 h1:1GM7fN/IwXXmOHbd1jkMqHD2wUhYqUvafgxTwmLT/q8=
github.com/chigopher/pathlib v0.12.0/go.mod h1:EJ5UtJ/sK8Nt6q3VWN+EwZLZ3g0afJiG8NegYiQQ/gQ=
github.com/chigopher/pathlib v0.19.1 h1:RoLlUJc0CqBGwq239cilyhxPNLXTK+HXoASGyGznx5A=
github.com/chigopher/pathlib v0.19.1/go.mod h1:tzC1dZLW8o33UQpWkNkhvPwL5n4yyFRFm/jL1YGWFvY=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
@@ -122,6 +122,8 @@ github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU=
github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/iancoleman/strcase v0.2.0 h1:05I4QRnGpI0m37iZQRuskXh+w77mr6Z41lwQzuHLwW0=
github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
@@ -153,10 +155,7 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU=
github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek=
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=
github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI=
github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
@@ -165,7 +164,6 @@ github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.29.0 h1:Zes4hju04hjbvkVkOhdl2HpZa+0PmVwigmo8XoORE5w=
github.com/rs/zerolog v1.29.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/spf13/afero v1.4.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I=
github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk=
github.com/spf13/afero v1.9.3/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y=
github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w=
@@ -179,21 +177,19 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An
github.com/spf13/viper v1.15.0 h1:js3yy885G8xwJa6iOISGFwd+qlUo5AvyXb7CiihdtiU=
github.com/spf13/viper v1.15.0/go.mod h1:fFcTBJxvhhzSJiZy8n+PeW6t8l+KeT/uTARa0jHOQLA=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8=
github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0=
github.com/vektra/mockery/v2 v2.22.1 h1:ryH5jFQ35Z7o1Adt65fYO5n4Y7eRybjNWM6opb+ZjRE=
github.com/vektra/mockery/v2 v2.22.1/go.mod h1:Zh3Kv1ckKs6FokhlVLcCu6UTyzfS3M8mpROz1lBNp+w=
github.com/vektra/mockery/v2 v2.40.1 h1:8D01rBqloDLDHKZGXkyUD9Yj5Z+oDXBqDZ+tRXYM/oA=
github.com/vektra/mockery/v2 v2.40.1/go.mod h1:dPzGtjT0/Uu4hqpF6QNHwz+GLago7lq1bxdj9wHbGKo=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
@@ -207,13 +203,10 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc=
golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@@ -247,8 +240,8 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs=
golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -337,8 +330,8 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
@@ -400,8 +393,8 @@ golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4f
golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4=
golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

View File

@@ -24,7 +24,7 @@ GOVULNCHECK="${GOBIN}/govulncheck-v1.0.1"
HUGO="${GOBIN}/hugo-v0.115.2"
MOCKERY="${GOBIN}/mockery-v2.22.1"
MOCKERY="${GOBIN}/mockery-v2.40.1"
MUTAGEN="${GOBIN}/mutagen-v0.13.1"

9
ocis-pkg/.mockery.yaml Normal file
View File

@@ -0,0 +1,9 @@
with-expecter: true
filename: "{{.InterfaceName | snakecase }}.go"
dir: "{{.PackageName}}/mocks"
mockname: "{{.InterfaceName}}"
outpkg: "mocks"
packages:
github.com/owncloud/ocis/v2/ocis-pkg/oidc:
interfaces:
OIDCClient:

View File

@@ -26,7 +26,8 @@ docs-generate:
include ../.make/generate.mk
.PHONY: ci-go-generate
ci-go-generate: # CI runs ci-node-generate automatically before this target
ci-go-generate: $(MOCKERY) # CI runs ci-node-generate automatically before this target
$(MOCKERY)
.PHONY: ci-node-generate
ci-node-generate:

View File

@@ -7,8 +7,6 @@ import (
)
// GoCloak represents the parts of gocloak.GoCloak that we use, mainly here for mockery.
//
//go:generate mockery --name=GoCloak
type GoCloak interface {
CreateUser(ctx context.Context, token, realm string, user gocloak.User) (string, error)
GetUsers(ctx context.Context, token, realm string, params gocloak.GetUsersParams) ([]*gocloak.User, error)

View File

@@ -1,58 +0,0 @@
// Code generated by mockery v0.0.0-dev. DO NOT EDIT.
package mocks
import (
context "context"
mock "github.com/stretchr/testify/mock"
oauth2 "golang.org/x/oauth2"
oidc "github.com/coreos/go-oidc"
)
// OIDCProvider is an autogenerated mock type for the OIDCProvider type
type OIDCProvider struct {
mock.Mock
}
// UserInfo provides a mock function with given fields: ctx, ts
func (_m *OIDCProvider) UserInfo(ctx context.Context, ts oauth2.TokenSource) (*oidc.UserInfo, error) {
ret := _m.Called(ctx, ts)
var r0 *oidc.UserInfo
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, oauth2.TokenSource) (*oidc.UserInfo, error)); ok {
return rf(ctx, ts)
}
if rf, ok := ret.Get(0).(func(context.Context, oauth2.TokenSource) *oidc.UserInfo); ok {
r0 = rf(ctx, ts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*oidc.UserInfo)
}
}
if rf, ok := ret.Get(1).(func(context.Context, oauth2.TokenSource) error); ok {
r1 = rf(ctx, ts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
type mockConstructorTestingTNewOIDCProvider interface {
mock.TestingT
Cleanup(func())
}
// NewOIDCProvider creates a new instance of OIDCProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewOIDCProvider(t mockConstructorTestingTNewOIDCProvider) *OIDCProvider {
mock := &OIDCProvider{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,225 @@
// Code generated by mockery v2.40.1. DO NOT EDIT.
package mocks
import (
context "context"
jwt "github.com/golang-jwt/jwt/v4"
mock "github.com/stretchr/testify/mock"
oauth2 "golang.org/x/oauth2"
oidc "github.com/owncloud/ocis/v2/ocis-pkg/oidc"
)
// OIDCClient is an autogenerated mock type for the OIDCClient type
type OIDCClient struct {
mock.Mock
}
type OIDCClient_Expecter struct {
mock *mock.Mock
}
func (_m *OIDCClient) EXPECT() *OIDCClient_Expecter {
return &OIDCClient_Expecter{mock: &_m.Mock}
}
// UserInfo provides a mock function with given fields: ctx, ts
func (_m *OIDCClient) UserInfo(ctx context.Context, ts oauth2.TokenSource) (*oidc.UserInfo, error) {
ret := _m.Called(ctx, ts)
if len(ret) == 0 {
panic("no return value specified for UserInfo")
}
var r0 *oidc.UserInfo
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, oauth2.TokenSource) (*oidc.UserInfo, error)); ok {
return rf(ctx, ts)
}
if rf, ok := ret.Get(0).(func(context.Context, oauth2.TokenSource) *oidc.UserInfo); ok {
r0 = rf(ctx, ts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*oidc.UserInfo)
}
}
if rf, ok := ret.Get(1).(func(context.Context, oauth2.TokenSource) error); ok {
r1 = rf(ctx, ts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// OIDCClient_UserInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UserInfo'
type OIDCClient_UserInfo_Call struct {
*mock.Call
}
// UserInfo is a helper method to define mock.On call
// - ctx context.Context
// - ts oauth2.TokenSource
func (_e *OIDCClient_Expecter) UserInfo(ctx interface{}, ts interface{}) *OIDCClient_UserInfo_Call {
return &OIDCClient_UserInfo_Call{Call: _e.mock.On("UserInfo", ctx, ts)}
}
func (_c *OIDCClient_UserInfo_Call) Run(run func(ctx context.Context, ts oauth2.TokenSource)) *OIDCClient_UserInfo_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(oauth2.TokenSource))
})
return _c
}
func (_c *OIDCClient_UserInfo_Call) Return(_a0 *oidc.UserInfo, _a1 error) *OIDCClient_UserInfo_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *OIDCClient_UserInfo_Call) RunAndReturn(run func(context.Context, oauth2.TokenSource) (*oidc.UserInfo, error)) *OIDCClient_UserInfo_Call {
_c.Call.Return(run)
return _c
}
// VerifyAccessToken provides a mock function with given fields: ctx, token
func (_m *OIDCClient) VerifyAccessToken(ctx context.Context, token string) (oidc.RegClaimsWithSID, jwt.MapClaims, error) {
ret := _m.Called(ctx, token)
if len(ret) == 0 {
panic("no return value specified for VerifyAccessToken")
}
var r0 oidc.RegClaimsWithSID
var r1 jwt.MapClaims
var r2 error
if rf, ok := ret.Get(0).(func(context.Context, string) (oidc.RegClaimsWithSID, jwt.MapClaims, error)); ok {
return rf(ctx, token)
}
if rf, ok := ret.Get(0).(func(context.Context, string) oidc.RegClaimsWithSID); ok {
r0 = rf(ctx, token)
} else {
r0 = ret.Get(0).(oidc.RegClaimsWithSID)
}
if rf, ok := ret.Get(1).(func(context.Context, string) jwt.MapClaims); ok {
r1 = rf(ctx, token)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(jwt.MapClaims)
}
}
if rf, ok := ret.Get(2).(func(context.Context, string) error); ok {
r2 = rf(ctx, token)
} else {
r2 = ret.Error(2)
}
return r0, r1, r2
}
// OIDCClient_VerifyAccessToken_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'VerifyAccessToken'
type OIDCClient_VerifyAccessToken_Call struct {
*mock.Call
}
// VerifyAccessToken is a helper method to define mock.On call
// - ctx context.Context
// - token string
func (_e *OIDCClient_Expecter) VerifyAccessToken(ctx interface{}, token interface{}) *OIDCClient_VerifyAccessToken_Call {
return &OIDCClient_VerifyAccessToken_Call{Call: _e.mock.On("VerifyAccessToken", ctx, token)}
}
func (_c *OIDCClient_VerifyAccessToken_Call) Run(run func(ctx context.Context, token string)) *OIDCClient_VerifyAccessToken_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string))
})
return _c
}
func (_c *OIDCClient_VerifyAccessToken_Call) Return(_a0 oidc.RegClaimsWithSID, _a1 jwt.MapClaims, _a2 error) *OIDCClient_VerifyAccessToken_Call {
_c.Call.Return(_a0, _a1, _a2)
return _c
}
func (_c *OIDCClient_VerifyAccessToken_Call) RunAndReturn(run func(context.Context, string) (oidc.RegClaimsWithSID, jwt.MapClaims, error)) *OIDCClient_VerifyAccessToken_Call {
_c.Call.Return(run)
return _c
}
// VerifyLogoutToken provides a mock function with given fields: ctx, token
func (_m *OIDCClient) VerifyLogoutToken(ctx context.Context, token string) (*oidc.LogoutToken, error) {
ret := _m.Called(ctx, token)
if len(ret) == 0 {
panic("no return value specified for VerifyLogoutToken")
}
var r0 *oidc.LogoutToken
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string) (*oidc.LogoutToken, error)); ok {
return rf(ctx, token)
}
if rf, ok := ret.Get(0).(func(context.Context, string) *oidc.LogoutToken); ok {
r0 = rf(ctx, token)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*oidc.LogoutToken)
}
}
if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
r1 = rf(ctx, token)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// OIDCClient_VerifyLogoutToken_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'VerifyLogoutToken'
type OIDCClient_VerifyLogoutToken_Call struct {
*mock.Call
}
// VerifyLogoutToken is a helper method to define mock.On call
// - ctx context.Context
// - token string
func (_e *OIDCClient_Expecter) VerifyLogoutToken(ctx interface{}, token interface{}) *OIDCClient_VerifyLogoutToken_Call {
return &OIDCClient_VerifyLogoutToken_Call{Call: _e.mock.On("VerifyLogoutToken", ctx, token)}
}
func (_c *OIDCClient_VerifyLogoutToken_Call) Run(run func(ctx context.Context, token string)) *OIDCClient_VerifyLogoutToken_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string))
})
return _c
}
func (_c *OIDCClient_VerifyLogoutToken_Call) Return(_a0 *oidc.LogoutToken, _a1 error) *OIDCClient_VerifyLogoutToken_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *OIDCClient_VerifyLogoutToken_Call) RunAndReturn(run func(context.Context, string) (*oidc.LogoutToken, error)) *OIDCClient_VerifyLogoutToken_Call {
_c.Call.Return(run)
return _c
}
// NewOIDCClient creates a new instance of OIDCClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewOIDCClient(t interface {
mock.TestingT
Cleanup(func())
}) *OIDCClient {
mock := &OIDCClient{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

25
protogen/.mockery.yaml Normal file
View File

@@ -0,0 +1,25 @@
with-expecter: true
filename: "{{.InterfaceName | snakecase }}.go"
dir: "{{.InterfaceDir}}/mocks"
mockname: "{{.InterfaceName}}"
outpkg: "mocks"
packages:
github.com/owncloud/ocis/v2/protogen/gen/ocis/services/eventhistory/v0:
interfaces:
EventHistoryService:
github.com/owncloud/ocis/v2/protogen/gen/ocis/services/policies/v0:
interfaces:
PoliciesProviderService:
github.com/owncloud/ocis/v2/protogen/gen/ocis/services/search/v0:
interfaces:
SearchProviderService:
github.com/owncloud/ocis/v2/protogen/gen/ocis/services/settings/v0:
interfaces:
ValueService:
github.com/owncloud/ocis/v2/protogen/gen/ocis/services/store/v0:
interfaces:
StoreService:
github.com/owncloud/ocis/v2/protogen/gen/ocis/services/thumbnails/v0:
interfaces:
ThumbnailService:

13
protogen/Makefile Normal file
View File

@@ -0,0 +1,13 @@
include ../.make/recursion.mk
############ tooling ############
ifneq (, $(shell command -v go 2> /dev/null)) # suppress `command not found warnings` for non go targets in CI
include ../.bingo/Variables.mk
endif
############ generate ############
include ../.make/generate.mk
.PHONY: ci-go-generate
ci-go-generate: $(MOCKERY) # CI runs ci-node-generate automatically before this target
$(MOCKERY)

View File

@@ -0,0 +1,188 @@
// Code generated by mockery v2.40.1. DO NOT EDIT.
package mocks
import (
context "context"
client "go-micro.dev/v4/client"
mock "github.com/stretchr/testify/mock"
v0 "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/eventhistory/v0"
)
// EventHistoryService is an autogenerated mock type for the EventHistoryService type
type EventHistoryService struct {
mock.Mock
}
type EventHistoryService_Expecter struct {
mock *mock.Mock
}
func (_m *EventHistoryService) EXPECT() *EventHistoryService_Expecter {
return &EventHistoryService_Expecter{mock: &_m.Mock}
}
// GetEvents provides a mock function with given fields: ctx, in, opts
func (_m *EventHistoryService) GetEvents(ctx context.Context, in *v0.GetEventsRequest, opts ...client.CallOption) (*v0.GetEventsResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for GetEvents")
}
var r0 *v0.GetEventsResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.GetEventsRequest, ...client.CallOption) (*v0.GetEventsResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *v0.GetEventsRequest, ...client.CallOption) *v0.GetEventsResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v0.GetEventsResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v0.GetEventsRequest, ...client.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// EventHistoryService_GetEvents_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEvents'
type EventHistoryService_GetEvents_Call struct {
*mock.Call
}
// GetEvents is a helper method to define mock.On call
// - ctx context.Context
// - in *v0.GetEventsRequest
// - opts ...client.CallOption
func (_e *EventHistoryService_Expecter) GetEvents(ctx interface{}, in interface{}, opts ...interface{}) *EventHistoryService_GetEvents_Call {
return &EventHistoryService_GetEvents_Call{Call: _e.mock.On("GetEvents",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *EventHistoryService_GetEvents_Call) Run(run func(ctx context.Context, in *v0.GetEventsRequest, opts ...client.CallOption)) *EventHistoryService_GetEvents_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]client.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(client.CallOption)
}
}
run(args[0].(context.Context), args[1].(*v0.GetEventsRequest), variadicArgs...)
})
return _c
}
func (_c *EventHistoryService_GetEvents_Call) Return(_a0 *v0.GetEventsResponse, _a1 error) *EventHistoryService_GetEvents_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *EventHistoryService_GetEvents_Call) RunAndReturn(run func(context.Context, *v0.GetEventsRequest, ...client.CallOption) (*v0.GetEventsResponse, error)) *EventHistoryService_GetEvents_Call {
_c.Call.Return(run)
return _c
}
// GetEventsForUser provides a mock function with given fields: ctx, in, opts
func (_m *EventHistoryService) GetEventsForUser(ctx context.Context, in *v0.GetEventsForUserRequest, opts ...client.CallOption) (*v0.GetEventsResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for GetEventsForUser")
}
var r0 *v0.GetEventsResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.GetEventsForUserRequest, ...client.CallOption) (*v0.GetEventsResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *v0.GetEventsForUserRequest, ...client.CallOption) *v0.GetEventsResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v0.GetEventsResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v0.GetEventsForUserRequest, ...client.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// EventHistoryService_GetEventsForUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEventsForUser'
type EventHistoryService_GetEventsForUser_Call struct {
*mock.Call
}
// GetEventsForUser is a helper method to define mock.On call
// - ctx context.Context
// - in *v0.GetEventsForUserRequest
// - opts ...client.CallOption
func (_e *EventHistoryService_Expecter) GetEventsForUser(ctx interface{}, in interface{}, opts ...interface{}) *EventHistoryService_GetEventsForUser_Call {
return &EventHistoryService_GetEventsForUser_Call{Call: _e.mock.On("GetEventsForUser",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *EventHistoryService_GetEventsForUser_Call) Run(run func(ctx context.Context, in *v0.GetEventsForUserRequest, opts ...client.CallOption)) *EventHistoryService_GetEventsForUser_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]client.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(client.CallOption)
}
}
run(args[0].(context.Context), args[1].(*v0.GetEventsForUserRequest), variadicArgs...)
})
return _c
}
func (_c *EventHistoryService_GetEventsForUser_Call) Return(_a0 *v0.GetEventsResponse, _a1 error) *EventHistoryService_GetEventsForUser_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *EventHistoryService_GetEventsForUser_Call) RunAndReturn(run func(context.Context, *v0.GetEventsForUserRequest, ...client.CallOption) (*v0.GetEventsResponse, error)) *EventHistoryService_GetEventsForUser_Call {
_c.Call.Return(run)
return _c
}
// NewEventHistoryService creates a new instance of EventHistoryService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewEventHistoryService(t interface {
mock.TestingT
Cleanup(func())
}) *EventHistoryService {
mock := &EventHistoryService{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,114 @@
// Code generated by mockery v2.40.1. DO NOT EDIT.
package mocks
import (
context "context"
client "go-micro.dev/v4/client"
mock "github.com/stretchr/testify/mock"
v0 "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/policies/v0"
)
// PoliciesProviderService is an autogenerated mock type for the PoliciesProviderService type
type PoliciesProviderService struct {
mock.Mock
}
type PoliciesProviderService_Expecter struct {
mock *mock.Mock
}
func (_m *PoliciesProviderService) EXPECT() *PoliciesProviderService_Expecter {
return &PoliciesProviderService_Expecter{mock: &_m.Mock}
}
// Evaluate provides a mock function with given fields: ctx, in, opts
func (_m *PoliciesProviderService) Evaluate(ctx context.Context, in *v0.EvaluateRequest, opts ...client.CallOption) (*v0.EvaluateResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for Evaluate")
}
var r0 *v0.EvaluateResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.EvaluateRequest, ...client.CallOption) (*v0.EvaluateResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *v0.EvaluateRequest, ...client.CallOption) *v0.EvaluateResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v0.EvaluateResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v0.EvaluateRequest, ...client.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// PoliciesProviderService_Evaluate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Evaluate'
type PoliciesProviderService_Evaluate_Call struct {
*mock.Call
}
// Evaluate is a helper method to define mock.On call
// - ctx context.Context
// - in *v0.EvaluateRequest
// - opts ...client.CallOption
func (_e *PoliciesProviderService_Expecter) Evaluate(ctx interface{}, in interface{}, opts ...interface{}) *PoliciesProviderService_Evaluate_Call {
return &PoliciesProviderService_Evaluate_Call{Call: _e.mock.On("Evaluate",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *PoliciesProviderService_Evaluate_Call) Run(run func(ctx context.Context, in *v0.EvaluateRequest, opts ...client.CallOption)) *PoliciesProviderService_Evaluate_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]client.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(client.CallOption)
}
}
run(args[0].(context.Context), args[1].(*v0.EvaluateRequest), variadicArgs...)
})
return _c
}
func (_c *PoliciesProviderService_Evaluate_Call) Return(_a0 *v0.EvaluateResponse, _a1 error) *PoliciesProviderService_Evaluate_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *PoliciesProviderService_Evaluate_Call) RunAndReturn(run func(context.Context, *v0.EvaluateRequest, ...client.CallOption) (*v0.EvaluateResponse, error)) *PoliciesProviderService_Evaluate_Call {
_c.Call.Return(run)
return _c
}
// NewPoliciesProviderService creates a new instance of PoliciesProviderService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewPoliciesProviderService(t interface {
mock.TestingT
Cleanup(func())
}) *PoliciesProviderService {
mock := &PoliciesProviderService{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,188 @@
// Code generated by mockery v2.40.1. DO NOT EDIT.
package mocks
import (
context "context"
client "go-micro.dev/v4/client"
mock "github.com/stretchr/testify/mock"
v0 "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/search/v0"
)
// SearchProviderService is an autogenerated mock type for the SearchProviderService type
type SearchProviderService struct {
mock.Mock
}
type SearchProviderService_Expecter struct {
mock *mock.Mock
}
func (_m *SearchProviderService) EXPECT() *SearchProviderService_Expecter {
return &SearchProviderService_Expecter{mock: &_m.Mock}
}
// IndexSpace provides a mock function with given fields: ctx, in, opts
func (_m *SearchProviderService) IndexSpace(ctx context.Context, in *v0.IndexSpaceRequest, opts ...client.CallOption) (*v0.IndexSpaceResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for IndexSpace")
}
var r0 *v0.IndexSpaceResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.IndexSpaceRequest, ...client.CallOption) (*v0.IndexSpaceResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *v0.IndexSpaceRequest, ...client.CallOption) *v0.IndexSpaceResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v0.IndexSpaceResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v0.IndexSpaceRequest, ...client.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SearchProviderService_IndexSpace_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IndexSpace'
type SearchProviderService_IndexSpace_Call struct {
*mock.Call
}
// IndexSpace is a helper method to define mock.On call
// - ctx context.Context
// - in *v0.IndexSpaceRequest
// - opts ...client.CallOption
func (_e *SearchProviderService_Expecter) IndexSpace(ctx interface{}, in interface{}, opts ...interface{}) *SearchProviderService_IndexSpace_Call {
return &SearchProviderService_IndexSpace_Call{Call: _e.mock.On("IndexSpace",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *SearchProviderService_IndexSpace_Call) Run(run func(ctx context.Context, in *v0.IndexSpaceRequest, opts ...client.CallOption)) *SearchProviderService_IndexSpace_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]client.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(client.CallOption)
}
}
run(args[0].(context.Context), args[1].(*v0.IndexSpaceRequest), variadicArgs...)
})
return _c
}
func (_c *SearchProviderService_IndexSpace_Call) Return(_a0 *v0.IndexSpaceResponse, _a1 error) *SearchProviderService_IndexSpace_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *SearchProviderService_IndexSpace_Call) RunAndReturn(run func(context.Context, *v0.IndexSpaceRequest, ...client.CallOption) (*v0.IndexSpaceResponse, error)) *SearchProviderService_IndexSpace_Call {
_c.Call.Return(run)
return _c
}
// Search provides a mock function with given fields: ctx, in, opts
func (_m *SearchProviderService) Search(ctx context.Context, in *v0.SearchRequest, opts ...client.CallOption) (*v0.SearchResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for Search")
}
var r0 *v0.SearchResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.SearchRequest, ...client.CallOption) (*v0.SearchResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *v0.SearchRequest, ...client.CallOption) *v0.SearchResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v0.SearchResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v0.SearchRequest, ...client.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SearchProviderService_Search_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Search'
type SearchProviderService_Search_Call struct {
*mock.Call
}
// Search is a helper method to define mock.On call
// - ctx context.Context
// - in *v0.SearchRequest
// - opts ...client.CallOption
func (_e *SearchProviderService_Expecter) Search(ctx interface{}, in interface{}, opts ...interface{}) *SearchProviderService_Search_Call {
return &SearchProviderService_Search_Call{Call: _e.mock.On("Search",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *SearchProviderService_Search_Call) Run(run func(ctx context.Context, in *v0.SearchRequest, opts ...client.CallOption)) *SearchProviderService_Search_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]client.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(client.CallOption)
}
}
run(args[0].(context.Context), args[1].(*v0.SearchRequest), variadicArgs...)
})
return _c
}
func (_c *SearchProviderService_Search_Call) Return(_a0 *v0.SearchResponse, _a1 error) *SearchProviderService_Search_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *SearchProviderService_Search_Call) RunAndReturn(run func(context.Context, *v0.SearchRequest, ...client.CallOption) (*v0.SearchResponse, error)) *SearchProviderService_Search_Call {
_c.Call.Return(run)
return _c
}
// NewSearchProviderService creates a new instance of SearchProviderService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewSearchProviderService(t interface {
mock.TestingT
Cleanup(func())
}) *SearchProviderService {
mock := &SearchProviderService{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,336 @@
// Code generated by mockery v2.40.1. DO NOT EDIT.
package mocks
import (
context "context"
client "go-micro.dev/v4/client"
mock "github.com/stretchr/testify/mock"
v0 "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/settings/v0"
)
// ValueService is an autogenerated mock type for the ValueService type
type ValueService struct {
mock.Mock
}
type ValueService_Expecter struct {
mock *mock.Mock
}
func (_m *ValueService) EXPECT() *ValueService_Expecter {
return &ValueService_Expecter{mock: &_m.Mock}
}
// GetValue provides a mock function with given fields: ctx, in, opts
func (_m *ValueService) GetValue(ctx context.Context, in *v0.GetValueRequest, opts ...client.CallOption) (*v0.GetValueResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for GetValue")
}
var r0 *v0.GetValueResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.GetValueRequest, ...client.CallOption) (*v0.GetValueResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *v0.GetValueRequest, ...client.CallOption) *v0.GetValueResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v0.GetValueResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v0.GetValueRequest, ...client.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ValueService_GetValue_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetValue'
type ValueService_GetValue_Call struct {
*mock.Call
}
// GetValue is a helper method to define mock.On call
// - ctx context.Context
// - in *v0.GetValueRequest
// - opts ...client.CallOption
func (_e *ValueService_Expecter) GetValue(ctx interface{}, in interface{}, opts ...interface{}) *ValueService_GetValue_Call {
return &ValueService_GetValue_Call{Call: _e.mock.On("GetValue",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *ValueService_GetValue_Call) Run(run func(ctx context.Context, in *v0.GetValueRequest, opts ...client.CallOption)) *ValueService_GetValue_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]client.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(client.CallOption)
}
}
run(args[0].(context.Context), args[1].(*v0.GetValueRequest), variadicArgs...)
})
return _c
}
func (_c *ValueService_GetValue_Call) Return(_a0 *v0.GetValueResponse, _a1 error) *ValueService_GetValue_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *ValueService_GetValue_Call) RunAndReturn(run func(context.Context, *v0.GetValueRequest, ...client.CallOption) (*v0.GetValueResponse, error)) *ValueService_GetValue_Call {
_c.Call.Return(run)
return _c
}
// GetValueByUniqueIdentifiers provides a mock function with given fields: ctx, in, opts
func (_m *ValueService) GetValueByUniqueIdentifiers(ctx context.Context, in *v0.GetValueByUniqueIdentifiersRequest, opts ...client.CallOption) (*v0.GetValueResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for GetValueByUniqueIdentifiers")
}
var r0 *v0.GetValueResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.GetValueByUniqueIdentifiersRequest, ...client.CallOption) (*v0.GetValueResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *v0.GetValueByUniqueIdentifiersRequest, ...client.CallOption) *v0.GetValueResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v0.GetValueResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v0.GetValueByUniqueIdentifiersRequest, ...client.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ValueService_GetValueByUniqueIdentifiers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetValueByUniqueIdentifiers'
type ValueService_GetValueByUniqueIdentifiers_Call struct {
*mock.Call
}
// GetValueByUniqueIdentifiers is a helper method to define mock.On call
// - ctx context.Context
// - in *v0.GetValueByUniqueIdentifiersRequest
// - opts ...client.CallOption
func (_e *ValueService_Expecter) GetValueByUniqueIdentifiers(ctx interface{}, in interface{}, opts ...interface{}) *ValueService_GetValueByUniqueIdentifiers_Call {
return &ValueService_GetValueByUniqueIdentifiers_Call{Call: _e.mock.On("GetValueByUniqueIdentifiers",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *ValueService_GetValueByUniqueIdentifiers_Call) Run(run func(ctx context.Context, in *v0.GetValueByUniqueIdentifiersRequest, opts ...client.CallOption)) *ValueService_GetValueByUniqueIdentifiers_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]client.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(client.CallOption)
}
}
run(args[0].(context.Context), args[1].(*v0.GetValueByUniqueIdentifiersRequest), variadicArgs...)
})
return _c
}
func (_c *ValueService_GetValueByUniqueIdentifiers_Call) Return(_a0 *v0.GetValueResponse, _a1 error) *ValueService_GetValueByUniqueIdentifiers_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *ValueService_GetValueByUniqueIdentifiers_Call) RunAndReturn(run func(context.Context, *v0.GetValueByUniqueIdentifiersRequest, ...client.CallOption) (*v0.GetValueResponse, error)) *ValueService_GetValueByUniqueIdentifiers_Call {
_c.Call.Return(run)
return _c
}
// ListValues provides a mock function with given fields: ctx, in, opts
func (_m *ValueService) ListValues(ctx context.Context, in *v0.ListValuesRequest, opts ...client.CallOption) (*v0.ListValuesResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for ListValues")
}
var r0 *v0.ListValuesResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.ListValuesRequest, ...client.CallOption) (*v0.ListValuesResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *v0.ListValuesRequest, ...client.CallOption) *v0.ListValuesResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v0.ListValuesResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v0.ListValuesRequest, ...client.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ValueService_ListValues_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListValues'
type ValueService_ListValues_Call struct {
*mock.Call
}
// ListValues is a helper method to define mock.On call
// - ctx context.Context
// - in *v0.ListValuesRequest
// - opts ...client.CallOption
func (_e *ValueService_Expecter) ListValues(ctx interface{}, in interface{}, opts ...interface{}) *ValueService_ListValues_Call {
return &ValueService_ListValues_Call{Call: _e.mock.On("ListValues",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *ValueService_ListValues_Call) Run(run func(ctx context.Context, in *v0.ListValuesRequest, opts ...client.CallOption)) *ValueService_ListValues_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]client.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(client.CallOption)
}
}
run(args[0].(context.Context), args[1].(*v0.ListValuesRequest), variadicArgs...)
})
return _c
}
func (_c *ValueService_ListValues_Call) Return(_a0 *v0.ListValuesResponse, _a1 error) *ValueService_ListValues_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *ValueService_ListValues_Call) RunAndReturn(run func(context.Context, *v0.ListValuesRequest, ...client.CallOption) (*v0.ListValuesResponse, error)) *ValueService_ListValues_Call {
_c.Call.Return(run)
return _c
}
// SaveValue provides a mock function with given fields: ctx, in, opts
func (_m *ValueService) SaveValue(ctx context.Context, in *v0.SaveValueRequest, opts ...client.CallOption) (*v0.SaveValueResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for SaveValue")
}
var r0 *v0.SaveValueResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.SaveValueRequest, ...client.CallOption) (*v0.SaveValueResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *v0.SaveValueRequest, ...client.CallOption) *v0.SaveValueResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v0.SaveValueResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v0.SaveValueRequest, ...client.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ValueService_SaveValue_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SaveValue'
type ValueService_SaveValue_Call struct {
*mock.Call
}
// SaveValue is a helper method to define mock.On call
// - ctx context.Context
// - in *v0.SaveValueRequest
// - opts ...client.CallOption
func (_e *ValueService_Expecter) SaveValue(ctx interface{}, in interface{}, opts ...interface{}) *ValueService_SaveValue_Call {
return &ValueService_SaveValue_Call{Call: _e.mock.On("SaveValue",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *ValueService_SaveValue_Call) Run(run func(ctx context.Context, in *v0.SaveValueRequest, opts ...client.CallOption)) *ValueService_SaveValue_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]client.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(client.CallOption)
}
}
run(args[0].(context.Context), args[1].(*v0.SaveValueRequest), variadicArgs...)
})
return _c
}
func (_c *ValueService_SaveValue_Call) Return(_a0 *v0.SaveValueResponse, _a1 error) *ValueService_SaveValue_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *ValueService_SaveValue_Call) RunAndReturn(run func(context.Context, *v0.SaveValueRequest, ...client.CallOption) (*v0.SaveValueResponse, error)) *ValueService_SaveValue_Call {
_c.Call.Return(run)
return _c
}
// NewValueService creates a new instance of ValueService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewValueService(t interface {
mock.TestingT
Cleanup(func())
}) *ValueService {
mock := &ValueService{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,484 @@
// Code generated by mockery v2.40.1. DO NOT EDIT.
package mocks
import (
context "context"
client "go-micro.dev/v4/client"
mock "github.com/stretchr/testify/mock"
v0 "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/store/v0"
)
// StoreService is an autogenerated mock type for the StoreService type
type StoreService struct {
mock.Mock
}
type StoreService_Expecter struct {
mock *mock.Mock
}
func (_m *StoreService) EXPECT() *StoreService_Expecter {
return &StoreService_Expecter{mock: &_m.Mock}
}
// Databases provides a mock function with given fields: ctx, in, opts
func (_m *StoreService) Databases(ctx context.Context, in *v0.DatabasesRequest, opts ...client.CallOption) (*v0.DatabasesResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for Databases")
}
var r0 *v0.DatabasesResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.DatabasesRequest, ...client.CallOption) (*v0.DatabasesResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *v0.DatabasesRequest, ...client.CallOption) *v0.DatabasesResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v0.DatabasesResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v0.DatabasesRequest, ...client.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// StoreService_Databases_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Databases'
type StoreService_Databases_Call struct {
*mock.Call
}
// Databases is a helper method to define mock.On call
// - ctx context.Context
// - in *v0.DatabasesRequest
// - opts ...client.CallOption
func (_e *StoreService_Expecter) Databases(ctx interface{}, in interface{}, opts ...interface{}) *StoreService_Databases_Call {
return &StoreService_Databases_Call{Call: _e.mock.On("Databases",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *StoreService_Databases_Call) Run(run func(ctx context.Context, in *v0.DatabasesRequest, opts ...client.CallOption)) *StoreService_Databases_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]client.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(client.CallOption)
}
}
run(args[0].(context.Context), args[1].(*v0.DatabasesRequest), variadicArgs...)
})
return _c
}
func (_c *StoreService_Databases_Call) Return(_a0 *v0.DatabasesResponse, _a1 error) *StoreService_Databases_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *StoreService_Databases_Call) RunAndReturn(run func(context.Context, *v0.DatabasesRequest, ...client.CallOption) (*v0.DatabasesResponse, error)) *StoreService_Databases_Call {
_c.Call.Return(run)
return _c
}
// Delete provides a mock function with given fields: ctx, in, opts
func (_m *StoreService) Delete(ctx context.Context, in *v0.DeleteRequest, opts ...client.CallOption) (*v0.DeleteResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for Delete")
}
var r0 *v0.DeleteResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.DeleteRequest, ...client.CallOption) (*v0.DeleteResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *v0.DeleteRequest, ...client.CallOption) *v0.DeleteResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v0.DeleteResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v0.DeleteRequest, ...client.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// StoreService_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete'
type StoreService_Delete_Call struct {
*mock.Call
}
// Delete is a helper method to define mock.On call
// - ctx context.Context
// - in *v0.DeleteRequest
// - opts ...client.CallOption
func (_e *StoreService_Expecter) Delete(ctx interface{}, in interface{}, opts ...interface{}) *StoreService_Delete_Call {
return &StoreService_Delete_Call{Call: _e.mock.On("Delete",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *StoreService_Delete_Call) Run(run func(ctx context.Context, in *v0.DeleteRequest, opts ...client.CallOption)) *StoreService_Delete_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]client.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(client.CallOption)
}
}
run(args[0].(context.Context), args[1].(*v0.DeleteRequest), variadicArgs...)
})
return _c
}
func (_c *StoreService_Delete_Call) Return(_a0 *v0.DeleteResponse, _a1 error) *StoreService_Delete_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *StoreService_Delete_Call) RunAndReturn(run func(context.Context, *v0.DeleteRequest, ...client.CallOption) (*v0.DeleteResponse, error)) *StoreService_Delete_Call {
_c.Call.Return(run)
return _c
}
// List provides a mock function with given fields: ctx, in, opts
func (_m *StoreService) List(ctx context.Context, in *v0.ListRequest, opts ...client.CallOption) (v0.Store_ListService, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for List")
}
var r0 v0.Store_ListService
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.ListRequest, ...client.CallOption) (v0.Store_ListService, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *v0.ListRequest, ...client.CallOption) v0.Store_ListService); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(v0.Store_ListService)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v0.ListRequest, ...client.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// StoreService_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List'
type StoreService_List_Call struct {
*mock.Call
}
// List is a helper method to define mock.On call
// - ctx context.Context
// - in *v0.ListRequest
// - opts ...client.CallOption
func (_e *StoreService_Expecter) List(ctx interface{}, in interface{}, opts ...interface{}) *StoreService_List_Call {
return &StoreService_List_Call{Call: _e.mock.On("List",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *StoreService_List_Call) Run(run func(ctx context.Context, in *v0.ListRequest, opts ...client.CallOption)) *StoreService_List_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]client.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(client.CallOption)
}
}
run(args[0].(context.Context), args[1].(*v0.ListRequest), variadicArgs...)
})
return _c
}
func (_c *StoreService_List_Call) Return(_a0 v0.Store_ListService, _a1 error) *StoreService_List_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *StoreService_List_Call) RunAndReturn(run func(context.Context, *v0.ListRequest, ...client.CallOption) (v0.Store_ListService, error)) *StoreService_List_Call {
_c.Call.Return(run)
return _c
}
// Read provides a mock function with given fields: ctx, in, opts
func (_m *StoreService) Read(ctx context.Context, in *v0.ReadRequest, opts ...client.CallOption) (*v0.ReadResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for Read")
}
var r0 *v0.ReadResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.ReadRequest, ...client.CallOption) (*v0.ReadResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *v0.ReadRequest, ...client.CallOption) *v0.ReadResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v0.ReadResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v0.ReadRequest, ...client.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// StoreService_Read_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Read'
type StoreService_Read_Call struct {
*mock.Call
}
// Read is a helper method to define mock.On call
// - ctx context.Context
// - in *v0.ReadRequest
// - opts ...client.CallOption
func (_e *StoreService_Expecter) Read(ctx interface{}, in interface{}, opts ...interface{}) *StoreService_Read_Call {
return &StoreService_Read_Call{Call: _e.mock.On("Read",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *StoreService_Read_Call) Run(run func(ctx context.Context, in *v0.ReadRequest, opts ...client.CallOption)) *StoreService_Read_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]client.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(client.CallOption)
}
}
run(args[0].(context.Context), args[1].(*v0.ReadRequest), variadicArgs...)
})
return _c
}
func (_c *StoreService_Read_Call) Return(_a0 *v0.ReadResponse, _a1 error) *StoreService_Read_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *StoreService_Read_Call) RunAndReturn(run func(context.Context, *v0.ReadRequest, ...client.CallOption) (*v0.ReadResponse, error)) *StoreService_Read_Call {
_c.Call.Return(run)
return _c
}
// Tables provides a mock function with given fields: ctx, in, opts
func (_m *StoreService) Tables(ctx context.Context, in *v0.TablesRequest, opts ...client.CallOption) (*v0.TablesResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for Tables")
}
var r0 *v0.TablesResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.TablesRequest, ...client.CallOption) (*v0.TablesResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *v0.TablesRequest, ...client.CallOption) *v0.TablesResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v0.TablesResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v0.TablesRequest, ...client.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// StoreService_Tables_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Tables'
type StoreService_Tables_Call struct {
*mock.Call
}
// Tables is a helper method to define mock.On call
// - ctx context.Context
// - in *v0.TablesRequest
// - opts ...client.CallOption
func (_e *StoreService_Expecter) Tables(ctx interface{}, in interface{}, opts ...interface{}) *StoreService_Tables_Call {
return &StoreService_Tables_Call{Call: _e.mock.On("Tables",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *StoreService_Tables_Call) Run(run func(ctx context.Context, in *v0.TablesRequest, opts ...client.CallOption)) *StoreService_Tables_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]client.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(client.CallOption)
}
}
run(args[0].(context.Context), args[1].(*v0.TablesRequest), variadicArgs...)
})
return _c
}
func (_c *StoreService_Tables_Call) Return(_a0 *v0.TablesResponse, _a1 error) *StoreService_Tables_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *StoreService_Tables_Call) RunAndReturn(run func(context.Context, *v0.TablesRequest, ...client.CallOption) (*v0.TablesResponse, error)) *StoreService_Tables_Call {
_c.Call.Return(run)
return _c
}
// Write provides a mock function with given fields: ctx, in, opts
func (_m *StoreService) Write(ctx context.Context, in *v0.WriteRequest, opts ...client.CallOption) (*v0.WriteResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for Write")
}
var r0 *v0.WriteResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.WriteRequest, ...client.CallOption) (*v0.WriteResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *v0.WriteRequest, ...client.CallOption) *v0.WriteResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v0.WriteResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v0.WriteRequest, ...client.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// StoreService_Write_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Write'
type StoreService_Write_Call struct {
*mock.Call
}
// Write is a helper method to define mock.On call
// - ctx context.Context
// - in *v0.WriteRequest
// - opts ...client.CallOption
func (_e *StoreService_Expecter) Write(ctx interface{}, in interface{}, opts ...interface{}) *StoreService_Write_Call {
return &StoreService_Write_Call{Call: _e.mock.On("Write",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *StoreService_Write_Call) Run(run func(ctx context.Context, in *v0.WriteRequest, opts ...client.CallOption)) *StoreService_Write_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]client.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(client.CallOption)
}
}
run(args[0].(context.Context), args[1].(*v0.WriteRequest), variadicArgs...)
})
return _c
}
func (_c *StoreService_Write_Call) Return(_a0 *v0.WriteResponse, _a1 error) *StoreService_Write_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *StoreService_Write_Call) RunAndReturn(run func(context.Context, *v0.WriteRequest, ...client.CallOption) (*v0.WriteResponse, error)) *StoreService_Write_Call {
_c.Call.Return(run)
return _c
}
// NewStoreService creates a new instance of StoreService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewStoreService(t interface {
mock.TestingT
Cleanup(func())
}) *StoreService {
mock := &StoreService{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,114 @@
// Code generated by mockery v2.40.1. DO NOT EDIT.
package mocks
import (
context "context"
client "go-micro.dev/v4/client"
mock "github.com/stretchr/testify/mock"
v0 "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/thumbnails/v0"
)
// ThumbnailService is an autogenerated mock type for the ThumbnailService type
type ThumbnailService struct {
mock.Mock
}
type ThumbnailService_Expecter struct {
mock *mock.Mock
}
func (_m *ThumbnailService) EXPECT() *ThumbnailService_Expecter {
return &ThumbnailService_Expecter{mock: &_m.Mock}
}
// GetThumbnail provides a mock function with given fields: ctx, in, opts
func (_m *ThumbnailService) GetThumbnail(ctx context.Context, in *v0.GetThumbnailRequest, opts ...client.CallOption) (*v0.GetThumbnailResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for GetThumbnail")
}
var r0 *v0.GetThumbnailResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.GetThumbnailRequest, ...client.CallOption) (*v0.GetThumbnailResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *v0.GetThumbnailRequest, ...client.CallOption) *v0.GetThumbnailResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v0.GetThumbnailResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v0.GetThumbnailRequest, ...client.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ThumbnailService_GetThumbnail_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetThumbnail'
type ThumbnailService_GetThumbnail_Call struct {
*mock.Call
}
// GetThumbnail is a helper method to define mock.On call
// - ctx context.Context
// - in *v0.GetThumbnailRequest
// - opts ...client.CallOption
func (_e *ThumbnailService_Expecter) GetThumbnail(ctx interface{}, in interface{}, opts ...interface{}) *ThumbnailService_GetThumbnail_Call {
return &ThumbnailService_GetThumbnail_Call{Call: _e.mock.On("GetThumbnail",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *ThumbnailService_GetThumbnail_Call) Run(run func(ctx context.Context, in *v0.GetThumbnailRequest, opts ...client.CallOption)) *ThumbnailService_GetThumbnail_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]client.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(client.CallOption)
}
}
run(args[0].(context.Context), args[1].(*v0.GetThumbnailRequest), variadicArgs...)
})
return _c
}
func (_c *ThumbnailService_GetThumbnail_Call) Return(_a0 *v0.GetThumbnailResponse, _a1 error) *ThumbnailService_GetThumbnail_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *ThumbnailService_GetThumbnail_Call) RunAndReturn(run func(context.Context, *v0.GetThumbnailRequest, ...client.CallOption) (*v0.GetThumbnailResponse, error)) *ThumbnailService_GetThumbnail_Call {
_c.Call.Return(run)
return _c
}
// NewThumbnailService creates a new instance of ThumbnailService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewThumbnailService(t interface {
mock.TestingT
Cleanup(func())
}) *ThumbnailService {
mock := &ThumbnailService{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -24,8 +24,7 @@ docs-generate: config-docs-generate
include ../../.make/generate.mk
.PHONY: ci-go-generate
ci-go-generate: $(MOCKERY) # CI runs ci-node-generate automatically before this target
$(MOCKERY) --dir ../../protogen/gen/ocis/services/eventhistory/v0 --case underscore --name EventHistoryService
ci-go-generate: # CI runs ci-node-generate automatically before this target
.PHONY: ci-node-generate
ci-node-generate:

View File

@@ -1,99 +0,0 @@
// Code generated by mockery v2.22.1. DO NOT EDIT.
package mocks
import (
context "context"
client "go-micro.dev/v4/client"
mock "github.com/stretchr/testify/mock"
v0 "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/eventhistory/v0"
)
// EventHistoryService is an autogenerated mock type for the EventHistoryService type
type EventHistoryService struct {
mock.Mock
}
// GetEvents provides a mock function with given fields: ctx, in, opts
func (_m *EventHistoryService) GetEvents(ctx context.Context, in *v0.GetEventsRequest, opts ...client.CallOption) (*v0.GetEventsResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *v0.GetEventsResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.GetEventsRequest, ...client.CallOption) (*v0.GetEventsResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *v0.GetEventsRequest, ...client.CallOption) *v0.GetEventsResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v0.GetEventsResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v0.GetEventsRequest, ...client.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetEventsForUser provides a mock function with given fields: ctx, in, opts
func (_m *EventHistoryService) GetEventsForUser(ctx context.Context, in *v0.GetEventsForUserRequest, opts ...client.CallOption) (*v0.GetEventsResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *v0.GetEventsResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.GetEventsForUserRequest, ...client.CallOption) (*v0.GetEventsResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *v0.GetEventsForUserRequest, ...client.CallOption) *v0.GetEventsResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v0.GetEventsResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v0.GetEventsForUserRequest, ...client.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
type mockConstructorTestingTNewEventHistoryService interface {
mock.TestingT
Cleanup(func())
}
// NewEventHistoryService creates a new instance of EventHistoryService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewEventHistoryService(t mockConstructorTestingTNewEventHistoryService) *EventHistoryService {
mock := &EventHistoryService{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,18 @@
with-expecter: true
filename: "{{.InterfaceName | snakecase }}.go"
mockname: "{{.InterfaceName}}"
outpkg: "mocks"
packages:
github.com/owncloud/ocis/v2/services/graph/pkg/identity:
config:
dir: "pkg/identity/mocks"
interfaces:
Backend:
EducationBackend:
github.com/go-ldap/ldap/v3:
config:
dir: "pkg/identity/mocks"
interfaces:
Client:
config:
filename: "ldapclient.go"

View File

@@ -25,14 +25,7 @@ include ../../.make/generate.mk
.PHONY: ci-go-generate
ci-go-generate: $(MOCKERY) # CI runs ci-node-generate automatically before this target
$(MOCKERY) --dir pkg/service/v0 --case underscore --name HTTPClient
$(MOCKERY) --dir pkg/service/v0 --case underscore --name Publisher
$(MOCKERY) --dir pkg/service/v0 --case underscore --name Permissions
$(MOCKERY) --dir pkg/service/v0 --case underscore --name RoleService
$(MOCKERY) --dir pkg/identity --output pkg/identity/mocks --case underscore --name Backend
$(MOCKERY) --dir pkg/identity --output pkg/identity/mocks --case underscore --name EducationBackend
$(MOCKERY) --srcpkg github.com/go-ldap/ldap/v3 --case underscore --filename ldapclient.go --name Client
$(MOCKERY)
.PHONY: ci-node-generate
ci-node-generate:

View File

@@ -1,456 +0,0 @@
// Code generated by mockery v2.22.1. DO NOT EDIT.
package mocks
import (
context "context"
gatewayv1beta1 "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1"
grpc "google.golang.org/grpc"
mock "github.com/stretchr/testify/mock"
providerv1beta1 "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
)
// GatewayClient is an autogenerated mock type for the GatewayClient type
type GatewayClient struct {
mock.Mock
}
// Authenticate provides a mock function with given fields: ctx, in, opts
func (_m *GatewayClient) Authenticate(ctx context.Context, in *gatewayv1beta1.AuthenticateRequest, opts ...grpc.CallOption) (*gatewayv1beta1.AuthenticateResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *gatewayv1beta1.AuthenticateResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *gatewayv1beta1.AuthenticateRequest, ...grpc.CallOption) (*gatewayv1beta1.AuthenticateResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *gatewayv1beta1.AuthenticateRequest, ...grpc.CallOption) *gatewayv1beta1.AuthenticateResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*gatewayv1beta1.AuthenticateResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *gatewayv1beta1.AuthenticateRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// CreateStorageSpace provides a mock function with given fields: ctx, in, opts
func (_m *GatewayClient) CreateStorageSpace(ctx context.Context, in *providerv1beta1.CreateStorageSpaceRequest, opts ...grpc.CallOption) (*providerv1beta1.CreateStorageSpaceResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *providerv1beta1.CreateStorageSpaceResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.CreateStorageSpaceRequest, ...grpc.CallOption) (*providerv1beta1.CreateStorageSpaceResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.CreateStorageSpaceRequest, ...grpc.CallOption) *providerv1beta1.CreateStorageSpaceResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*providerv1beta1.CreateStorageSpaceResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *providerv1beta1.CreateStorageSpaceRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// DeleteStorageSpace provides a mock function with given fields: ctx, in, opts
func (_m *GatewayClient) DeleteStorageSpace(ctx context.Context, in *providerv1beta1.DeleteStorageSpaceRequest, opts ...grpc.CallOption) (*providerv1beta1.DeleteStorageSpaceResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *providerv1beta1.DeleteStorageSpaceResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.DeleteStorageSpaceRequest, ...grpc.CallOption) (*providerv1beta1.DeleteStorageSpaceResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.DeleteStorageSpaceRequest, ...grpc.CallOption) *providerv1beta1.DeleteStorageSpaceResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*providerv1beta1.DeleteStorageSpaceResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *providerv1beta1.DeleteStorageSpaceRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetHome provides a mock function with given fields: ctx, in, opts
func (_m *GatewayClient) GetHome(ctx context.Context, in *providerv1beta1.GetHomeRequest, opts ...grpc.CallOption) (*providerv1beta1.GetHomeResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *providerv1beta1.GetHomeResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.GetHomeRequest, ...grpc.CallOption) (*providerv1beta1.GetHomeResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.GetHomeRequest, ...grpc.CallOption) *providerv1beta1.GetHomeResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*providerv1beta1.GetHomeResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *providerv1beta1.GetHomeRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetPath provides a mock function with given fields: ctx, in, opts
func (_m *GatewayClient) GetPath(ctx context.Context, in *providerv1beta1.GetPathRequest, opts ...grpc.CallOption) (*providerv1beta1.GetPathResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *providerv1beta1.GetPathResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.GetPathRequest, ...grpc.CallOption) (*providerv1beta1.GetPathResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.GetPathRequest, ...grpc.CallOption) *providerv1beta1.GetPathResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*providerv1beta1.GetPathResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *providerv1beta1.GetPathRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetQuota provides a mock function with given fields: ctx, in, opts
func (_m *GatewayClient) GetQuota(ctx context.Context, in *gatewayv1beta1.GetQuotaRequest, opts ...grpc.CallOption) (*providerv1beta1.GetQuotaResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *providerv1beta1.GetQuotaResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *gatewayv1beta1.GetQuotaRequest, ...grpc.CallOption) (*providerv1beta1.GetQuotaResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *gatewayv1beta1.GetQuotaRequest, ...grpc.CallOption) *providerv1beta1.GetQuotaResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*providerv1beta1.GetQuotaResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *gatewayv1beta1.GetQuotaRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// InitiateFileDownload provides a mock function with given fields: ctx, in, opts
func (_m *GatewayClient) InitiateFileDownload(ctx context.Context, in *providerv1beta1.InitiateFileDownloadRequest, opts ...grpc.CallOption) (*gatewayv1beta1.InitiateFileDownloadResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *gatewayv1beta1.InitiateFileDownloadResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.InitiateFileDownloadRequest, ...grpc.CallOption) (*gatewayv1beta1.InitiateFileDownloadResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.InitiateFileDownloadRequest, ...grpc.CallOption) *gatewayv1beta1.InitiateFileDownloadResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*gatewayv1beta1.InitiateFileDownloadResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *providerv1beta1.InitiateFileDownloadRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ListContainer provides a mock function with given fields: ctx, in, opts
func (_m *GatewayClient) ListContainer(ctx context.Context, in *providerv1beta1.ListContainerRequest, opts ...grpc.CallOption) (*providerv1beta1.ListContainerResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *providerv1beta1.ListContainerResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.ListContainerRequest, ...grpc.CallOption) (*providerv1beta1.ListContainerResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.ListContainerRequest, ...grpc.CallOption) *providerv1beta1.ListContainerResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*providerv1beta1.ListContainerResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *providerv1beta1.ListContainerRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ListStorageSpaces provides a mock function with given fields: ctx, in, opts
func (_m *GatewayClient) ListStorageSpaces(ctx context.Context, in *providerv1beta1.ListStorageSpacesRequest, opts ...grpc.CallOption) (*providerv1beta1.ListStorageSpacesResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *providerv1beta1.ListStorageSpacesResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.ListStorageSpacesRequest, ...grpc.CallOption) (*providerv1beta1.ListStorageSpacesResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.ListStorageSpacesRequest, ...grpc.CallOption) *providerv1beta1.ListStorageSpacesResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*providerv1beta1.ListStorageSpacesResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *providerv1beta1.ListStorageSpacesRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SetArbitraryMetadata provides a mock function with given fields: ctx, request, opts
func (_m *GatewayClient) SetArbitraryMetadata(ctx context.Context, request *providerv1beta1.SetArbitraryMetadataRequest, opts ...grpc.CallOption) (*providerv1beta1.SetArbitraryMetadataResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, request)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *providerv1beta1.SetArbitraryMetadataResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.SetArbitraryMetadataRequest, ...grpc.CallOption) (*providerv1beta1.SetArbitraryMetadataResponse, error)); ok {
return rf(ctx, request, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.SetArbitraryMetadataRequest, ...grpc.CallOption) *providerv1beta1.SetArbitraryMetadataResponse); ok {
r0 = rf(ctx, request, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*providerv1beta1.SetArbitraryMetadataResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *providerv1beta1.SetArbitraryMetadataRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, request, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Stat provides a mock function with given fields: ctx, in, opts
func (_m *GatewayClient) Stat(ctx context.Context, in *providerv1beta1.StatRequest, opts ...grpc.CallOption) (*providerv1beta1.StatResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *providerv1beta1.StatResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.StatRequest, ...grpc.CallOption) (*providerv1beta1.StatResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.StatRequest, ...grpc.CallOption) *providerv1beta1.StatResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*providerv1beta1.StatResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *providerv1beta1.StatRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// TouchFile provides a mock function with given fields: ctx, req
func (_m *GatewayClient) TouchFile(ctx context.Context, req *providerv1beta1.TouchFileRequest) (*providerv1beta1.TouchFileResponse, error) {
ret := _m.Called(ctx, req)
var r0 *providerv1beta1.TouchFileResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.TouchFileRequest) (*providerv1beta1.TouchFileResponse, error)); ok {
return rf(ctx, req)
}
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.TouchFileRequest) *providerv1beta1.TouchFileResponse); ok {
r0 = rf(ctx, req)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*providerv1beta1.TouchFileResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *providerv1beta1.TouchFileRequest) error); ok {
r1 = rf(ctx, req)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// UpdateStorageSpace provides a mock function with given fields: ctx, in, opts
func (_m *GatewayClient) UpdateStorageSpace(ctx context.Context, in *providerv1beta1.UpdateStorageSpaceRequest, opts ...grpc.CallOption) (*providerv1beta1.UpdateStorageSpaceResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *providerv1beta1.UpdateStorageSpaceResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.UpdateStorageSpaceRequest, ...grpc.CallOption) (*providerv1beta1.UpdateStorageSpaceResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.UpdateStorageSpaceRequest, ...grpc.CallOption) *providerv1beta1.UpdateStorageSpaceResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*providerv1beta1.UpdateStorageSpaceResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *providerv1beta1.UpdateStorageSpaceRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
type mockConstructorTestingTNewGatewayClient interface {
mock.TestingT
Cleanup(func())
}
// NewGatewayClient creates a new instance of GatewayClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewGatewayClient(t mockConstructorTestingTNewGatewayClient) *GatewayClient {
mock := &GatewayClient{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -1,4 +1,4 @@
// Code generated by mockery v2.22.1. DO NOT EDIT.
// Code generated by mockery v2.40.1. DO NOT EDIT.
package mocks
@@ -13,10 +13,22 @@ type HTTPClient struct {
mock.Mock
}
type HTTPClient_Expecter struct {
mock *mock.Mock
}
func (_m *HTTPClient) EXPECT() *HTTPClient_Expecter {
return &HTTPClient_Expecter{mock: &_m.Mock}
}
// Do provides a mock function with given fields: req
func (_m *HTTPClient) Do(req *http.Request) (*http.Response, error) {
ret := _m.Called(req)
if len(ret) == 0 {
panic("no return value specified for Do")
}
var r0 *http.Response
var r1 error
if rf, ok := ret.Get(0).(func(*http.Request) (*http.Response, error)); ok {
@@ -39,13 +51,40 @@ func (_m *HTTPClient) Do(req *http.Request) (*http.Response, error) {
return r0, r1
}
type mockConstructorTestingTNewHTTPClient interface {
mock.TestingT
Cleanup(func())
// HTTPClient_Do_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Do'
type HTTPClient_Do_Call struct {
*mock.Call
}
// Do is a helper method to define mock.On call
// - req *http.Request
func (_e *HTTPClient_Expecter) Do(req interface{}) *HTTPClient_Do_Call {
return &HTTPClient_Do_Call{Call: _e.mock.On("Do", req)}
}
func (_c *HTTPClient_Do_Call) Run(run func(req *http.Request)) *HTTPClient_Do_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*http.Request))
})
return _c
}
func (_c *HTTPClient_Do_Call) Return(_a0 *http.Response, _a1 error) *HTTPClient_Do_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *HTTPClient_Do_Call) RunAndReturn(run func(*http.Request) (*http.Response, error)) *HTTPClient_Do_Call {
_c.Call.Return(run)
return _c
}
// NewHTTPClient creates a new instance of HTTPClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewHTTPClient(t mockConstructorTestingTNewHTTPClient) *HTTPClient {
// The first argument is typically a *testing.T value.
func NewHTTPClient(t interface {
mock.TestingT
Cleanup(func())
}) *HTTPClient {
mock := &HTTPClient{}
mock.Mock.Test(t)

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
// Code generated by mockery v2.22.1. DO NOT EDIT.
// Code generated by mockery v2.40.1. DO NOT EDIT.
package mocks
@@ -17,6 +17,14 @@ type Permissions struct {
mock.Mock
}
type Permissions_Expecter struct {
mock *mock.Mock
}
func (_m *Permissions) EXPECT() *Permissions_Expecter {
return &Permissions_Expecter{mock: &_m.Mock}
}
// GetPermissionByID provides a mock function with given fields: ctx, request, opts
func (_m *Permissions) GetPermissionByID(ctx context.Context, request *v0.GetPermissionByIDRequest, opts ...client.CallOption) (*v0.GetPermissionByIDResponse, error) {
_va := make([]interface{}, len(opts))
@@ -28,6 +36,10 @@ func (_m *Permissions) GetPermissionByID(ctx context.Context, request *v0.GetPer
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for GetPermissionByID")
}
var r0 *v0.GetPermissionByIDResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.GetPermissionByIDRequest, ...client.CallOption) (*v0.GetPermissionByIDResponse, error)); ok {
@@ -50,6 +62,43 @@ func (_m *Permissions) GetPermissionByID(ctx context.Context, request *v0.GetPer
return r0, r1
}
// Permissions_GetPermissionByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPermissionByID'
type Permissions_GetPermissionByID_Call struct {
*mock.Call
}
// GetPermissionByID is a helper method to define mock.On call
// - ctx context.Context
// - request *v0.GetPermissionByIDRequest
// - opts ...client.CallOption
func (_e *Permissions_Expecter) GetPermissionByID(ctx interface{}, request interface{}, opts ...interface{}) *Permissions_GetPermissionByID_Call {
return &Permissions_GetPermissionByID_Call{Call: _e.mock.On("GetPermissionByID",
append([]interface{}{ctx, request}, opts...)...)}
}
func (_c *Permissions_GetPermissionByID_Call) Run(run func(ctx context.Context, request *v0.GetPermissionByIDRequest, opts ...client.CallOption)) *Permissions_GetPermissionByID_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]client.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(client.CallOption)
}
}
run(args[0].(context.Context), args[1].(*v0.GetPermissionByIDRequest), variadicArgs...)
})
return _c
}
func (_c *Permissions_GetPermissionByID_Call) Return(_a0 *v0.GetPermissionByIDResponse, _a1 error) *Permissions_GetPermissionByID_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Permissions_GetPermissionByID_Call) RunAndReturn(run func(context.Context, *v0.GetPermissionByIDRequest, ...client.CallOption) (*v0.GetPermissionByIDResponse, error)) *Permissions_GetPermissionByID_Call {
_c.Call.Return(run)
return _c
}
// ListPermissions provides a mock function with given fields: ctx, req, opts
func (_m *Permissions) ListPermissions(ctx context.Context, req *v0.ListPermissionsRequest, opts ...client.CallOption) (*v0.ListPermissionsResponse, error) {
_va := make([]interface{}, len(opts))
@@ -61,6 +110,10 @@ func (_m *Permissions) ListPermissions(ctx context.Context, req *v0.ListPermissi
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for ListPermissions")
}
var r0 *v0.ListPermissionsResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.ListPermissionsRequest, ...client.CallOption) (*v0.ListPermissionsResponse, error)); ok {
@@ -83,6 +136,43 @@ func (_m *Permissions) ListPermissions(ctx context.Context, req *v0.ListPermissi
return r0, r1
}
// Permissions_ListPermissions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListPermissions'
type Permissions_ListPermissions_Call struct {
*mock.Call
}
// ListPermissions is a helper method to define mock.On call
// - ctx context.Context
// - req *v0.ListPermissionsRequest
// - opts ...client.CallOption
func (_e *Permissions_Expecter) ListPermissions(ctx interface{}, req interface{}, opts ...interface{}) *Permissions_ListPermissions_Call {
return &Permissions_ListPermissions_Call{Call: _e.mock.On("ListPermissions",
append([]interface{}{ctx, req}, opts...)...)}
}
func (_c *Permissions_ListPermissions_Call) Run(run func(ctx context.Context, req *v0.ListPermissionsRequest, opts ...client.CallOption)) *Permissions_ListPermissions_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]client.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(client.CallOption)
}
}
run(args[0].(context.Context), args[1].(*v0.ListPermissionsRequest), variadicArgs...)
})
return _c
}
func (_c *Permissions_ListPermissions_Call) Return(_a0 *v0.ListPermissionsResponse, _a1 error) *Permissions_ListPermissions_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Permissions_ListPermissions_Call) RunAndReturn(run func(context.Context, *v0.ListPermissionsRequest, ...client.CallOption) (*v0.ListPermissionsResponse, error)) *Permissions_ListPermissions_Call {
_c.Call.Return(run)
return _c
}
// ListPermissionsByResource provides a mock function with given fields: ctx, in, opts
func (_m *Permissions) ListPermissionsByResource(ctx context.Context, in *v0.ListPermissionsByResourceRequest, opts ...client.CallOption) (*v0.ListPermissionsByResourceResponse, error) {
_va := make([]interface{}, len(opts))
@@ -94,6 +184,10 @@ func (_m *Permissions) ListPermissionsByResource(ctx context.Context, in *v0.Lis
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for ListPermissionsByResource")
}
var r0 *v0.ListPermissionsByResourceResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.ListPermissionsByResourceRequest, ...client.CallOption) (*v0.ListPermissionsByResourceResponse, error)); ok {
@@ -116,13 +210,49 @@ func (_m *Permissions) ListPermissionsByResource(ctx context.Context, in *v0.Lis
return r0, r1
}
type mockConstructorTestingTNewPermissions interface {
mock.TestingT
Cleanup(func())
// Permissions_ListPermissionsByResource_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListPermissionsByResource'
type Permissions_ListPermissionsByResource_Call struct {
*mock.Call
}
// ListPermissionsByResource is a helper method to define mock.On call
// - ctx context.Context
// - in *v0.ListPermissionsByResourceRequest
// - opts ...client.CallOption
func (_e *Permissions_Expecter) ListPermissionsByResource(ctx interface{}, in interface{}, opts ...interface{}) *Permissions_ListPermissionsByResource_Call {
return &Permissions_ListPermissionsByResource_Call{Call: _e.mock.On("ListPermissionsByResource",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *Permissions_ListPermissionsByResource_Call) Run(run func(ctx context.Context, in *v0.ListPermissionsByResourceRequest, opts ...client.CallOption)) *Permissions_ListPermissionsByResource_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]client.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(client.CallOption)
}
}
run(args[0].(context.Context), args[1].(*v0.ListPermissionsByResourceRequest), variadicArgs...)
})
return _c
}
func (_c *Permissions_ListPermissionsByResource_Call) Return(_a0 *v0.ListPermissionsByResourceResponse, _a1 error) *Permissions_ListPermissionsByResource_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Permissions_ListPermissionsByResource_Call) RunAndReturn(run func(context.Context, *v0.ListPermissionsByResourceRequest, ...client.CallOption) (*v0.ListPermissionsByResourceResponse, error)) *Permissions_ListPermissionsByResource_Call {
_c.Call.Return(run)
return _c
}
// NewPermissions creates a new instance of Permissions. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewPermissions(t mockConstructorTestingTNewPermissions) *Permissions {
// The first argument is typically a *testing.T value.
func NewPermissions(t interface {
mock.TestingT
Cleanup(func())
}) *Permissions {
mock := &Permissions{}
mock.Mock.Test(t)

View File

@@ -1,4 +1,4 @@
// Code generated by mockery v2.22.1. DO NOT EDIT.
// Code generated by mockery v2.40.1. DO NOT EDIT.
package mocks
@@ -12,6 +12,14 @@ type Publisher struct {
mock.Mock
}
type Publisher_Expecter struct {
mock *mock.Mock
}
func (_m *Publisher) EXPECT() *Publisher_Expecter {
return &Publisher_Expecter{mock: &_m.Mock}
}
// Publish provides a mock function with given fields: _a0, _a1, _a2
func (_m *Publisher) Publish(_a0 string, _a1 interface{}, _a2 ...events.PublishOption) error {
_va := make([]interface{}, len(_a2))
@@ -23,6 +31,10 @@ func (_m *Publisher) Publish(_a0 string, _a1 interface{}, _a2 ...events.PublishO
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for Publish")
}
var r0 error
if rf, ok := ret.Get(0).(func(string, interface{}, ...events.PublishOption) error); ok {
r0 = rf(_a0, _a1, _a2...)
@@ -33,13 +45,49 @@ func (_m *Publisher) Publish(_a0 string, _a1 interface{}, _a2 ...events.PublishO
return r0
}
type mockConstructorTestingTNewPublisher interface {
mock.TestingT
Cleanup(func())
// Publisher_Publish_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Publish'
type Publisher_Publish_Call struct {
*mock.Call
}
// Publish is a helper method to define mock.On call
// - _a0 string
// - _a1 interface{}
// - _a2 ...events.PublishOption
func (_e *Publisher_Expecter) Publish(_a0 interface{}, _a1 interface{}, _a2 ...interface{}) *Publisher_Publish_Call {
return &Publisher_Publish_Call{Call: _e.mock.On("Publish",
append([]interface{}{_a0, _a1}, _a2...)...)}
}
func (_c *Publisher_Publish_Call) Run(run func(_a0 string, _a1 interface{}, _a2 ...events.PublishOption)) *Publisher_Publish_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]events.PublishOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(events.PublishOption)
}
}
run(args[0].(string), args[1].(interface{}), variadicArgs...)
})
return _c
}
func (_c *Publisher_Publish_Call) Return(_a0 error) *Publisher_Publish_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Publisher_Publish_Call) RunAndReturn(run func(string, interface{}, ...events.PublishOption) error) *Publisher_Publish_Call {
_c.Call.Return(run)
return _c
}
// NewPublisher creates a new instance of Publisher. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewPublisher(t mockConstructorTestingTNewPublisher) *Publisher {
// The first argument is typically a *testing.T value.
func NewPublisher(t interface {
mock.TestingT
Cleanup(func())
}) *Publisher {
mock := &Publisher{}
mock.Mock.Test(t)

View File

@@ -1,4 +1,4 @@
// Code generated by mockery v2.22.1. DO NOT EDIT.
// Code generated by mockery v2.40.1. DO NOT EDIT.
package mocks
@@ -19,6 +19,14 @@ type RoleService struct {
mock.Mock
}
type RoleService_Expecter struct {
mock *mock.Mock
}
func (_m *RoleService) EXPECT() *RoleService_Expecter {
return &RoleService_Expecter{mock: &_m.Mock}
}
// AssignRoleToUser provides a mock function with given fields: ctx, in, opts
func (_m *RoleService) AssignRoleToUser(ctx context.Context, in *v0.AssignRoleToUserRequest, opts ...client.CallOption) (*v0.AssignRoleToUserResponse, error) {
_va := make([]interface{}, len(opts))
@@ -30,6 +38,10 @@ func (_m *RoleService) AssignRoleToUser(ctx context.Context, in *v0.AssignRoleTo
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for AssignRoleToUser")
}
var r0 *v0.AssignRoleToUserResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.AssignRoleToUserRequest, ...client.CallOption) (*v0.AssignRoleToUserResponse, error)); ok {
@@ -52,6 +64,43 @@ func (_m *RoleService) AssignRoleToUser(ctx context.Context, in *v0.AssignRoleTo
return r0, r1
}
// RoleService_AssignRoleToUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AssignRoleToUser'
type RoleService_AssignRoleToUser_Call struct {
*mock.Call
}
// AssignRoleToUser is a helper method to define mock.On call
// - ctx context.Context
// - in *v0.AssignRoleToUserRequest
// - opts ...client.CallOption
func (_e *RoleService_Expecter) AssignRoleToUser(ctx interface{}, in interface{}, opts ...interface{}) *RoleService_AssignRoleToUser_Call {
return &RoleService_AssignRoleToUser_Call{Call: _e.mock.On("AssignRoleToUser",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *RoleService_AssignRoleToUser_Call) Run(run func(ctx context.Context, in *v0.AssignRoleToUserRequest, opts ...client.CallOption)) *RoleService_AssignRoleToUser_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]client.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(client.CallOption)
}
}
run(args[0].(context.Context), args[1].(*v0.AssignRoleToUserRequest), variadicArgs...)
})
return _c
}
func (_c *RoleService_AssignRoleToUser_Call) Return(_a0 *v0.AssignRoleToUserResponse, _a1 error) *RoleService_AssignRoleToUser_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *RoleService_AssignRoleToUser_Call) RunAndReturn(run func(context.Context, *v0.AssignRoleToUserRequest, ...client.CallOption) (*v0.AssignRoleToUserResponse, error)) *RoleService_AssignRoleToUser_Call {
_c.Call.Return(run)
return _c
}
// ListRoleAssignments provides a mock function with given fields: ctx, in, opts
func (_m *RoleService) ListRoleAssignments(ctx context.Context, in *v0.ListRoleAssignmentsRequest, opts ...client.CallOption) (*v0.ListRoleAssignmentsResponse, error) {
_va := make([]interface{}, len(opts))
@@ -63,6 +112,10 @@ func (_m *RoleService) ListRoleAssignments(ctx context.Context, in *v0.ListRoleA
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for ListRoleAssignments")
}
var r0 *v0.ListRoleAssignmentsResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.ListRoleAssignmentsRequest, ...client.CallOption) (*v0.ListRoleAssignmentsResponse, error)); ok {
@@ -85,6 +138,43 @@ func (_m *RoleService) ListRoleAssignments(ctx context.Context, in *v0.ListRoleA
return r0, r1
}
// RoleService_ListRoleAssignments_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListRoleAssignments'
type RoleService_ListRoleAssignments_Call struct {
*mock.Call
}
// ListRoleAssignments is a helper method to define mock.On call
// - ctx context.Context
// - in *v0.ListRoleAssignmentsRequest
// - opts ...client.CallOption
func (_e *RoleService_Expecter) ListRoleAssignments(ctx interface{}, in interface{}, opts ...interface{}) *RoleService_ListRoleAssignments_Call {
return &RoleService_ListRoleAssignments_Call{Call: _e.mock.On("ListRoleAssignments",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *RoleService_ListRoleAssignments_Call) Run(run func(ctx context.Context, in *v0.ListRoleAssignmentsRequest, opts ...client.CallOption)) *RoleService_ListRoleAssignments_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]client.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(client.CallOption)
}
}
run(args[0].(context.Context), args[1].(*v0.ListRoleAssignmentsRequest), variadicArgs...)
})
return _c
}
func (_c *RoleService_ListRoleAssignments_Call) Return(_a0 *v0.ListRoleAssignmentsResponse, _a1 error) *RoleService_ListRoleAssignments_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *RoleService_ListRoleAssignments_Call) RunAndReturn(run func(context.Context, *v0.ListRoleAssignmentsRequest, ...client.CallOption) (*v0.ListRoleAssignmentsResponse, error)) *RoleService_ListRoleAssignments_Call {
_c.Call.Return(run)
return _c
}
// ListRoles provides a mock function with given fields: ctx, in, opts
func (_m *RoleService) ListRoles(ctx context.Context, in *v0.ListBundlesRequest, opts ...client.CallOption) (*v0.ListBundlesResponse, error) {
_va := make([]interface{}, len(opts))
@@ -96,6 +186,10 @@ func (_m *RoleService) ListRoles(ctx context.Context, in *v0.ListBundlesRequest,
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for ListRoles")
}
var r0 *v0.ListBundlesResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.ListBundlesRequest, ...client.CallOption) (*v0.ListBundlesResponse, error)); ok {
@@ -118,6 +212,43 @@ func (_m *RoleService) ListRoles(ctx context.Context, in *v0.ListBundlesRequest,
return r0, r1
}
// RoleService_ListRoles_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListRoles'
type RoleService_ListRoles_Call struct {
*mock.Call
}
// ListRoles is a helper method to define mock.On call
// - ctx context.Context
// - in *v0.ListBundlesRequest
// - opts ...client.CallOption
func (_e *RoleService_Expecter) ListRoles(ctx interface{}, in interface{}, opts ...interface{}) *RoleService_ListRoles_Call {
return &RoleService_ListRoles_Call{Call: _e.mock.On("ListRoles",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *RoleService_ListRoles_Call) Run(run func(ctx context.Context, in *v0.ListBundlesRequest, opts ...client.CallOption)) *RoleService_ListRoles_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]client.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(client.CallOption)
}
}
run(args[0].(context.Context), args[1].(*v0.ListBundlesRequest), variadicArgs...)
})
return _c
}
func (_c *RoleService_ListRoles_Call) Return(_a0 *v0.ListBundlesResponse, _a1 error) *RoleService_ListRoles_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *RoleService_ListRoles_Call) RunAndReturn(run func(context.Context, *v0.ListBundlesRequest, ...client.CallOption) (*v0.ListBundlesResponse, error)) *RoleService_ListRoles_Call {
_c.Call.Return(run)
return _c
}
// RemoveRoleFromUser provides a mock function with given fields: ctx, in, opts
func (_m *RoleService) RemoveRoleFromUser(ctx context.Context, in *v0.RemoveRoleFromUserRequest, opts ...client.CallOption) (*emptypb.Empty, error) {
_va := make([]interface{}, len(opts))
@@ -129,6 +260,10 @@ func (_m *RoleService) RemoveRoleFromUser(ctx context.Context, in *v0.RemoveRole
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for RemoveRoleFromUser")
}
var r0 *emptypb.Empty
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.RemoveRoleFromUserRequest, ...client.CallOption) (*emptypb.Empty, error)); ok {
@@ -151,13 +286,49 @@ func (_m *RoleService) RemoveRoleFromUser(ctx context.Context, in *v0.RemoveRole
return r0, r1
}
type mockConstructorTestingTNewRoleService interface {
mock.TestingT
Cleanup(func())
// RoleService_RemoveRoleFromUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveRoleFromUser'
type RoleService_RemoveRoleFromUser_Call struct {
*mock.Call
}
// RemoveRoleFromUser is a helper method to define mock.On call
// - ctx context.Context
// - in *v0.RemoveRoleFromUserRequest
// - opts ...client.CallOption
func (_e *RoleService_Expecter) RemoveRoleFromUser(ctx interface{}, in interface{}, opts ...interface{}) *RoleService_RemoveRoleFromUser_Call {
return &RoleService_RemoveRoleFromUser_Call{Call: _e.mock.On("RemoveRoleFromUser",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *RoleService_RemoveRoleFromUser_Call) Run(run func(ctx context.Context, in *v0.RemoveRoleFromUserRequest, opts ...client.CallOption)) *RoleService_RemoveRoleFromUser_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]client.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(client.CallOption)
}
}
run(args[0].(context.Context), args[1].(*v0.RemoveRoleFromUserRequest), variadicArgs...)
})
return _c
}
func (_c *RoleService_RemoveRoleFromUser_Call) Return(_a0 *emptypb.Empty, _a1 error) *RoleService_RemoveRoleFromUser_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *RoleService_RemoveRoleFromUser_Call) RunAndReturn(run func(context.Context, *v0.RemoveRoleFromUserRequest, ...client.CallOption) (*emptypb.Empty, error)) *RoleService_RemoveRoleFromUser_Call {
_c.Call.Return(run)
return _c
}
// NewRoleService creates a new instance of RoleService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewRoleService(t mockConstructorTestingTNewRoleService) *RoleService {
// The first argument is typically a *testing.T value.
func NewRoleService(t interface {
mock.TestingT
Cleanup(func())
}) *RoleService {
mock := &RoleService{}
mock.Mock.Test(t)

View File

@@ -1,4 +1,4 @@
// Code generated by mockery v0.0.0-dev. DO NOT EDIT.
// Code generated by mockery v2.40.1. DO NOT EDIT.
package mocks
@@ -17,6 +17,14 @@ type ValueService struct {
mock.Mock
}
type ValueService_Expecter struct {
mock *mock.Mock
}
func (_m *ValueService) EXPECT() *ValueService_Expecter {
return &ValueService_Expecter{mock: &_m.Mock}
}
// GetValue provides a mock function with given fields: ctx, in, opts
func (_m *ValueService) GetValue(ctx context.Context, in *v0.GetValueRequest, opts ...client.CallOption) (*v0.GetValueResponse, error) {
_va := make([]interface{}, len(opts))
@@ -28,6 +36,10 @@ func (_m *ValueService) GetValue(ctx context.Context, in *v0.GetValueRequest, op
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for GetValue")
}
var r0 *v0.GetValueResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.GetValueRequest, ...client.CallOption) (*v0.GetValueResponse, error)); ok {
@@ -50,6 +62,43 @@ func (_m *ValueService) GetValue(ctx context.Context, in *v0.GetValueRequest, op
return r0, r1
}
// ValueService_GetValue_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetValue'
type ValueService_GetValue_Call struct {
*mock.Call
}
// GetValue is a helper method to define mock.On call
// - ctx context.Context
// - in *v0.GetValueRequest
// - opts ...client.CallOption
func (_e *ValueService_Expecter) GetValue(ctx interface{}, in interface{}, opts ...interface{}) *ValueService_GetValue_Call {
return &ValueService_GetValue_Call{Call: _e.mock.On("GetValue",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *ValueService_GetValue_Call) Run(run func(ctx context.Context, in *v0.GetValueRequest, opts ...client.CallOption)) *ValueService_GetValue_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]client.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(client.CallOption)
}
}
run(args[0].(context.Context), args[1].(*v0.GetValueRequest), variadicArgs...)
})
return _c
}
func (_c *ValueService_GetValue_Call) Return(_a0 *v0.GetValueResponse, _a1 error) *ValueService_GetValue_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *ValueService_GetValue_Call) RunAndReturn(run func(context.Context, *v0.GetValueRequest, ...client.CallOption) (*v0.GetValueResponse, error)) *ValueService_GetValue_Call {
_c.Call.Return(run)
return _c
}
// GetValueByUniqueIdentifiers provides a mock function with given fields: ctx, in, opts
func (_m *ValueService) GetValueByUniqueIdentifiers(ctx context.Context, in *v0.GetValueByUniqueIdentifiersRequest, opts ...client.CallOption) (*v0.GetValueResponse, error) {
_va := make([]interface{}, len(opts))
@@ -61,6 +110,10 @@ func (_m *ValueService) GetValueByUniqueIdentifiers(ctx context.Context, in *v0.
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for GetValueByUniqueIdentifiers")
}
var r0 *v0.GetValueResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.GetValueByUniqueIdentifiersRequest, ...client.CallOption) (*v0.GetValueResponse, error)); ok {
@@ -83,6 +136,43 @@ func (_m *ValueService) GetValueByUniqueIdentifiers(ctx context.Context, in *v0.
return r0, r1
}
// ValueService_GetValueByUniqueIdentifiers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetValueByUniqueIdentifiers'
type ValueService_GetValueByUniqueIdentifiers_Call struct {
*mock.Call
}
// GetValueByUniqueIdentifiers is a helper method to define mock.On call
// - ctx context.Context
// - in *v0.GetValueByUniqueIdentifiersRequest
// - opts ...client.CallOption
func (_e *ValueService_Expecter) GetValueByUniqueIdentifiers(ctx interface{}, in interface{}, opts ...interface{}) *ValueService_GetValueByUniqueIdentifiers_Call {
return &ValueService_GetValueByUniqueIdentifiers_Call{Call: _e.mock.On("GetValueByUniqueIdentifiers",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *ValueService_GetValueByUniqueIdentifiers_Call) Run(run func(ctx context.Context, in *v0.GetValueByUniqueIdentifiersRequest, opts ...client.CallOption)) *ValueService_GetValueByUniqueIdentifiers_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]client.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(client.CallOption)
}
}
run(args[0].(context.Context), args[1].(*v0.GetValueByUniqueIdentifiersRequest), variadicArgs...)
})
return _c
}
func (_c *ValueService_GetValueByUniqueIdentifiers_Call) Return(_a0 *v0.GetValueResponse, _a1 error) *ValueService_GetValueByUniqueIdentifiers_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *ValueService_GetValueByUniqueIdentifiers_Call) RunAndReturn(run func(context.Context, *v0.GetValueByUniqueIdentifiersRequest, ...client.CallOption) (*v0.GetValueResponse, error)) *ValueService_GetValueByUniqueIdentifiers_Call {
_c.Call.Return(run)
return _c
}
// ListValues provides a mock function with given fields: ctx, in, opts
func (_m *ValueService) ListValues(ctx context.Context, in *v0.ListValuesRequest, opts ...client.CallOption) (*v0.ListValuesResponse, error) {
_va := make([]interface{}, len(opts))
@@ -94,6 +184,10 @@ func (_m *ValueService) ListValues(ctx context.Context, in *v0.ListValuesRequest
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for ListValues")
}
var r0 *v0.ListValuesResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.ListValuesRequest, ...client.CallOption) (*v0.ListValuesResponse, error)); ok {
@@ -116,6 +210,43 @@ func (_m *ValueService) ListValues(ctx context.Context, in *v0.ListValuesRequest
return r0, r1
}
// ValueService_ListValues_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListValues'
type ValueService_ListValues_Call struct {
*mock.Call
}
// ListValues is a helper method to define mock.On call
// - ctx context.Context
// - in *v0.ListValuesRequest
// - opts ...client.CallOption
func (_e *ValueService_Expecter) ListValues(ctx interface{}, in interface{}, opts ...interface{}) *ValueService_ListValues_Call {
return &ValueService_ListValues_Call{Call: _e.mock.On("ListValues",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *ValueService_ListValues_Call) Run(run func(ctx context.Context, in *v0.ListValuesRequest, opts ...client.CallOption)) *ValueService_ListValues_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]client.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(client.CallOption)
}
}
run(args[0].(context.Context), args[1].(*v0.ListValuesRequest), variadicArgs...)
})
return _c
}
func (_c *ValueService_ListValues_Call) Return(_a0 *v0.ListValuesResponse, _a1 error) *ValueService_ListValues_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *ValueService_ListValues_Call) RunAndReturn(run func(context.Context, *v0.ListValuesRequest, ...client.CallOption) (*v0.ListValuesResponse, error)) *ValueService_ListValues_Call {
_c.Call.Return(run)
return _c
}
// SaveValue provides a mock function with given fields: ctx, in, opts
func (_m *ValueService) SaveValue(ctx context.Context, in *v0.SaveValueRequest, opts ...client.CallOption) (*v0.SaveValueResponse, error) {
_va := make([]interface{}, len(opts))
@@ -127,6 +258,10 @@ func (_m *ValueService) SaveValue(ctx context.Context, in *v0.SaveValueRequest,
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for SaveValue")
}
var r0 *v0.SaveValueResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.SaveValueRequest, ...client.CallOption) (*v0.SaveValueResponse, error)); ok {
@@ -149,6 +284,43 @@ func (_m *ValueService) SaveValue(ctx context.Context, in *v0.SaveValueRequest,
return r0, r1
}
// ValueService_SaveValue_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SaveValue'
type ValueService_SaveValue_Call struct {
*mock.Call
}
// SaveValue is a helper method to define mock.On call
// - ctx context.Context
// - in *v0.SaveValueRequest
// - opts ...client.CallOption
func (_e *ValueService_Expecter) SaveValue(ctx interface{}, in interface{}, opts ...interface{}) *ValueService_SaveValue_Call {
return &ValueService_SaveValue_Call{Call: _e.mock.On("SaveValue",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *ValueService_SaveValue_Call) Run(run func(ctx context.Context, in *v0.SaveValueRequest, opts ...client.CallOption)) *ValueService_SaveValue_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]client.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(client.CallOption)
}
}
run(args[0].(context.Context), args[1].(*v0.SaveValueRequest), variadicArgs...)
})
return _c
}
func (_c *ValueService_SaveValue_Call) Return(_a0 *v0.SaveValueResponse, _a1 error) *ValueService_SaveValue_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *ValueService_SaveValue_Call) RunAndReturn(run func(context.Context, *v0.SaveValueRequest, ...client.CallOption) (*v0.SaveValueResponse, error)) *ValueService_SaveValue_Call {
_c.Call.Return(run)
return _c
}
// NewValueService creates a new instance of ValueService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewValueService(t interface {

View File

@@ -1,4 +1,4 @@
// Code generated by mockery v2.22.1. DO NOT EDIT.
// Code generated by mockery v2.40.1. DO NOT EDIT.
package mocks
@@ -19,10 +19,22 @@ type Backend struct {
mock.Mock
}
type Backend_Expecter struct {
mock *mock.Mock
}
func (_m *Backend) EXPECT() *Backend_Expecter {
return &Backend_Expecter{mock: &_m.Mock}
}
// AddMembersToGroup provides a mock function with given fields: ctx, groupID, memberID
func (_m *Backend) AddMembersToGroup(ctx context.Context, groupID string, memberID []string) error {
ret := _m.Called(ctx, groupID, memberID)
if len(ret) == 0 {
panic("no return value specified for AddMembersToGroup")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, []string) error); ok {
r0 = rf(ctx, groupID, memberID)
@@ -33,10 +45,44 @@ func (_m *Backend) AddMembersToGroup(ctx context.Context, groupID string, member
return r0
}
// Backend_AddMembersToGroup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddMembersToGroup'
type Backend_AddMembersToGroup_Call struct {
*mock.Call
}
// AddMembersToGroup is a helper method to define mock.On call
// - ctx context.Context
// - groupID string
// - memberID []string
func (_e *Backend_Expecter) AddMembersToGroup(ctx interface{}, groupID interface{}, memberID interface{}) *Backend_AddMembersToGroup_Call {
return &Backend_AddMembersToGroup_Call{Call: _e.mock.On("AddMembersToGroup", ctx, groupID, memberID)}
}
func (_c *Backend_AddMembersToGroup_Call) Run(run func(ctx context.Context, groupID string, memberID []string)) *Backend_AddMembersToGroup_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].([]string))
})
return _c
}
func (_c *Backend_AddMembersToGroup_Call) Return(_a0 error) *Backend_AddMembersToGroup_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Backend_AddMembersToGroup_Call) RunAndReturn(run func(context.Context, string, []string) error) *Backend_AddMembersToGroup_Call {
_c.Call.Return(run)
return _c
}
// CreateGroup provides a mock function with given fields: ctx, group
func (_m *Backend) CreateGroup(ctx context.Context, group libregraph.Group) (*libregraph.Group, error) {
ret := _m.Called(ctx, group)
if len(ret) == 0 {
panic("no return value specified for CreateGroup")
}
var r0 *libregraph.Group
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, libregraph.Group) (*libregraph.Group, error)); ok {
@@ -59,10 +105,43 @@ func (_m *Backend) CreateGroup(ctx context.Context, group libregraph.Group) (*li
return r0, r1
}
// Backend_CreateGroup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateGroup'
type Backend_CreateGroup_Call struct {
*mock.Call
}
// CreateGroup is a helper method to define mock.On call
// - ctx context.Context
// - group libregraph.Group
func (_e *Backend_Expecter) CreateGroup(ctx interface{}, group interface{}) *Backend_CreateGroup_Call {
return &Backend_CreateGroup_Call{Call: _e.mock.On("CreateGroup", ctx, group)}
}
func (_c *Backend_CreateGroup_Call) Run(run func(ctx context.Context, group libregraph.Group)) *Backend_CreateGroup_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(libregraph.Group))
})
return _c
}
func (_c *Backend_CreateGroup_Call) Return(_a0 *libregraph.Group, _a1 error) *Backend_CreateGroup_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Backend_CreateGroup_Call) RunAndReturn(run func(context.Context, libregraph.Group) (*libregraph.Group, error)) *Backend_CreateGroup_Call {
_c.Call.Return(run)
return _c
}
// CreateUser provides a mock function with given fields: ctx, user
func (_m *Backend) CreateUser(ctx context.Context, user libregraph.User) (*libregraph.User, error) {
ret := _m.Called(ctx, user)
if len(ret) == 0 {
panic("no return value specified for CreateUser")
}
var r0 *libregraph.User
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, libregraph.User) (*libregraph.User, error)); ok {
@@ -85,10 +164,43 @@ func (_m *Backend) CreateUser(ctx context.Context, user libregraph.User) (*libre
return r0, r1
}
// Backend_CreateUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateUser'
type Backend_CreateUser_Call struct {
*mock.Call
}
// CreateUser is a helper method to define mock.On call
// - ctx context.Context
// - user libregraph.User
func (_e *Backend_Expecter) CreateUser(ctx interface{}, user interface{}) *Backend_CreateUser_Call {
return &Backend_CreateUser_Call{Call: _e.mock.On("CreateUser", ctx, user)}
}
func (_c *Backend_CreateUser_Call) Run(run func(ctx context.Context, user libregraph.User)) *Backend_CreateUser_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(libregraph.User))
})
return _c
}
func (_c *Backend_CreateUser_Call) Return(_a0 *libregraph.User, _a1 error) *Backend_CreateUser_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Backend_CreateUser_Call) RunAndReturn(run func(context.Context, libregraph.User) (*libregraph.User, error)) *Backend_CreateUser_Call {
_c.Call.Return(run)
return _c
}
// DeleteGroup provides a mock function with given fields: ctx, id
func (_m *Backend) DeleteGroup(ctx context.Context, id string) error {
ret := _m.Called(ctx, id)
if len(ret) == 0 {
panic("no return value specified for DeleteGroup")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string) error); ok {
r0 = rf(ctx, id)
@@ -99,10 +211,43 @@ func (_m *Backend) DeleteGroup(ctx context.Context, id string) error {
return r0
}
// Backend_DeleteGroup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteGroup'
type Backend_DeleteGroup_Call struct {
*mock.Call
}
// DeleteGroup is a helper method to define mock.On call
// - ctx context.Context
// - id string
func (_e *Backend_Expecter) DeleteGroup(ctx interface{}, id interface{}) *Backend_DeleteGroup_Call {
return &Backend_DeleteGroup_Call{Call: _e.mock.On("DeleteGroup", ctx, id)}
}
func (_c *Backend_DeleteGroup_Call) Run(run func(ctx context.Context, id string)) *Backend_DeleteGroup_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string))
})
return _c
}
func (_c *Backend_DeleteGroup_Call) Return(_a0 error) *Backend_DeleteGroup_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Backend_DeleteGroup_Call) RunAndReturn(run func(context.Context, string) error) *Backend_DeleteGroup_Call {
_c.Call.Return(run)
return _c
}
// DeleteUser provides a mock function with given fields: ctx, nameOrID
func (_m *Backend) DeleteUser(ctx context.Context, nameOrID string) error {
ret := _m.Called(ctx, nameOrID)
if len(ret) == 0 {
panic("no return value specified for DeleteUser")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string) error); ok {
r0 = rf(ctx, nameOrID)
@@ -113,10 +258,43 @@ func (_m *Backend) DeleteUser(ctx context.Context, nameOrID string) error {
return r0
}
// Backend_DeleteUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteUser'
type Backend_DeleteUser_Call struct {
*mock.Call
}
// DeleteUser is a helper method to define mock.On call
// - ctx context.Context
// - nameOrID string
func (_e *Backend_Expecter) DeleteUser(ctx interface{}, nameOrID interface{}) *Backend_DeleteUser_Call {
return &Backend_DeleteUser_Call{Call: _e.mock.On("DeleteUser", ctx, nameOrID)}
}
func (_c *Backend_DeleteUser_Call) Run(run func(ctx context.Context, nameOrID string)) *Backend_DeleteUser_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string))
})
return _c
}
func (_c *Backend_DeleteUser_Call) Return(_a0 error) *Backend_DeleteUser_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Backend_DeleteUser_Call) RunAndReturn(run func(context.Context, string) error) *Backend_DeleteUser_Call {
_c.Call.Return(run)
return _c
}
// GetGroup provides a mock function with given fields: ctx, nameOrID, queryParam
func (_m *Backend) GetGroup(ctx context.Context, nameOrID string, queryParam url.Values) (*libregraph.Group, error) {
ret := _m.Called(ctx, nameOrID, queryParam)
if len(ret) == 0 {
panic("no return value specified for GetGroup")
}
var r0 *libregraph.Group
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, url.Values) (*libregraph.Group, error)); ok {
@@ -139,10 +317,44 @@ func (_m *Backend) GetGroup(ctx context.Context, nameOrID string, queryParam url
return r0, r1
}
// Backend_GetGroup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetGroup'
type Backend_GetGroup_Call struct {
*mock.Call
}
// GetGroup is a helper method to define mock.On call
// - ctx context.Context
// - nameOrID string
// - queryParam url.Values
func (_e *Backend_Expecter) GetGroup(ctx interface{}, nameOrID interface{}, queryParam interface{}) *Backend_GetGroup_Call {
return &Backend_GetGroup_Call{Call: _e.mock.On("GetGroup", ctx, nameOrID, queryParam)}
}
func (_c *Backend_GetGroup_Call) Run(run func(ctx context.Context, nameOrID string, queryParam url.Values)) *Backend_GetGroup_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(url.Values))
})
return _c
}
func (_c *Backend_GetGroup_Call) Return(_a0 *libregraph.Group, _a1 error) *Backend_GetGroup_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Backend_GetGroup_Call) RunAndReturn(run func(context.Context, string, url.Values) (*libregraph.Group, error)) *Backend_GetGroup_Call {
_c.Call.Return(run)
return _c
}
// GetGroupMembers provides a mock function with given fields: ctx, id, oreq
func (_m *Backend) GetGroupMembers(ctx context.Context, id string, oreq *godata.GoDataRequest) ([]*libregraph.User, error) {
ret := _m.Called(ctx, id, oreq)
if len(ret) == 0 {
panic("no return value specified for GetGroupMembers")
}
var r0 []*libregraph.User
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, *godata.GoDataRequest) ([]*libregraph.User, error)); ok {
@@ -165,10 +377,44 @@ func (_m *Backend) GetGroupMembers(ctx context.Context, id string, oreq *godata.
return r0, r1
}
// Backend_GetGroupMembers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetGroupMembers'
type Backend_GetGroupMembers_Call struct {
*mock.Call
}
// GetGroupMembers is a helper method to define mock.On call
// - ctx context.Context
// - id string
// - oreq *godata.GoDataRequest
func (_e *Backend_Expecter) GetGroupMembers(ctx interface{}, id interface{}, oreq interface{}) *Backend_GetGroupMembers_Call {
return &Backend_GetGroupMembers_Call{Call: _e.mock.On("GetGroupMembers", ctx, id, oreq)}
}
func (_c *Backend_GetGroupMembers_Call) Run(run func(ctx context.Context, id string, oreq *godata.GoDataRequest)) *Backend_GetGroupMembers_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(*godata.GoDataRequest))
})
return _c
}
func (_c *Backend_GetGroupMembers_Call) Return(_a0 []*libregraph.User, _a1 error) *Backend_GetGroupMembers_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Backend_GetGroupMembers_Call) RunAndReturn(run func(context.Context, string, *godata.GoDataRequest) ([]*libregraph.User, error)) *Backend_GetGroupMembers_Call {
_c.Call.Return(run)
return _c
}
// GetGroups provides a mock function with given fields: ctx, oreq
func (_m *Backend) GetGroups(ctx context.Context, oreq *godata.GoDataRequest) ([]*libregraph.Group, error) {
ret := _m.Called(ctx, oreq)
if len(ret) == 0 {
panic("no return value specified for GetGroups")
}
var r0 []*libregraph.Group
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *godata.GoDataRequest) ([]*libregraph.Group, error)); ok {
@@ -191,10 +437,43 @@ func (_m *Backend) GetGroups(ctx context.Context, oreq *godata.GoDataRequest) ([
return r0, r1
}
// Backend_GetGroups_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetGroups'
type Backend_GetGroups_Call struct {
*mock.Call
}
// GetGroups is a helper method to define mock.On call
// - ctx context.Context
// - oreq *godata.GoDataRequest
func (_e *Backend_Expecter) GetGroups(ctx interface{}, oreq interface{}) *Backend_GetGroups_Call {
return &Backend_GetGroups_Call{Call: _e.mock.On("GetGroups", ctx, oreq)}
}
func (_c *Backend_GetGroups_Call) Run(run func(ctx context.Context, oreq *godata.GoDataRequest)) *Backend_GetGroups_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*godata.GoDataRequest))
})
return _c
}
func (_c *Backend_GetGroups_Call) Return(_a0 []*libregraph.Group, _a1 error) *Backend_GetGroups_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Backend_GetGroups_Call) RunAndReturn(run func(context.Context, *godata.GoDataRequest) ([]*libregraph.Group, error)) *Backend_GetGroups_Call {
_c.Call.Return(run)
return _c
}
// GetUser provides a mock function with given fields: ctx, nameOrID, oreq
func (_m *Backend) GetUser(ctx context.Context, nameOrID string, oreq *godata.GoDataRequest) (*libregraph.User, error) {
ret := _m.Called(ctx, nameOrID, oreq)
if len(ret) == 0 {
panic("no return value specified for GetUser")
}
var r0 *libregraph.User
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, *godata.GoDataRequest) (*libregraph.User, error)); ok {
@@ -217,10 +496,44 @@ func (_m *Backend) GetUser(ctx context.Context, nameOrID string, oreq *godata.Go
return r0, r1
}
// Backend_GetUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetUser'
type Backend_GetUser_Call struct {
*mock.Call
}
// GetUser is a helper method to define mock.On call
// - ctx context.Context
// - nameOrID string
// - oreq *godata.GoDataRequest
func (_e *Backend_Expecter) GetUser(ctx interface{}, nameOrID interface{}, oreq interface{}) *Backend_GetUser_Call {
return &Backend_GetUser_Call{Call: _e.mock.On("GetUser", ctx, nameOrID, oreq)}
}
func (_c *Backend_GetUser_Call) Run(run func(ctx context.Context, nameOrID string, oreq *godata.GoDataRequest)) *Backend_GetUser_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(*godata.GoDataRequest))
})
return _c
}
func (_c *Backend_GetUser_Call) Return(_a0 *libregraph.User, _a1 error) *Backend_GetUser_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Backend_GetUser_Call) RunAndReturn(run func(context.Context, string, *godata.GoDataRequest) (*libregraph.User, error)) *Backend_GetUser_Call {
_c.Call.Return(run)
return _c
}
// GetUsers provides a mock function with given fields: ctx, oreq
func (_m *Backend) GetUsers(ctx context.Context, oreq *godata.GoDataRequest) ([]*libregraph.User, error) {
ret := _m.Called(ctx, oreq)
if len(ret) == 0 {
panic("no return value specified for GetUsers")
}
var r0 []*libregraph.User
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *godata.GoDataRequest) ([]*libregraph.User, error)); ok {
@@ -243,10 +556,43 @@ func (_m *Backend) GetUsers(ctx context.Context, oreq *godata.GoDataRequest) ([]
return r0, r1
}
// Backend_GetUsers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetUsers'
type Backend_GetUsers_Call struct {
*mock.Call
}
// GetUsers is a helper method to define mock.On call
// - ctx context.Context
// - oreq *godata.GoDataRequest
func (_e *Backend_Expecter) GetUsers(ctx interface{}, oreq interface{}) *Backend_GetUsers_Call {
return &Backend_GetUsers_Call{Call: _e.mock.On("GetUsers", ctx, oreq)}
}
func (_c *Backend_GetUsers_Call) Run(run func(ctx context.Context, oreq *godata.GoDataRequest)) *Backend_GetUsers_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*godata.GoDataRequest))
})
return _c
}
func (_c *Backend_GetUsers_Call) Return(_a0 []*libregraph.User, _a1 error) *Backend_GetUsers_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Backend_GetUsers_Call) RunAndReturn(run func(context.Context, *godata.GoDataRequest) ([]*libregraph.User, error)) *Backend_GetUsers_Call {
_c.Call.Return(run)
return _c
}
// RemoveMemberFromGroup provides a mock function with given fields: ctx, groupID, memberID
func (_m *Backend) RemoveMemberFromGroup(ctx context.Context, groupID string, memberID string) error {
ret := _m.Called(ctx, groupID, memberID)
if len(ret) == 0 {
panic("no return value specified for RemoveMemberFromGroup")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, string) error); ok {
r0 = rf(ctx, groupID, memberID)
@@ -257,10 +603,44 @@ func (_m *Backend) RemoveMemberFromGroup(ctx context.Context, groupID string, me
return r0
}
// Backend_RemoveMemberFromGroup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveMemberFromGroup'
type Backend_RemoveMemberFromGroup_Call struct {
*mock.Call
}
// RemoveMemberFromGroup is a helper method to define mock.On call
// - ctx context.Context
// - groupID string
// - memberID string
func (_e *Backend_Expecter) RemoveMemberFromGroup(ctx interface{}, groupID interface{}, memberID interface{}) *Backend_RemoveMemberFromGroup_Call {
return &Backend_RemoveMemberFromGroup_Call{Call: _e.mock.On("RemoveMemberFromGroup", ctx, groupID, memberID)}
}
func (_c *Backend_RemoveMemberFromGroup_Call) Run(run func(ctx context.Context, groupID string, memberID string)) *Backend_RemoveMemberFromGroup_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string))
})
return _c
}
func (_c *Backend_RemoveMemberFromGroup_Call) Return(_a0 error) *Backend_RemoveMemberFromGroup_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Backend_RemoveMemberFromGroup_Call) RunAndReturn(run func(context.Context, string, string) error) *Backend_RemoveMemberFromGroup_Call {
_c.Call.Return(run)
return _c
}
// UpdateGroupName provides a mock function with given fields: ctx, groupID, groupName
func (_m *Backend) UpdateGroupName(ctx context.Context, groupID string, groupName string) error {
ret := _m.Called(ctx, groupID, groupName)
if len(ret) == 0 {
panic("no return value specified for UpdateGroupName")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, string) error); ok {
r0 = rf(ctx, groupID, groupName)
@@ -271,10 +651,44 @@ func (_m *Backend) UpdateGroupName(ctx context.Context, groupID string, groupNam
return r0
}
// Backend_UpdateGroupName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateGroupName'
type Backend_UpdateGroupName_Call struct {
*mock.Call
}
// UpdateGroupName is a helper method to define mock.On call
// - ctx context.Context
// - groupID string
// - groupName string
func (_e *Backend_Expecter) UpdateGroupName(ctx interface{}, groupID interface{}, groupName interface{}) *Backend_UpdateGroupName_Call {
return &Backend_UpdateGroupName_Call{Call: _e.mock.On("UpdateGroupName", ctx, groupID, groupName)}
}
func (_c *Backend_UpdateGroupName_Call) Run(run func(ctx context.Context, groupID string, groupName string)) *Backend_UpdateGroupName_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string))
})
return _c
}
func (_c *Backend_UpdateGroupName_Call) Return(_a0 error) *Backend_UpdateGroupName_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Backend_UpdateGroupName_Call) RunAndReturn(run func(context.Context, string, string) error) *Backend_UpdateGroupName_Call {
_c.Call.Return(run)
return _c
}
// UpdateUser provides a mock function with given fields: ctx, nameOrID, user
func (_m *Backend) UpdateUser(ctx context.Context, nameOrID string, user libregraph.User) (*libregraph.User, error) {
ret := _m.Called(ctx, nameOrID, user)
if len(ret) == 0 {
panic("no return value specified for UpdateUser")
}
var r0 *libregraph.User
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, libregraph.User) (*libregraph.User, error)); ok {
@@ -297,13 +711,42 @@ func (_m *Backend) UpdateUser(ctx context.Context, nameOrID string, user libregr
return r0, r1
}
type mockConstructorTestingTNewBackend interface {
mock.TestingT
Cleanup(func())
// Backend_UpdateUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUser'
type Backend_UpdateUser_Call struct {
*mock.Call
}
// UpdateUser is a helper method to define mock.On call
// - ctx context.Context
// - nameOrID string
// - user libregraph.User
func (_e *Backend_Expecter) UpdateUser(ctx interface{}, nameOrID interface{}, user interface{}) *Backend_UpdateUser_Call {
return &Backend_UpdateUser_Call{Call: _e.mock.On("UpdateUser", ctx, nameOrID, user)}
}
func (_c *Backend_UpdateUser_Call) Run(run func(ctx context.Context, nameOrID string, user libregraph.User)) *Backend_UpdateUser_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(libregraph.User))
})
return _c
}
func (_c *Backend_UpdateUser_Call) Return(_a0 *libregraph.User, _a1 error) *Backend_UpdateUser_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Backend_UpdateUser_Call) RunAndReturn(run func(context.Context, string, libregraph.User) (*libregraph.User, error)) *Backend_UpdateUser_Call {
_c.Call.Return(run)
return _c
}
// NewBackend creates a new instance of Backend. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewBackend(t mockConstructorTestingTNewBackend) *Backend {
// The first argument is typically a *testing.T value.
func NewBackend(t interface {
mock.TestingT
Cleanup(func())
}) *Backend {
mock := &Backend{}
mock.Mock.Test(t)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,10 @@
with-expecter: true
filename: "{{.InterfaceName | snakecase }}.go"
mockname: "{{.InterfaceName}}"
outpkg: "mocks"
packages:
github.com/owncloud/ocis/v2/ocis-pkg/keycloak:
config:
dir: "pkg/backends/keycloak/mocks"
interfaces:
Client:

View File

@@ -25,8 +25,7 @@ include ../../.make/generate.mk
.PHONY: ci-go-generate
ci-go-generate: $(MOCKERY) # CI runs ci-node-generate automatically before this target
$(MOCKERY) --output pkg/mocks --case underscore --name Client --srcpkg "github.com/owncloud/ocis/v2/ocis-pkg/keycloak"
$(MOCKERY)
.PHONY: ci-node-generate
ci-node-generate:

View File

@@ -10,8 +10,8 @@ import (
kcpkg "github.com/owncloud/ocis/v2/ocis-pkg/keycloak"
"github.com/owncloud/ocis/v2/ocis-pkg/log"
"github.com/owncloud/ocis/v2/services/invitations/pkg/backends/keycloak"
"github.com/owncloud/ocis/v2/services/invitations/pkg/backends/keycloak/mocks"
"github.com/owncloud/ocis/v2/services/invitations/pkg/invitations"
"github.com/owncloud/ocis/v2/services/invitations/pkg/mocks"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)

View File

@@ -7,8 +7,6 @@ import (
)
// GoCloak represents the parts of gocloak.GoCloak that we use, mainly here for mockery.
//
//go:generate mockery --name=GoCloak
type GoCloak interface {
CreateUser(ctx context.Context, token, realm string, user gocloak.User) (string, error)
ExecuteActionsEmail(ctx context.Context, token, realm string, params gocloak.ExecuteActionsEmail) error

View File

@@ -0,0 +1,267 @@
// Code generated by mockery v2.40.1. DO NOT EDIT.
package mocks
import (
context "context"
libregraph "github.com/owncloud/libre-graph-api-go"
keycloak "github.com/owncloud/ocis/v2/ocis-pkg/keycloak"
mock "github.com/stretchr/testify/mock"
)
// Client is an autogenerated mock type for the Client type
type Client struct {
mock.Mock
}
type Client_Expecter struct {
mock *mock.Mock
}
func (_m *Client) EXPECT() *Client_Expecter {
return &Client_Expecter{mock: &_m.Mock}
}
// CreateUser provides a mock function with given fields: ctx, realm, user, userActions
func (_m *Client) CreateUser(ctx context.Context, realm string, user *libregraph.User, userActions []keycloak.UserAction) (string, error) {
ret := _m.Called(ctx, realm, user, userActions)
if len(ret) == 0 {
panic("no return value specified for CreateUser")
}
var r0 string
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, *libregraph.User, []keycloak.UserAction) (string, error)); ok {
return rf(ctx, realm, user, userActions)
}
if rf, ok := ret.Get(0).(func(context.Context, string, *libregraph.User, []keycloak.UserAction) string); ok {
r0 = rf(ctx, realm, user, userActions)
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func(context.Context, string, *libregraph.User, []keycloak.UserAction) error); ok {
r1 = rf(ctx, realm, user, userActions)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Client_CreateUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateUser'
type Client_CreateUser_Call struct {
*mock.Call
}
// CreateUser is a helper method to define mock.On call
// - ctx context.Context
// - realm string
// - user *libregraph.User
// - userActions []keycloak.UserAction
func (_e *Client_Expecter) CreateUser(ctx interface{}, realm interface{}, user interface{}, userActions interface{}) *Client_CreateUser_Call {
return &Client_CreateUser_Call{Call: _e.mock.On("CreateUser", ctx, realm, user, userActions)}
}
func (_c *Client_CreateUser_Call) Run(run func(ctx context.Context, realm string, user *libregraph.User, userActions []keycloak.UserAction)) *Client_CreateUser_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(*libregraph.User), args[3].([]keycloak.UserAction))
})
return _c
}
func (_c *Client_CreateUser_Call) Return(_a0 string, _a1 error) *Client_CreateUser_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Client_CreateUser_Call) RunAndReturn(run func(context.Context, string, *libregraph.User, []keycloak.UserAction) (string, error)) *Client_CreateUser_Call {
_c.Call.Return(run)
return _c
}
// GetPIIReport provides a mock function with given fields: ctx, realm, username
func (_m *Client) GetPIIReport(ctx context.Context, realm string, username string) (*keycloak.PIIReport, error) {
ret := _m.Called(ctx, realm, username)
if len(ret) == 0 {
panic("no return value specified for GetPIIReport")
}
var r0 *keycloak.PIIReport
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, string) (*keycloak.PIIReport, error)); ok {
return rf(ctx, realm, username)
}
if rf, ok := ret.Get(0).(func(context.Context, string, string) *keycloak.PIIReport); ok {
r0 = rf(ctx, realm, username)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*keycloak.PIIReport)
}
}
if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok {
r1 = rf(ctx, realm, username)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Client_GetPIIReport_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPIIReport'
type Client_GetPIIReport_Call struct {
*mock.Call
}
// GetPIIReport is a helper method to define mock.On call
// - ctx context.Context
// - realm string
// - username string
func (_e *Client_Expecter) GetPIIReport(ctx interface{}, realm interface{}, username interface{}) *Client_GetPIIReport_Call {
return &Client_GetPIIReport_Call{Call: _e.mock.On("GetPIIReport", ctx, realm, username)}
}
func (_c *Client_GetPIIReport_Call) Run(run func(ctx context.Context, realm string, username string)) *Client_GetPIIReport_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string))
})
return _c
}
func (_c *Client_GetPIIReport_Call) Return(_a0 *keycloak.PIIReport, _a1 error) *Client_GetPIIReport_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Client_GetPIIReport_Call) RunAndReturn(run func(context.Context, string, string) (*keycloak.PIIReport, error)) *Client_GetPIIReport_Call {
_c.Call.Return(run)
return _c
}
// GetUserByUsername provides a mock function with given fields: ctx, realm, username
func (_m *Client) GetUserByUsername(ctx context.Context, realm string, username string) (*libregraph.User, error) {
ret := _m.Called(ctx, realm, username)
if len(ret) == 0 {
panic("no return value specified for GetUserByUsername")
}
var r0 *libregraph.User
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, string) (*libregraph.User, error)); ok {
return rf(ctx, realm, username)
}
if rf, ok := ret.Get(0).(func(context.Context, string, string) *libregraph.User); ok {
r0 = rf(ctx, realm, username)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*libregraph.User)
}
}
if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok {
r1 = rf(ctx, realm, username)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Client_GetUserByUsername_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetUserByUsername'
type Client_GetUserByUsername_Call struct {
*mock.Call
}
// GetUserByUsername is a helper method to define mock.On call
// - ctx context.Context
// - realm string
// - username string
func (_e *Client_Expecter) GetUserByUsername(ctx interface{}, realm interface{}, username interface{}) *Client_GetUserByUsername_Call {
return &Client_GetUserByUsername_Call{Call: _e.mock.On("GetUserByUsername", ctx, realm, username)}
}
func (_c *Client_GetUserByUsername_Call) Run(run func(ctx context.Context, realm string, username string)) *Client_GetUserByUsername_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string))
})
return _c
}
func (_c *Client_GetUserByUsername_Call) Return(_a0 *libregraph.User, _a1 error) *Client_GetUserByUsername_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Client_GetUserByUsername_Call) RunAndReturn(run func(context.Context, string, string) (*libregraph.User, error)) *Client_GetUserByUsername_Call {
_c.Call.Return(run)
return _c
}
// SendActionsMail provides a mock function with given fields: ctx, realm, userID, userActions
func (_m *Client) SendActionsMail(ctx context.Context, realm string, userID string, userActions []keycloak.UserAction) error {
ret := _m.Called(ctx, realm, userID, userActions)
if len(ret) == 0 {
panic("no return value specified for SendActionsMail")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, string, []keycloak.UserAction) error); ok {
r0 = rf(ctx, realm, userID, userActions)
} else {
r0 = ret.Error(0)
}
return r0
}
// Client_SendActionsMail_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SendActionsMail'
type Client_SendActionsMail_Call struct {
*mock.Call
}
// SendActionsMail is a helper method to define mock.On call
// - ctx context.Context
// - realm string
// - userID string
// - userActions []keycloak.UserAction
func (_e *Client_Expecter) SendActionsMail(ctx interface{}, realm interface{}, userID interface{}, userActions interface{}) *Client_SendActionsMail_Call {
return &Client_SendActionsMail_Call{Call: _e.mock.On("SendActionsMail", ctx, realm, userID, userActions)}
}
func (_c *Client_SendActionsMail_Call) Run(run func(ctx context.Context, realm string, userID string, userActions []keycloak.UserAction)) *Client_SendActionsMail_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string), args[3].([]keycloak.UserAction))
})
return _c
}
func (_c *Client_SendActionsMail_Call) Return(_a0 error) *Client_SendActionsMail_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Client_SendActionsMail_Call) RunAndReturn(run func(context.Context, string, string, []keycloak.UserAction) error) *Client_SendActionsMail_Call {
_c.Call.Return(run)
return _c
}
// NewClient creates a new instance of Client. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewClient(t interface {
mock.TestingT
Cleanup(func())
}) *Client {
mock := &Client{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -1,122 +0,0 @@
// Code generated by mockery v2.22.1. DO NOT EDIT.
package mocks
import (
context "context"
libregraph "github.com/owncloud/libre-graph-api-go"
keycloak "github.com/owncloud/ocis/v2/ocis-pkg/keycloak"
mock "github.com/stretchr/testify/mock"
)
// Client is an autogenerated mock type for the Client type
type Client struct {
mock.Mock
}
// CreateUser provides a mock function with given fields: ctx, realm, user, userActions
func (_m *Client) CreateUser(ctx context.Context, realm string, user *libregraph.User, userActions []keycloak.UserAction) (string, error) {
ret := _m.Called(ctx, realm, user, userActions)
var r0 string
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, *libregraph.User, []keycloak.UserAction) (string, error)); ok {
return rf(ctx, realm, user, userActions)
}
if rf, ok := ret.Get(0).(func(context.Context, string, *libregraph.User, []keycloak.UserAction) string); ok {
r0 = rf(ctx, realm, user, userActions)
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func(context.Context, string, *libregraph.User, []keycloak.UserAction) error); ok {
r1 = rf(ctx, realm, user, userActions)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetPIIReport provides a mock function with given fields: ctx, realm, username
func (_m *Client) GetPIIReport(ctx context.Context, realm string, username string) (*keycloak.PIIReport, error) {
ret := _m.Called(ctx, realm, username)
var r0 *keycloak.PIIReport
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, string) (*keycloak.PIIReport, error)); ok {
return rf(ctx, realm, username)
}
if rf, ok := ret.Get(0).(func(context.Context, string, string) *keycloak.PIIReport); ok {
r0 = rf(ctx, realm, username)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*keycloak.PIIReport)
}
}
if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok {
r1 = rf(ctx, realm, username)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetUserByUsername provides a mock function with given fields: ctx, realm, username
func (_m *Client) GetUserByUsername(ctx context.Context, realm string, username string) (*libregraph.User, error) {
ret := _m.Called(ctx, realm, username)
var r0 *libregraph.User
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, string) (*libregraph.User, error)); ok {
return rf(ctx, realm, username)
}
if rf, ok := ret.Get(0).(func(context.Context, string, string) *libregraph.User); ok {
r0 = rf(ctx, realm, username)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*libregraph.User)
}
}
if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok {
r1 = rf(ctx, realm, username)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SendActionsMail provides a mock function with given fields: ctx, realm, userID, userActions
func (_m *Client) SendActionsMail(ctx context.Context, realm string, userID string, userActions []keycloak.UserAction) error {
ret := _m.Called(ctx, realm, userID, userActions)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, string, []keycloak.UserAction) error); ok {
r0 = rf(ctx, realm, userID, userActions)
} else {
r0 = ret.Error(0)
}
return r0
}
type mockConstructorTestingTNewClient interface {
mock.TestingT
Cleanup(func())
}
// NewClient creates a new instance of Client. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewClient(t mockConstructorTestingTNewClient) *Client {
mock := &Client{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -24,8 +24,7 @@ docs-generate: config-docs-generate
include ../../.make/generate.mk
.PHONY: ci-go-generate
ci-go-generate: $(MOCKERY) # CI runs ci-node-generate automatically before this target
$(MOCKERY) --dir ../../protogen/gen/ocis/services/policies/v0 --case underscore --name PoliciesProviderService
ci-go-generate: # CI runs ci-node-generate automatically before this target
.PHONY: ci-node-generate
ci-node-generate:

View File

@@ -1,66 +0,0 @@
// Code generated by mockery v2.22.1. DO NOT EDIT.
package mocks
import (
context "context"
client "go-micro.dev/v4/client"
mock "github.com/stretchr/testify/mock"
v0 "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/policies/v0"
)
// PoliciesProviderService is an autogenerated mock type for the PoliciesProviderService type
type PoliciesProviderService struct {
mock.Mock
}
// Evaluate provides a mock function with given fields: ctx, in, opts
func (_m *PoliciesProviderService) Evaluate(ctx context.Context, in *v0.EvaluateRequest, opts ...client.CallOption) (*v0.EvaluateResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *v0.EvaluateResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.EvaluateRequest, ...client.CallOption) (*v0.EvaluateResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *v0.EvaluateRequest, ...client.CallOption) *v0.EvaluateResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v0.EvaluateResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v0.EvaluateRequest, ...client.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
type mockConstructorTestingTNewPoliciesProviderService interface {
mock.TestingT
Cleanup(func())
}
// NewPoliciesProviderService creates a new instance of PoliciesProviderService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewPoliciesProviderService(t mockConstructorTestingTNewPoliciesProviderService) *PoliciesProviderService {
mock := &PoliciesProviderService{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -0,0 +1,67 @@
package middleware
import (
"net/http"
"net/http/httptest"
"time"
"github.com/golang-jwt/jwt/v4"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/owncloud/ocis/v2/ocis-pkg/log"
"github.com/owncloud/ocis/v2/ocis-pkg/oidc"
oidcmocks "github.com/owncloud/ocis/v2/ocis-pkg/oidc/mocks"
"github.com/stretchr/testify/mock"
"go-micro.dev/v4/store"
)
var _ = Describe("Authenticating requests", Label("OIDCAuthenticator"), func() {
var authenticator Authenticator
oc := oidcmocks.OIDCClient{}
oc.On("VerifyAccessToken", mock.Anything, mock.Anything).Return(
oidc.RegClaimsWithSID{
SessionID: "a-session-id",
RegisteredClaims: jwt.RegisteredClaims{
ExpiresAt: jwt.NewNumericDate(time.Unix(1147483647, 0)),
},
}, jwt.MapClaims{
"sid": "a-session-id",
"exp": 1147483647,
},
nil,
)
/*
// to test with skipUserInfo: true, we need to also use an interface so we can mock the UserInfo.Claim call
oc.On("UserInfo", mock.Anything, mock.Anything).Return(
&oidc.UserInfo{
Subject: "my-sub",
EmailVerified: true,
Email: "test@example.org",
},
nil,
)
*/
BeforeEach(func() {
authenticator = &OIDCAuthenticator{
OIDCIss: "http://idp.example.com",
Logger: log.NewLogger(),
oidcClient: &oc,
userInfoCache: store.NewMemoryStore(),
skipUserInfo: true,
}
})
When("the request contains correct data", func() {
It("should successfully authenticate", func() {
req := httptest.NewRequest(http.MethodGet, "http://example.com/example/path", http.NoBody)
req.Header.Set(_headerAuthorization, "Bearer jwt.token.sig")
req2, valid := authenticator.Authenticate(req)
Expect(valid).To(Equal(true))
Expect(req2).ToNot(BeNil())
})
})
})

View File

@@ -39,7 +39,7 @@ type Options struct {
SettingsRoleService settingssvc.RoleService
// PoliciesProviderService for policy evaluation
PoliciesProviderService policiessvc.PoliciesProviderService
// OIDCProviderFunc to lazily initialize an oidc provider, must be set for the oidc_auth middleware
// OIDCClient to fetch user info and verify tokens, must be set for the oidc_auth middleware
OIDCClient oidc.OIDCClient
// OIDCIss is the oidcAuth-issuer
OIDCIss string

View File

@@ -11,19 +11,17 @@ import (
"testing"
gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1"
"github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool"
cs3mocks "github.com/cs3org/reva/v2/tests/cs3mocks/mocks"
. "github.com/onsi/gomega"
pMessage "github.com/owncloud/ocis/v2/protogen/gen/ocis/messages/policies/v0"
policiesPG "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/policies/v0"
"github.com/owncloud/ocis/v2/protogen/gen/ocis/services/policies/v0/mocks"
"github.com/owncloud/ocis/v2/services/proxy/pkg/middleware"
"github.com/owncloud/ocis/v2/services/webdav/pkg/net"
"github.com/stretchr/testify/mock"
"go-micro.dev/v4/client"
"google.golang.org/grpc"
cs3mocks "github.com/cs3org/reva/v2/tests/cs3mocks/mocks"
"github.com/owncloud/ocis/v2/services/proxy/mocks"
"github.com/owncloud/ocis/v2/services/webdav/pkg/net"
"github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool"
pMessage "github.com/owncloud/ocis/v2/protogen/gen/ocis/messages/policies/v0"
policiesPG "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/policies/v0"
"github.com/owncloud/ocis/v2/services/proxy/pkg/middleware"
)
func TestPolicies_NoQuery_PassThrough(t *testing.T) {

View File

@@ -16,8 +16,6 @@ var (
ErrNotSupported = errors.New("operation not supported")
)
//go:generate mockery --name=UserBackend
// UserBackend allows the proxy to retrieve users from different user-backends (accounts-service, CS3)
type UserBackend interface {
GetUserByClaims(ctx context.Context, claim, value string) (*cs3.User, string, error)

View File

@@ -11,8 +11,6 @@ import (
"github.com/owncloud/ocis/v2/services/proxy/pkg/config"
)
//go:generate mockery --name=UserRoleAssigner
// UserRoleAssigner allows providing different implementations for how users get their default roles
// assigned by the proxy during authentication
type UserRoleAssigner interface {

View File

@@ -0,0 +1,16 @@
with-expecter: true
filename: "{{.InterfaceName | snakecase }}.go"
dir: "pkg/{{.PackageName}}/mocks"
mockname: "{{.InterfaceName}}"
outpkg: "mocks"
packages:
github.com/owncloud/ocis/v2/services/search/pkg/engine:
interfaces:
Engine:
github.com/owncloud/ocis/v2/services/search/pkg/content:
interfaces:
Extractor:
Retriever:
github.com/owncloud/ocis/v2/services/search/pkg/search:
interfaces:
Searcher:

View File

@@ -25,10 +25,7 @@ include ../../.make/generate.mk
.PHONY: ci-go-generate
ci-go-generate: $(PIGEON) $(MOCKERY) # CI runs ci-node-generate automatically before this target
$(MOCKERY) --dir pkg/engine --output pkg/engine/mocks --case underscore --name Engine
$(MOCKERY) --dir pkg/content --output pkg/content/mocks --case underscore --name Extractor
$(MOCKERY) --dir pkg/content --output pkg/content/mocks --case underscore --name Retriever
$(MOCKERY) --dir pkg/search --output pkg/search/mocks --case underscore --name Searcher
$(MOCKERY)
$(PIGEON) -optimize-grammar -optimize-parser -o pkg/query/kql/dictionary_gen.go pkg/query/kql/dictionary.peg
.PHONY: ci-node-generate

View File

@@ -9,8 +9,6 @@ import (
)
// Extractor is responsible to extract content and meta information from documents.
//
//go:generate mockery --name=Extractor
type Extractor interface {
Extract(ctx context.Context, ri *provider.ResourceInfo) (Document, error)
}

View File

@@ -1,4 +1,4 @@
// Code generated by mockery v2.22.1. DO NOT EDIT.
// Code generated by mockery v2.40.1. DO NOT EDIT.
package mocks
@@ -17,10 +17,22 @@ type Extractor struct {
mock.Mock
}
type Extractor_Expecter struct {
mock *mock.Mock
}
func (_m *Extractor) EXPECT() *Extractor_Expecter {
return &Extractor_Expecter{mock: &_m.Mock}
}
// Extract provides a mock function with given fields: ctx, ri
func (_m *Extractor) Extract(ctx context.Context, ri *providerv1beta1.ResourceInfo) (content.Document, error) {
ret := _m.Called(ctx, ri)
if len(ret) == 0 {
panic("no return value specified for Extract")
}
var r0 content.Document
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.ResourceInfo) (content.Document, error)); ok {
@@ -41,13 +53,41 @@ func (_m *Extractor) Extract(ctx context.Context, ri *providerv1beta1.ResourceIn
return r0, r1
}
type mockConstructorTestingTNewExtractor interface {
mock.TestingT
Cleanup(func())
// Extractor_Extract_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Extract'
type Extractor_Extract_Call struct {
*mock.Call
}
// Extract is a helper method to define mock.On call
// - ctx context.Context
// - ri *providerv1beta1.ResourceInfo
func (_e *Extractor_Expecter) Extract(ctx interface{}, ri interface{}) *Extractor_Extract_Call {
return &Extractor_Extract_Call{Call: _e.mock.On("Extract", ctx, ri)}
}
func (_c *Extractor_Extract_Call) Run(run func(ctx context.Context, ri *providerv1beta1.ResourceInfo)) *Extractor_Extract_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*providerv1beta1.ResourceInfo))
})
return _c
}
func (_c *Extractor_Extract_Call) Return(_a0 content.Document, _a1 error) *Extractor_Extract_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Extractor_Extract_Call) RunAndReturn(run func(context.Context, *providerv1beta1.ResourceInfo) (content.Document, error)) *Extractor_Extract_Call {
_c.Call.Return(run)
return _c
}
// NewExtractor creates a new instance of Extractor. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewExtractor(t mockConstructorTestingTNewExtractor) *Extractor {
// The first argument is typically a *testing.T value.
func NewExtractor(t interface {
mock.TestingT
Cleanup(func())
}) *Extractor {
mock := &Extractor{}
mock.Mock.Test(t)

View File

@@ -1,4 +1,4 @@
// Code generated by mockery v2.22.1. DO NOT EDIT.
// Code generated by mockery v2.40.1. DO NOT EDIT.
package mocks
@@ -16,10 +16,22 @@ type Retriever struct {
mock.Mock
}
type Retriever_Expecter struct {
mock *mock.Mock
}
func (_m *Retriever) EXPECT() *Retriever_Expecter {
return &Retriever_Expecter{mock: &_m.Mock}
}
// Retrieve provides a mock function with given fields: ctx, rID
func (_m *Retriever) Retrieve(ctx context.Context, rID *providerv1beta1.ResourceId) (io.ReadCloser, error) {
ret := _m.Called(ctx, rID)
if len(ret) == 0 {
panic("no return value specified for Retrieve")
}
var r0 io.ReadCloser
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.ResourceId) (io.ReadCloser, error)); ok {
@@ -42,13 +54,41 @@ func (_m *Retriever) Retrieve(ctx context.Context, rID *providerv1beta1.Resource
return r0, r1
}
type mockConstructorTestingTNewRetriever interface {
mock.TestingT
Cleanup(func())
// Retriever_Retrieve_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Retrieve'
type Retriever_Retrieve_Call struct {
*mock.Call
}
// Retrieve is a helper method to define mock.On call
// - ctx context.Context
// - rID *providerv1beta1.ResourceId
func (_e *Retriever_Expecter) Retrieve(ctx interface{}, rID interface{}) *Retriever_Retrieve_Call {
return &Retriever_Retrieve_Call{Call: _e.mock.On("Retrieve", ctx, rID)}
}
func (_c *Retriever_Retrieve_Call) Run(run func(ctx context.Context, rID *providerv1beta1.ResourceId)) *Retriever_Retrieve_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*providerv1beta1.ResourceId))
})
return _c
}
func (_c *Retriever_Retrieve_Call) Return(_a0 io.ReadCloser, _a1 error) *Retriever_Retrieve_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Retriever_Retrieve_Call) RunAndReturn(run func(context.Context, *providerv1beta1.ResourceId) (io.ReadCloser, error)) *Retriever_Retrieve_Call {
_c.Call.Return(run)
return _c
}
// NewRetriever creates a new instance of Retriever. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewRetriever(t mockConstructorTestingTNewRetriever) *Retriever {
// The first argument is typically a *testing.T value.
func NewRetriever(t interface {
mock.TestingT
Cleanup(func())
}) *Retriever {
mock := &Retriever{}
mock.Mock.Test(t)

View File

@@ -10,8 +10,6 @@ import (
// Retriever is the interface that wraps the basic Retrieve method. 🐕
// It requests and then returns a resource from the underlying storage.
//
//go:generate mockery --name=Retriever
type Retriever interface {
Retrieve(ctx context.Context, rID *provider.ResourceId) (io.ReadCloser, error)
}

View File

@@ -14,8 +14,6 @@ import (
var queryEscape = regexp.MustCompile(`([` + regexp.QuoteMeta(`+=&|><!(){}[]^\"~*?:\/`) + `\-\s])`)
//go:generate mockery --name=Engine
// Engine is the interface to the search engine
type Engine interface {
Search(ctx context.Context, req *searchService.SearchIndexRequest) (*searchService.SearchIndexResponse, error)

View File

@@ -1,4 +1,4 @@
// Code generated by mockery v2.22.1. DO NOT EDIT.
// Code generated by mockery v2.40.1. DO NOT EDIT.
package mocks
@@ -16,10 +16,22 @@ type Engine struct {
mock.Mock
}
type Engine_Expecter struct {
mock *mock.Mock
}
func (_m *Engine) EXPECT() *Engine_Expecter {
return &Engine_Expecter{mock: &_m.Mock}
}
// Delete provides a mock function with given fields: id
func (_m *Engine) Delete(id string) error {
ret := _m.Called(id)
if len(ret) == 0 {
panic("no return value specified for Delete")
}
var r0 error
if rf, ok := ret.Get(0).(func(string) error); ok {
r0 = rf(id)
@@ -30,10 +42,42 @@ func (_m *Engine) Delete(id string) error {
return r0
}
// Engine_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete'
type Engine_Delete_Call struct {
*mock.Call
}
// Delete is a helper method to define mock.On call
// - id string
func (_e *Engine_Expecter) Delete(id interface{}) *Engine_Delete_Call {
return &Engine_Delete_Call{Call: _e.mock.On("Delete", id)}
}
func (_c *Engine_Delete_Call) Run(run func(id string)) *Engine_Delete_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string))
})
return _c
}
func (_c *Engine_Delete_Call) Return(_a0 error) *Engine_Delete_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Engine_Delete_Call) RunAndReturn(run func(string) error) *Engine_Delete_Call {
_c.Call.Return(run)
return _c
}
// DocCount provides a mock function with given fields:
func (_m *Engine) DocCount() (uint64, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for DocCount")
}
var r0 uint64
var r1 error
if rf, ok := ret.Get(0).(func() (uint64, error)); ok {
@@ -54,10 +98,41 @@ func (_m *Engine) DocCount() (uint64, error) {
return r0, r1
}
// Engine_DocCount_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DocCount'
type Engine_DocCount_Call struct {
*mock.Call
}
// DocCount is a helper method to define mock.On call
func (_e *Engine_Expecter) DocCount() *Engine_DocCount_Call {
return &Engine_DocCount_Call{Call: _e.mock.On("DocCount")}
}
func (_c *Engine_DocCount_Call) Run(run func()) *Engine_DocCount_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *Engine_DocCount_Call) Return(_a0 uint64, _a1 error) *Engine_DocCount_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Engine_DocCount_Call) RunAndReturn(run func() (uint64, error)) *Engine_DocCount_Call {
_c.Call.Return(run)
return _c
}
// Move provides a mock function with given fields: id, parentid, target
func (_m *Engine) Move(id string, parentid string, target string) error {
ret := _m.Called(id, parentid, target)
if len(ret) == 0 {
panic("no return value specified for Move")
}
var r0 error
if rf, ok := ret.Get(0).(func(string, string, string) error); ok {
r0 = rf(id, parentid, target)
@@ -68,10 +143,44 @@ func (_m *Engine) Move(id string, parentid string, target string) error {
return r0
}
// Engine_Move_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Move'
type Engine_Move_Call struct {
*mock.Call
}
// Move is a helper method to define mock.On call
// - id string
// - parentid string
// - target string
func (_e *Engine_Expecter) Move(id interface{}, parentid interface{}, target interface{}) *Engine_Move_Call {
return &Engine_Move_Call{Call: _e.mock.On("Move", id, parentid, target)}
}
func (_c *Engine_Move_Call) Run(run func(id string, parentid string, target string)) *Engine_Move_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string), args[1].(string), args[2].(string))
})
return _c
}
func (_c *Engine_Move_Call) Return(_a0 error) *Engine_Move_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Engine_Move_Call) RunAndReturn(run func(string, string, string) error) *Engine_Move_Call {
_c.Call.Return(run)
return _c
}
// Purge provides a mock function with given fields: id
func (_m *Engine) Purge(id string) error {
ret := _m.Called(id)
if len(ret) == 0 {
panic("no return value specified for Purge")
}
var r0 error
if rf, ok := ret.Get(0).(func(string) error); ok {
r0 = rf(id)
@@ -82,10 +191,42 @@ func (_m *Engine) Purge(id string) error {
return r0
}
// Engine_Purge_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Purge'
type Engine_Purge_Call struct {
*mock.Call
}
// Purge is a helper method to define mock.On call
// - id string
func (_e *Engine_Expecter) Purge(id interface{}) *Engine_Purge_Call {
return &Engine_Purge_Call{Call: _e.mock.On("Purge", id)}
}
func (_c *Engine_Purge_Call) Run(run func(id string)) *Engine_Purge_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string))
})
return _c
}
func (_c *Engine_Purge_Call) Return(_a0 error) *Engine_Purge_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Engine_Purge_Call) RunAndReturn(run func(string) error) *Engine_Purge_Call {
_c.Call.Return(run)
return _c
}
// Restore provides a mock function with given fields: id
func (_m *Engine) Restore(id string) error {
ret := _m.Called(id)
if len(ret) == 0 {
panic("no return value specified for Restore")
}
var r0 error
if rf, ok := ret.Get(0).(func(string) error); ok {
r0 = rf(id)
@@ -96,10 +237,42 @@ func (_m *Engine) Restore(id string) error {
return r0
}
// Engine_Restore_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Restore'
type Engine_Restore_Call struct {
*mock.Call
}
// Restore is a helper method to define mock.On call
// - id string
func (_e *Engine_Expecter) Restore(id interface{}) *Engine_Restore_Call {
return &Engine_Restore_Call{Call: _e.mock.On("Restore", id)}
}
func (_c *Engine_Restore_Call) Run(run func(id string)) *Engine_Restore_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string))
})
return _c
}
func (_c *Engine_Restore_Call) Return(_a0 error) *Engine_Restore_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Engine_Restore_Call) RunAndReturn(run func(string) error) *Engine_Restore_Call {
_c.Call.Return(run)
return _c
}
// Search provides a mock function with given fields: ctx, req
func (_m *Engine) Search(ctx context.Context, req *v0.SearchIndexRequest) (*v0.SearchIndexResponse, error) {
ret := _m.Called(ctx, req)
if len(ret) == 0 {
panic("no return value specified for Search")
}
var r0 *v0.SearchIndexResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.SearchIndexRequest) (*v0.SearchIndexResponse, error)); ok {
@@ -122,10 +295,43 @@ func (_m *Engine) Search(ctx context.Context, req *v0.SearchIndexRequest) (*v0.S
return r0, r1
}
// Engine_Search_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Search'
type Engine_Search_Call struct {
*mock.Call
}
// Search is a helper method to define mock.On call
// - ctx context.Context
// - req *v0.SearchIndexRequest
func (_e *Engine_Expecter) Search(ctx interface{}, req interface{}) *Engine_Search_Call {
return &Engine_Search_Call{Call: _e.mock.On("Search", ctx, req)}
}
func (_c *Engine_Search_Call) Run(run func(ctx context.Context, req *v0.SearchIndexRequest)) *Engine_Search_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*v0.SearchIndexRequest))
})
return _c
}
func (_c *Engine_Search_Call) Return(_a0 *v0.SearchIndexResponse, _a1 error) *Engine_Search_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Engine_Search_Call) RunAndReturn(run func(context.Context, *v0.SearchIndexRequest) (*v0.SearchIndexResponse, error)) *Engine_Search_Call {
_c.Call.Return(run)
return _c
}
// Upsert provides a mock function with given fields: id, r
func (_m *Engine) Upsert(id string, r engine.Resource) error {
ret := _m.Called(id, r)
if len(ret) == 0 {
panic("no return value specified for Upsert")
}
var r0 error
if rf, ok := ret.Get(0).(func(string, engine.Resource) error); ok {
r0 = rf(id, r)
@@ -136,13 +342,41 @@ func (_m *Engine) Upsert(id string, r engine.Resource) error {
return r0
}
type mockConstructorTestingTNewEngine interface {
mock.TestingT
Cleanup(func())
// Engine_Upsert_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Upsert'
type Engine_Upsert_Call struct {
*mock.Call
}
// Upsert is a helper method to define mock.On call
// - id string
// - r engine.Resource
func (_e *Engine_Expecter) Upsert(id interface{}, r interface{}) *Engine_Upsert_Call {
return &Engine_Upsert_Call{Call: _e.mock.On("Upsert", id, r)}
}
func (_c *Engine_Upsert_Call) Run(run func(id string, r engine.Resource)) *Engine_Upsert_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string), args[1].(engine.Resource))
})
return _c
}
func (_c *Engine_Upsert_Call) Return(_a0 error) *Engine_Upsert_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Engine_Upsert_Call) RunAndReturn(run func(string, engine.Resource) error) *Engine_Upsert_Call {
_c.Call.Return(run)
return _c
}
// NewEngine creates a new instance of Engine. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewEngine(t mockConstructorTestingTNewEngine) *Engine {
// The first argument is typically a *testing.T value.
func NewEngine(t interface {
mock.TestingT
Cleanup(func())
}) *Engine {
mock := &Engine{}
mock.Mock.Test(t)

View File

@@ -1,4 +1,4 @@
// Code generated by mockery v2.22.1. DO NOT EDIT.
// Code generated by mockery v2.40.1. DO NOT EDIT.
package mocks
@@ -18,10 +18,22 @@ type Searcher struct {
mock.Mock
}
type Searcher_Expecter struct {
mock *mock.Mock
}
func (_m *Searcher) EXPECT() *Searcher_Expecter {
return &Searcher_Expecter{mock: &_m.Mock}
}
// IndexSpace provides a mock function with given fields: rID, uID
func (_m *Searcher) IndexSpace(rID *providerv1beta1.StorageSpaceId, uID *userv1beta1.UserId) error {
ret := _m.Called(rID, uID)
if len(ret) == 0 {
panic("no return value specified for IndexSpace")
}
var r0 error
if rf, ok := ret.Get(0).(func(*providerv1beta1.StorageSpaceId, *userv1beta1.UserId) error); ok {
r0 = rf(rID, uID)
@@ -32,20 +44,111 @@ func (_m *Searcher) IndexSpace(rID *providerv1beta1.StorageSpaceId, uID *userv1b
return r0
}
// Searcher_IndexSpace_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IndexSpace'
type Searcher_IndexSpace_Call struct {
*mock.Call
}
// IndexSpace is a helper method to define mock.On call
// - rID *providerv1beta1.StorageSpaceId
// - uID *userv1beta1.UserId
func (_e *Searcher_Expecter) IndexSpace(rID interface{}, uID interface{}) *Searcher_IndexSpace_Call {
return &Searcher_IndexSpace_Call{Call: _e.mock.On("IndexSpace", rID, uID)}
}
func (_c *Searcher_IndexSpace_Call) Run(run func(rID *providerv1beta1.StorageSpaceId, uID *userv1beta1.UserId)) *Searcher_IndexSpace_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*providerv1beta1.StorageSpaceId), args[1].(*userv1beta1.UserId))
})
return _c
}
func (_c *Searcher_IndexSpace_Call) Return(_a0 error) *Searcher_IndexSpace_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Searcher_IndexSpace_Call) RunAndReturn(run func(*providerv1beta1.StorageSpaceId, *userv1beta1.UserId) error) *Searcher_IndexSpace_Call {
_c.Call.Return(run)
return _c
}
// MoveItem provides a mock function with given fields: ref, uID
func (_m *Searcher) MoveItem(ref *providerv1beta1.Reference, uID *userv1beta1.UserId) {
_m.Called(ref, uID)
}
// Searcher_MoveItem_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MoveItem'
type Searcher_MoveItem_Call struct {
*mock.Call
}
// MoveItem is a helper method to define mock.On call
// - ref *providerv1beta1.Reference
// - uID *userv1beta1.UserId
func (_e *Searcher_Expecter) MoveItem(ref interface{}, uID interface{}) *Searcher_MoveItem_Call {
return &Searcher_MoveItem_Call{Call: _e.mock.On("MoveItem", ref, uID)}
}
func (_c *Searcher_MoveItem_Call) Run(run func(ref *providerv1beta1.Reference, uID *userv1beta1.UserId)) *Searcher_MoveItem_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*providerv1beta1.Reference), args[1].(*userv1beta1.UserId))
})
return _c
}
func (_c *Searcher_MoveItem_Call) Return() *Searcher_MoveItem_Call {
_c.Call.Return()
return _c
}
func (_c *Searcher_MoveItem_Call) RunAndReturn(run func(*providerv1beta1.Reference, *userv1beta1.UserId)) *Searcher_MoveItem_Call {
_c.Call.Return(run)
return _c
}
// RestoreItem provides a mock function with given fields: ref, uID
func (_m *Searcher) RestoreItem(ref *providerv1beta1.Reference, uID *userv1beta1.UserId) {
_m.Called(ref, uID)
}
// Searcher_RestoreItem_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RestoreItem'
type Searcher_RestoreItem_Call struct {
*mock.Call
}
// RestoreItem is a helper method to define mock.On call
// - ref *providerv1beta1.Reference
// - uID *userv1beta1.UserId
func (_e *Searcher_Expecter) RestoreItem(ref interface{}, uID interface{}) *Searcher_RestoreItem_Call {
return &Searcher_RestoreItem_Call{Call: _e.mock.On("RestoreItem", ref, uID)}
}
func (_c *Searcher_RestoreItem_Call) Run(run func(ref *providerv1beta1.Reference, uID *userv1beta1.UserId)) *Searcher_RestoreItem_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*providerv1beta1.Reference), args[1].(*userv1beta1.UserId))
})
return _c
}
func (_c *Searcher_RestoreItem_Call) Return() *Searcher_RestoreItem_Call {
_c.Call.Return()
return _c
}
func (_c *Searcher_RestoreItem_Call) RunAndReturn(run func(*providerv1beta1.Reference, *userv1beta1.UserId)) *Searcher_RestoreItem_Call {
_c.Call.Return(run)
return _c
}
// Search provides a mock function with given fields: ctx, req
func (_m *Searcher) Search(ctx context.Context, req *v0.SearchRequest) (*v0.SearchResponse, error) {
ret := _m.Called(ctx, req)
if len(ret) == 0 {
panic("no return value specified for Search")
}
var r0 *v0.SearchResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.SearchRequest) (*v0.SearchResponse, error)); ok {
@@ -68,23 +171,108 @@ func (_m *Searcher) Search(ctx context.Context, req *v0.SearchRequest) (*v0.Sear
return r0, r1
}
// Searcher_Search_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Search'
type Searcher_Search_Call struct {
*mock.Call
}
// Search is a helper method to define mock.On call
// - ctx context.Context
// - req *v0.SearchRequest
func (_e *Searcher_Expecter) Search(ctx interface{}, req interface{}) *Searcher_Search_Call {
return &Searcher_Search_Call{Call: _e.mock.On("Search", ctx, req)}
}
func (_c *Searcher_Search_Call) Run(run func(ctx context.Context, req *v0.SearchRequest)) *Searcher_Search_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*v0.SearchRequest))
})
return _c
}
func (_c *Searcher_Search_Call) Return(_a0 *v0.SearchResponse, _a1 error) *Searcher_Search_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Searcher_Search_Call) RunAndReturn(run func(context.Context, *v0.SearchRequest) (*v0.SearchResponse, error)) *Searcher_Search_Call {
_c.Call.Return(run)
return _c
}
// TrashItem provides a mock function with given fields: rID
func (_m *Searcher) TrashItem(rID *providerv1beta1.ResourceId) {
_m.Called(rID)
}
// Searcher_TrashItem_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TrashItem'
type Searcher_TrashItem_Call struct {
*mock.Call
}
// TrashItem is a helper method to define mock.On call
// - rID *providerv1beta1.ResourceId
func (_e *Searcher_Expecter) TrashItem(rID interface{}) *Searcher_TrashItem_Call {
return &Searcher_TrashItem_Call{Call: _e.mock.On("TrashItem", rID)}
}
func (_c *Searcher_TrashItem_Call) Run(run func(rID *providerv1beta1.ResourceId)) *Searcher_TrashItem_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*providerv1beta1.ResourceId))
})
return _c
}
func (_c *Searcher_TrashItem_Call) Return() *Searcher_TrashItem_Call {
_c.Call.Return()
return _c
}
func (_c *Searcher_TrashItem_Call) RunAndReturn(run func(*providerv1beta1.ResourceId)) *Searcher_TrashItem_Call {
_c.Call.Return(run)
return _c
}
// UpsertItem provides a mock function with given fields: ref, uID
func (_m *Searcher) UpsertItem(ref *providerv1beta1.Reference, uID *userv1beta1.UserId) {
_m.Called(ref, uID)
}
type mockConstructorTestingTNewSearcher interface {
mock.TestingT
Cleanup(func())
// Searcher_UpsertItem_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpsertItem'
type Searcher_UpsertItem_Call struct {
*mock.Call
}
// UpsertItem is a helper method to define mock.On call
// - ref *providerv1beta1.Reference
// - uID *userv1beta1.UserId
func (_e *Searcher_Expecter) UpsertItem(ref interface{}, uID interface{}) *Searcher_UpsertItem_Call {
return &Searcher_UpsertItem_Call{Call: _e.mock.On("UpsertItem", ref, uID)}
}
func (_c *Searcher_UpsertItem_Call) Run(run func(ref *providerv1beta1.Reference, uID *userv1beta1.UserId)) *Searcher_UpsertItem_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*providerv1beta1.Reference), args[1].(*userv1beta1.UserId))
})
return _c
}
func (_c *Searcher_UpsertItem_Call) Return() *Searcher_UpsertItem_Call {
_c.Call.Return()
return _c
}
func (_c *Searcher_UpsertItem_Call) RunAndReturn(run func(*providerv1beta1.Reference, *userv1beta1.UserId)) *Searcher_UpsertItem_Call {
_c.Call.Return(run)
return _c
}
// NewSearcher creates a new instance of Searcher. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewSearcher(t mockConstructorTestingTNewSearcher) *Searcher {
// The first argument is typically a *testing.T value.
func NewSearcher(t interface {
mock.TestingT
Cleanup(func())
}) *Searcher {
mock := &Searcher{}
mock.Mock.Test(t)

View File

@@ -33,8 +33,6 @@ import (
"github.com/owncloud/ocis/v2/services/search/pkg/engine"
)
//go:generate mockery --name=Searcher
const (
_spaceStateTrashed = "trashed"
_spaceTypeMountpoint = "mountpoint"

View File

@@ -25,8 +25,6 @@ var (
// RegisterFunc stores store constructors
type RegisterFunc func(*config.Config) Manager
//go:generate mockery --name=Manager
// ServiceHandler combines handlers interfaces
type ServiceHandler interface {
settingssvc.BundleServiceHandler

View File

@@ -28,8 +28,7 @@ docs-generate: config-docs-generate
include ../../.make/generate.mk
.PHONY: ci-go-generate
ci-go-generate: $(MOCKERY) # CI runs ci-node-generate automatically before this target
$(MOCKERY) --dir ../../protogen/gen/ocis/services/eventhistory/v0 --case underscore --name EventHistoryService
ci-go-generate: # CI runs ci-node-generate automatically before this target
.PHONY: ci-node-generate
ci-node-generate:

View File

@@ -1,99 +0,0 @@
// Code generated by mockery v2.22.1. DO NOT EDIT.
package mocks
import (
context "context"
client "go-micro.dev/v4/client"
mock "github.com/stretchr/testify/mock"
v0 "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/eventhistory/v0"
)
// EventHistoryService is an autogenerated mock type for the EventHistoryService type
type EventHistoryService struct {
mock.Mock
}
// GetEvents provides a mock function with given fields: ctx, in, opts
func (_m *EventHistoryService) GetEvents(ctx context.Context, in *v0.GetEventsRequest, opts ...client.CallOption) (*v0.GetEventsResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *v0.GetEventsResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.GetEventsRequest, ...client.CallOption) (*v0.GetEventsResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *v0.GetEventsRequest, ...client.CallOption) *v0.GetEventsResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v0.GetEventsResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v0.GetEventsRequest, ...client.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetEventsForUser provides a mock function with given fields: ctx, in, opts
func (_m *EventHistoryService) GetEventsForUser(ctx context.Context, in *v0.GetEventsForUserRequest, opts ...client.CallOption) (*v0.GetEventsResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *v0.GetEventsResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.GetEventsForUserRequest, ...client.CallOption) (*v0.GetEventsResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *v0.GetEventsForUserRequest, ...client.CallOption) *v0.GetEventsResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v0.GetEventsResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *v0.GetEventsForUserRequest, ...client.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
type mockConstructorTestingTNewEventHistoryService interface {
mock.TestingT
Cleanup(func())
}
// NewEventHistoryService creates a new instance of EventHistoryService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewEventHistoryService(t mockConstructorTestingTNewEventHistoryService) *EventHistoryService {
mock := &EventHistoryService{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@@ -22,8 +22,8 @@ import (
"github.com/owncloud/ocis/v2/ocis-pkg/log"
ehmsg "github.com/owncloud/ocis/v2/protogen/gen/ocis/messages/eventhistory/v0"
ehsvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/eventhistory/v0"
"github.com/owncloud/ocis/v2/protogen/gen/ocis/services/eventhistory/v0/mocks"
settingssvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/settings/v0"
"github.com/owncloud/ocis/v2/services/userlog/mocks"
"github.com/owncloud/ocis/v2/services/userlog/pkg/config"
"github.com/owncloud/ocis/v2/services/userlog/pkg/service"
"github.com/stretchr/testify/mock"

View File

@@ -24,9 +24,7 @@ docs-generate: config-docs-generate
include ../../.make/generate.mk
.PHONY: ci-go-generate
ci-go-generate: $(MOCKERY) # CI runs ci-node-generate automatically before this target
$(MOCKERY) --srcpkg github.com/go-ldap/ldap/v3 --case underscore --filename ldapclient.go --name Client
ci-go-generate: # CI runs ci-node-generate automatically before this target
.PHONY: ci-node-generate
ci-node-generate:

View File

@@ -1,428 +0,0 @@
// Code generated by mockery v2.22.1. DO NOT EDIT.
package mocks
import (
ldap "github.com/go-ldap/ldap/v3"
mock "github.com/stretchr/testify/mock"
time "time"
tls "crypto/tls"
)
// Client is an autogenerated mock type for the Client type
type Client struct {
mock.Mock
}
// Add provides a mock function with given fields: _a0
func (_m *Client) Add(_a0 *ldap.AddRequest) error {
ret := _m.Called(_a0)
var r0 error
if rf, ok := ret.Get(0).(func(*ldap.AddRequest) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// Bind provides a mock function with given fields: username, password
func (_m *Client) Bind(username string, password string) error {
ret := _m.Called(username, password)
var r0 error
if rf, ok := ret.Get(0).(func(string, string) error); ok {
r0 = rf(username, password)
} else {
r0 = ret.Error(0)
}
return r0
}
// Close provides a mock function with given fields:
func (_m *Client) Close() error {
ret := _m.Called()
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// Compare provides a mock function with given fields: dn, attribute, value
func (_m *Client) Compare(dn string, attribute string, value string) (bool, error) {
ret := _m.Called(dn, attribute, value)
var r0 bool
var r1 error
if rf, ok := ret.Get(0).(func(string, string, string) (bool, error)); ok {
return rf(dn, attribute, value)
}
if rf, ok := ret.Get(0).(func(string, string, string) bool); ok {
r0 = rf(dn, attribute, value)
} else {
r0 = ret.Get(0).(bool)
}
if rf, ok := ret.Get(1).(func(string, string, string) error); ok {
r1 = rf(dn, attribute, value)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Del provides a mock function with given fields: _a0
func (_m *Client) Del(_a0 *ldap.DelRequest) error {
ret := _m.Called(_a0)
var r0 error
if rf, ok := ret.Get(0).(func(*ldap.DelRequest) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// DirSync provides a mock function with given fields: searchRequest, flags, maxAttrCount, cookie
func (_m *Client) DirSync(searchRequest *ldap.SearchRequest, flags int64, maxAttrCount int64, cookie []byte) (*ldap.SearchResult, error) {
ret := _m.Called(searchRequest, flags, maxAttrCount, cookie)
var r0 *ldap.SearchResult
var r1 error
if rf, ok := ret.Get(0).(func(*ldap.SearchRequest, int64, int64, []byte) (*ldap.SearchResult, error)); ok {
return rf(searchRequest, flags, maxAttrCount, cookie)
}
if rf, ok := ret.Get(0).(func(*ldap.SearchRequest, int64, int64, []byte) *ldap.SearchResult); ok {
r0 = rf(searchRequest, flags, maxAttrCount, cookie)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*ldap.SearchResult)
}
}
if rf, ok := ret.Get(1).(func(*ldap.SearchRequest, int64, int64, []byte) error); ok {
r1 = rf(searchRequest, flags, maxAttrCount, cookie)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ExternalBind provides a mock function with given fields:
func (_m *Client) ExternalBind() error {
ret := _m.Called()
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// GetLastError provides a mock function with given fields:
func (_m *Client) GetLastError() error {
ret := _m.Called()
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// IsClosing provides a mock function with given fields:
func (_m *Client) IsClosing() bool {
ret := _m.Called()
var r0 bool
if rf, ok := ret.Get(0).(func() bool); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// Modify provides a mock function with given fields: _a0
func (_m *Client) Modify(_a0 *ldap.ModifyRequest) error {
ret := _m.Called(_a0)
var r0 error
if rf, ok := ret.Get(0).(func(*ldap.ModifyRequest) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// ModifyDN provides a mock function with given fields: _a0
func (_m *Client) ModifyDN(_a0 *ldap.ModifyDNRequest) error {
ret := _m.Called(_a0)
var r0 error
if rf, ok := ret.Get(0).(func(*ldap.ModifyDNRequest) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// ModifyWithResult provides a mock function with given fields: _a0
func (_m *Client) ModifyWithResult(_a0 *ldap.ModifyRequest) (*ldap.ModifyResult, error) {
ret := _m.Called(_a0)
var r0 *ldap.ModifyResult
var r1 error
if rf, ok := ret.Get(0).(func(*ldap.ModifyRequest) (*ldap.ModifyResult, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(*ldap.ModifyRequest) *ldap.ModifyResult); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*ldap.ModifyResult)
}
}
if rf, ok := ret.Get(1).(func(*ldap.ModifyRequest) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NTLMUnauthenticatedBind provides a mock function with given fields: domain, username
func (_m *Client) NTLMUnauthenticatedBind(domain string, username string) error {
ret := _m.Called(domain, username)
var r0 error
if rf, ok := ret.Get(0).(func(string, string) error); ok {
r0 = rf(domain, username)
} else {
r0 = ret.Error(0)
}
return r0
}
// PasswordModify provides a mock function with given fields: _a0
func (_m *Client) PasswordModify(_a0 *ldap.PasswordModifyRequest) (*ldap.PasswordModifyResult, error) {
ret := _m.Called(_a0)
var r0 *ldap.PasswordModifyResult
var r1 error
if rf, ok := ret.Get(0).(func(*ldap.PasswordModifyRequest) (*ldap.PasswordModifyResult, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(*ldap.PasswordModifyRequest) *ldap.PasswordModifyResult); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*ldap.PasswordModifyResult)
}
}
if rf, ok := ret.Get(1).(func(*ldap.PasswordModifyRequest) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Search provides a mock function with given fields: _a0
func (_m *Client) Search(_a0 *ldap.SearchRequest) (*ldap.SearchResult, error) {
ret := _m.Called(_a0)
var r0 *ldap.SearchResult
var r1 error
if rf, ok := ret.Get(0).(func(*ldap.SearchRequest) (*ldap.SearchResult, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(*ldap.SearchRequest) *ldap.SearchResult); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*ldap.SearchResult)
}
}
if rf, ok := ret.Get(1).(func(*ldap.SearchRequest) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SearchWithPaging provides a mock function with given fields: searchRequest, pagingSize
func (_m *Client) SearchWithPaging(searchRequest *ldap.SearchRequest, pagingSize uint32) (*ldap.SearchResult, error) {
ret := _m.Called(searchRequest, pagingSize)
var r0 *ldap.SearchResult
var r1 error
if rf, ok := ret.Get(0).(func(*ldap.SearchRequest, uint32) (*ldap.SearchResult, error)); ok {
return rf(searchRequest, pagingSize)
}
if rf, ok := ret.Get(0).(func(*ldap.SearchRequest, uint32) *ldap.SearchResult); ok {
r0 = rf(searchRequest, pagingSize)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*ldap.SearchResult)
}
}
if rf, ok := ret.Get(1).(func(*ldap.SearchRequest, uint32) error); ok {
r1 = rf(searchRequest, pagingSize)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SetTimeout provides a mock function with given fields: _a0
func (_m *Client) SetTimeout(_a0 time.Duration) {
_m.Called(_a0)
}
// SimpleBind provides a mock function with given fields: _a0
func (_m *Client) SimpleBind(_a0 *ldap.SimpleBindRequest) (*ldap.SimpleBindResult, error) {
ret := _m.Called(_a0)
var r0 *ldap.SimpleBindResult
var r1 error
if rf, ok := ret.Get(0).(func(*ldap.SimpleBindRequest) (*ldap.SimpleBindResult, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(*ldap.SimpleBindRequest) *ldap.SimpleBindResult); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*ldap.SimpleBindResult)
}
}
if rf, ok := ret.Get(1).(func(*ldap.SimpleBindRequest) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Start provides a mock function with given fields:
func (_m *Client) Start() {
_m.Called()
}
// StartTLS provides a mock function with given fields: _a0
func (_m *Client) StartTLS(_a0 *tls.Config) error {
ret := _m.Called(_a0)
var r0 error
if rf, ok := ret.Get(0).(func(*tls.Config) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// TLSConnectionState provides a mock function with given fields:
func (_m *Client) TLSConnectionState() (tls.ConnectionState, bool) {
ret := _m.Called()
var r0 tls.ConnectionState
var r1 bool
if rf, ok := ret.Get(0).(func() (tls.ConnectionState, bool)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() tls.ConnectionState); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(tls.ConnectionState)
}
if rf, ok := ret.Get(1).(func() bool); ok {
r1 = rf()
} else {
r1 = ret.Get(1).(bool)
}
return r0, r1
}
// UnauthenticatedBind provides a mock function with given fields: username
func (_m *Client) UnauthenticatedBind(username string) error {
ret := _m.Called(username)
var r0 error
if rf, ok := ret.Get(0).(func(string) error); ok {
r0 = rf(username)
} else {
r0 = ret.Error(0)
}
return r0
}
// Unbind provides a mock function with given fields:
func (_m *Client) Unbind() error {
ret := _m.Called()
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
type mockConstructorTestingTNewClient interface {
mock.TestingT
Cleanup(func())
}
// NewClient creates a new instance of Client. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewClient(t mockConstructorTestingTNewClient) *Client {
mock := &Client{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}