diff --git a/.bingo/Variables.mk b/.bingo/Variables.mk index f5672956fc0..6096ca9e33e 100644 --- a/.bingo/Variables.mk +++ b/.bingo/Variables.mk @@ -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 diff --git a/.bingo/mockery.mod b/.bingo/mockery.mod index 01fac917dd3..9c2314f8e4e 100644 --- a/.bingo/mockery.mod +++ b/.bingo/mockery.mod @@ -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 diff --git a/.bingo/mockery.sum b/.bingo/mockery.sum index 8059ae667c4..e06a7204a66 100644 --- a/.bingo/mockery.sum +++ b/.bingo/mockery.sum @@ -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= diff --git a/.bingo/variables.env b/.bingo/variables.env index 6ec460d1cd1..a4673819ca4 100644 --- a/.bingo/variables.env +++ b/.bingo/variables.env @@ -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" diff --git a/ocis-pkg/.mockery.yaml b/ocis-pkg/.mockery.yaml new file mode 100644 index 00000000000..757d5bbaf6a --- /dev/null +++ b/ocis-pkg/.mockery.yaml @@ -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: \ No newline at end of file diff --git a/ocis-pkg/Makefile b/ocis-pkg/Makefile index 7a820fe1337..8fbc711d15a 100644 --- a/ocis-pkg/Makefile +++ b/ocis-pkg/Makefile @@ -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: diff --git a/ocis-pkg/keycloak/gocloak.go b/ocis-pkg/keycloak/gocloak.go index 40262b6e247..b0ab2e3cddd 100644 --- a/ocis-pkg/keycloak/gocloak.go +++ b/ocis-pkg/keycloak/gocloak.go @@ -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) diff --git a/ocis-pkg/oidc/mocks/OIDCProvider.go b/ocis-pkg/oidc/mocks/OIDCProvider.go deleted file mode 100644 index a0396d819b6..00000000000 --- a/ocis-pkg/oidc/mocks/OIDCProvider.go +++ /dev/null @@ -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 -} diff --git a/ocis-pkg/oidc/mocks/oidc_client.go b/ocis-pkg/oidc/mocks/oidc_client.go new file mode 100644 index 00000000000..5a822397341 --- /dev/null +++ b/ocis-pkg/oidc/mocks/oidc_client.go @@ -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 +} diff --git a/protogen/.mockery.yaml b/protogen/.mockery.yaml new file mode 100644 index 00000000000..cf7902b0401 --- /dev/null +++ b/protogen/.mockery.yaml @@ -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: + \ No newline at end of file diff --git a/protogen/Makefile b/protogen/Makefile new file mode 100644 index 00000000000..195c2187623 --- /dev/null +++ b/protogen/Makefile @@ -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) diff --git a/protogen/gen/ocis/services/eventhistory/v0/mocks/event_history_service.go b/protogen/gen/ocis/services/eventhistory/v0/mocks/event_history_service.go new file mode 100644 index 00000000000..c532f80efa8 --- /dev/null +++ b/protogen/gen/ocis/services/eventhistory/v0/mocks/event_history_service.go @@ -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 +} diff --git a/protogen/gen/ocis/services/policies/v0/mocks/policies_provider_service.go b/protogen/gen/ocis/services/policies/v0/mocks/policies_provider_service.go new file mode 100644 index 00000000000..b4917f2be56 --- /dev/null +++ b/protogen/gen/ocis/services/policies/v0/mocks/policies_provider_service.go @@ -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 +} diff --git a/protogen/gen/ocis/services/search/v0/mocks/search_provider_service.go b/protogen/gen/ocis/services/search/v0/mocks/search_provider_service.go new file mode 100644 index 00000000000..eeca1aa5562 --- /dev/null +++ b/protogen/gen/ocis/services/search/v0/mocks/search_provider_service.go @@ -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 +} diff --git a/protogen/gen/ocis/services/settings/v0/mocks/value_service.go b/protogen/gen/ocis/services/settings/v0/mocks/value_service.go new file mode 100644 index 00000000000..8a099b699d9 --- /dev/null +++ b/protogen/gen/ocis/services/settings/v0/mocks/value_service.go @@ -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 +} diff --git a/protogen/gen/ocis/services/store/v0/mocks/store_service.go b/protogen/gen/ocis/services/store/v0/mocks/store_service.go new file mode 100644 index 00000000000..81d65f1548c --- /dev/null +++ b/protogen/gen/ocis/services/store/v0/mocks/store_service.go @@ -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 +} diff --git a/protogen/gen/ocis/services/thumbnails/v0/mocks/thumbnail_service.go b/protogen/gen/ocis/services/thumbnails/v0/mocks/thumbnail_service.go new file mode 100644 index 00000000000..269976d7a56 --- /dev/null +++ b/protogen/gen/ocis/services/thumbnails/v0/mocks/thumbnail_service.go @@ -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 +} diff --git a/services/clientlog/Makefile b/services/clientlog/Makefile index 5cf6d0b10f3..7559c8e8ff8 100644 --- a/services/clientlog/Makefile +++ b/services/clientlog/Makefile @@ -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: diff --git a/services/clientlog/mocks/event_history_service.go b/services/clientlog/mocks/event_history_service.go deleted file mode 100644 index 42580a19a39..00000000000 --- a/services/clientlog/mocks/event_history_service.go +++ /dev/null @@ -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 -} diff --git a/services/graph/.mockery.yaml b/services/graph/.mockery.yaml new file mode 100644 index 00000000000..ccf44b59635 --- /dev/null +++ b/services/graph/.mockery.yaml @@ -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" \ No newline at end of file diff --git a/services/graph/Makefile b/services/graph/Makefile index 34176900550..fe8a84f023a 100644 --- a/services/graph/Makefile +++ b/services/graph/Makefile @@ -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: diff --git a/services/graph/mocks/gateway_client.go b/services/graph/mocks/gateway_client.go deleted file mode 100644 index 49d6b0867f4..00000000000 --- a/services/graph/mocks/gateway_client.go +++ /dev/null @@ -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 -} diff --git a/services/graph/mocks/http_client.go b/services/graph/mocks/http_client.go index a46a482762f..6baaf331917 100644 --- a/services/graph/mocks/http_client.go +++ b/services/graph/mocks/http_client.go @@ -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) diff --git a/services/graph/mocks/ldapclient.go b/services/graph/mocks/ldapclient.go index 923a14c7eb6..f9f1e15b6f6 100644 --- a/services/graph/mocks/ldapclient.go +++ b/services/graph/mocks/ldapclient.go @@ -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 Client struct { mock.Mock } +type Client_Expecter struct { + mock *mock.Mock +} + +func (_m *Client) EXPECT() *Client_Expecter { + return &Client_Expecter{mock: &_m.Mock} +} + // Add provides a mock function with given fields: _a0 func (_m *Client) Add(_a0 *ldap.AddRequest) error { ret := _m.Called(_a0) + if len(ret) == 0 { + panic("no return value specified for Add") + } + var r0 error if rf, ok := ret.Get(0).(func(*ldap.AddRequest) error); ok { r0 = rf(_a0) @@ -32,10 +44,42 @@ func (_m *Client) Add(_a0 *ldap.AddRequest) error { return r0 } +// Client_Add_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Add' +type Client_Add_Call struct { + *mock.Call +} + +// Add is a helper method to define mock.On call +// - _a0 *ldap.AddRequest +func (_e *Client_Expecter) Add(_a0 interface{}) *Client_Add_Call { + return &Client_Add_Call{Call: _e.mock.On("Add", _a0)} +} + +func (_c *Client_Add_Call) Run(run func(_a0 *ldap.AddRequest)) *Client_Add_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*ldap.AddRequest)) + }) + return _c +} + +func (_c *Client_Add_Call) Return(_a0 error) *Client_Add_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_Add_Call) RunAndReturn(run func(*ldap.AddRequest) error) *Client_Add_Call { + _c.Call.Return(run) + return _c +} + // Bind provides a mock function with given fields: username, password func (_m *Client) Bind(username string, password string) error { ret := _m.Called(username, password) + if len(ret) == 0 { + panic("no return value specified for Bind") + } + var r0 error if rf, ok := ret.Get(0).(func(string, string) error); ok { r0 = rf(username, password) @@ -46,10 +90,43 @@ func (_m *Client) Bind(username string, password string) error { return r0 } +// Client_Bind_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Bind' +type Client_Bind_Call struct { + *mock.Call +} + +// Bind is a helper method to define mock.On call +// - username string +// - password string +func (_e *Client_Expecter) Bind(username interface{}, password interface{}) *Client_Bind_Call { + return &Client_Bind_Call{Call: _e.mock.On("Bind", username, password)} +} + +func (_c *Client_Bind_Call) Run(run func(username string, password string)) *Client_Bind_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string)) + }) + return _c +} + +func (_c *Client_Bind_Call) Return(_a0 error) *Client_Bind_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_Bind_Call) RunAndReturn(run func(string, string) error) *Client_Bind_Call { + _c.Call.Return(run) + return _c +} + // Close provides a mock function with given fields: func (_m *Client) Close() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Close") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -60,10 +137,41 @@ func (_m *Client) Close() error { return r0 } +// Client_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close' +type Client_Close_Call struct { + *mock.Call +} + +// Close is a helper method to define mock.On call +func (_e *Client_Expecter) Close() *Client_Close_Call { + return &Client_Close_Call{Call: _e.mock.On("Close")} +} + +func (_c *Client_Close_Call) Run(run func()) *Client_Close_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Client_Close_Call) Return(_a0 error) *Client_Close_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_Close_Call) RunAndReturn(run func() error) *Client_Close_Call { + _c.Call.Return(run) + return _c +} + // 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) + if len(ret) == 0 { + panic("no return value specified for Compare") + } + var r0 bool var r1 error if rf, ok := ret.Get(0).(func(string, string, string) (bool, error)); ok { @@ -84,10 +192,44 @@ func (_m *Client) Compare(dn string, attribute string, value string) (bool, erro return r0, r1 } +// Client_Compare_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Compare' +type Client_Compare_Call struct { + *mock.Call +} + +// Compare is a helper method to define mock.On call +// - dn string +// - attribute string +// - value string +func (_e *Client_Expecter) Compare(dn interface{}, attribute interface{}, value interface{}) *Client_Compare_Call { + return &Client_Compare_Call{Call: _e.mock.On("Compare", dn, attribute, value)} +} + +func (_c *Client_Compare_Call) Run(run func(dn string, attribute string, value string)) *Client_Compare_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *Client_Compare_Call) Return(_a0 bool, _a1 error) *Client_Compare_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Client_Compare_Call) RunAndReturn(run func(string, string, string) (bool, error)) *Client_Compare_Call { + _c.Call.Return(run) + return _c +} + // Del provides a mock function with given fields: _a0 func (_m *Client) Del(_a0 *ldap.DelRequest) error { ret := _m.Called(_a0) + if len(ret) == 0 { + panic("no return value specified for Del") + } + var r0 error if rf, ok := ret.Get(0).(func(*ldap.DelRequest) error); ok { r0 = rf(_a0) @@ -98,10 +240,42 @@ func (_m *Client) Del(_a0 *ldap.DelRequest) error { return r0 } +// Client_Del_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Del' +type Client_Del_Call struct { + *mock.Call +} + +// Del is a helper method to define mock.On call +// - _a0 *ldap.DelRequest +func (_e *Client_Expecter) Del(_a0 interface{}) *Client_Del_Call { + return &Client_Del_Call{Call: _e.mock.On("Del", _a0)} +} + +func (_c *Client_Del_Call) Run(run func(_a0 *ldap.DelRequest)) *Client_Del_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*ldap.DelRequest)) + }) + return _c +} + +func (_c *Client_Del_Call) Return(_a0 error) *Client_Del_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_Del_Call) RunAndReturn(run func(*ldap.DelRequest) error) *Client_Del_Call { + _c.Call.Return(run) + return _c +} + // 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) + if len(ret) == 0 { + panic("no return value specified for DirSync") + } + var r0 *ldap.SearchResult var r1 error if rf, ok := ret.Get(0).(func(*ldap.SearchRequest, int64, int64, []byte) (*ldap.SearchResult, error)); ok { @@ -124,10 +298,45 @@ func (_m *Client) DirSync(searchRequest *ldap.SearchRequest, flags int64, maxAtt return r0, r1 } +// Client_DirSync_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DirSync' +type Client_DirSync_Call struct { + *mock.Call +} + +// DirSync is a helper method to define mock.On call +// - searchRequest *ldap.SearchRequest +// - flags int64 +// - maxAttrCount int64 +// - cookie []byte +func (_e *Client_Expecter) DirSync(searchRequest interface{}, flags interface{}, maxAttrCount interface{}, cookie interface{}) *Client_DirSync_Call { + return &Client_DirSync_Call{Call: _e.mock.On("DirSync", searchRequest, flags, maxAttrCount, cookie)} +} + +func (_c *Client_DirSync_Call) Run(run func(searchRequest *ldap.SearchRequest, flags int64, maxAttrCount int64, cookie []byte)) *Client_DirSync_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*ldap.SearchRequest), args[1].(int64), args[2].(int64), args[3].([]byte)) + }) + return _c +} + +func (_c *Client_DirSync_Call) Return(_a0 *ldap.SearchResult, _a1 error) *Client_DirSync_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Client_DirSync_Call) RunAndReturn(run func(*ldap.SearchRequest, int64, int64, []byte) (*ldap.SearchResult, error)) *Client_DirSync_Call { + _c.Call.Return(run) + return _c +} + // DirSyncAsync provides a mock function with given fields: ctx, searchRequest, bufferSize, flags, maxAttrCount, cookie func (_m *Client) DirSyncAsync(ctx context.Context, searchRequest *ldap.SearchRequest, bufferSize int, flags int64, maxAttrCount int64, cookie []byte) ldap.Response { ret := _m.Called(ctx, searchRequest, bufferSize, flags, maxAttrCount, cookie) + if len(ret) == 0 { + panic("no return value specified for DirSyncAsync") + } + var r0 ldap.Response if rf, ok := ret.Get(0).(func(context.Context, *ldap.SearchRequest, int, int64, int64, []byte) ldap.Response); ok { r0 = rf(ctx, searchRequest, bufferSize, flags, maxAttrCount, cookie) @@ -140,10 +349,47 @@ func (_m *Client) DirSyncAsync(ctx context.Context, searchRequest *ldap.SearchRe return r0 } +// Client_DirSyncAsync_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DirSyncAsync' +type Client_DirSyncAsync_Call struct { + *mock.Call +} + +// DirSyncAsync is a helper method to define mock.On call +// - ctx context.Context +// - searchRequest *ldap.SearchRequest +// - bufferSize int +// - flags int64 +// - maxAttrCount int64 +// - cookie []byte +func (_e *Client_Expecter) DirSyncAsync(ctx interface{}, searchRequest interface{}, bufferSize interface{}, flags interface{}, maxAttrCount interface{}, cookie interface{}) *Client_DirSyncAsync_Call { + return &Client_DirSyncAsync_Call{Call: _e.mock.On("DirSyncAsync", ctx, searchRequest, bufferSize, flags, maxAttrCount, cookie)} +} + +func (_c *Client_DirSyncAsync_Call) Run(run func(ctx context.Context, searchRequest *ldap.SearchRequest, bufferSize int, flags int64, maxAttrCount int64, cookie []byte)) *Client_DirSyncAsync_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*ldap.SearchRequest), args[2].(int), args[3].(int64), args[4].(int64), args[5].([]byte)) + }) + return _c +} + +func (_c *Client_DirSyncAsync_Call) Return(_a0 ldap.Response) *Client_DirSyncAsync_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_DirSyncAsync_Call) RunAndReturn(run func(context.Context, *ldap.SearchRequest, int, int64, int64, []byte) ldap.Response) *Client_DirSyncAsync_Call { + _c.Call.Return(run) + return _c +} + // ExternalBind provides a mock function with given fields: func (_m *Client) ExternalBind() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ExternalBind") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -154,10 +400,41 @@ func (_m *Client) ExternalBind() error { return r0 } +// Client_ExternalBind_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ExternalBind' +type Client_ExternalBind_Call struct { + *mock.Call +} + +// ExternalBind is a helper method to define mock.On call +func (_e *Client_Expecter) ExternalBind() *Client_ExternalBind_Call { + return &Client_ExternalBind_Call{Call: _e.mock.On("ExternalBind")} +} + +func (_c *Client_ExternalBind_Call) Run(run func()) *Client_ExternalBind_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Client_ExternalBind_Call) Return(_a0 error) *Client_ExternalBind_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_ExternalBind_Call) RunAndReturn(run func() error) *Client_ExternalBind_Call { + _c.Call.Return(run) + return _c +} + // GetLastError provides a mock function with given fields: func (_m *Client) GetLastError() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetLastError") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -168,10 +445,41 @@ func (_m *Client) GetLastError() error { return r0 } +// Client_GetLastError_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLastError' +type Client_GetLastError_Call struct { + *mock.Call +} + +// GetLastError is a helper method to define mock.On call +func (_e *Client_Expecter) GetLastError() *Client_GetLastError_Call { + return &Client_GetLastError_Call{Call: _e.mock.On("GetLastError")} +} + +func (_c *Client_GetLastError_Call) Run(run func()) *Client_GetLastError_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Client_GetLastError_Call) Return(_a0 error) *Client_GetLastError_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_GetLastError_Call) RunAndReturn(run func() error) *Client_GetLastError_Call { + _c.Call.Return(run) + return _c +} + // IsClosing provides a mock function with given fields: func (_m *Client) IsClosing() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for IsClosing") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -182,10 +490,41 @@ func (_m *Client) IsClosing() bool { return r0 } +// Client_IsClosing_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsClosing' +type Client_IsClosing_Call struct { + *mock.Call +} + +// IsClosing is a helper method to define mock.On call +func (_e *Client_Expecter) IsClosing() *Client_IsClosing_Call { + return &Client_IsClosing_Call{Call: _e.mock.On("IsClosing")} +} + +func (_c *Client_IsClosing_Call) Run(run func()) *Client_IsClosing_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Client_IsClosing_Call) Return(_a0 bool) *Client_IsClosing_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_IsClosing_Call) RunAndReturn(run func() bool) *Client_IsClosing_Call { + _c.Call.Return(run) + return _c +} + // Modify provides a mock function with given fields: _a0 func (_m *Client) Modify(_a0 *ldap.ModifyRequest) error { ret := _m.Called(_a0) + if len(ret) == 0 { + panic("no return value specified for Modify") + } + var r0 error if rf, ok := ret.Get(0).(func(*ldap.ModifyRequest) error); ok { r0 = rf(_a0) @@ -196,10 +535,42 @@ func (_m *Client) Modify(_a0 *ldap.ModifyRequest) error { return r0 } +// Client_Modify_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Modify' +type Client_Modify_Call struct { + *mock.Call +} + +// Modify is a helper method to define mock.On call +// - _a0 *ldap.ModifyRequest +func (_e *Client_Expecter) Modify(_a0 interface{}) *Client_Modify_Call { + return &Client_Modify_Call{Call: _e.mock.On("Modify", _a0)} +} + +func (_c *Client_Modify_Call) Run(run func(_a0 *ldap.ModifyRequest)) *Client_Modify_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*ldap.ModifyRequest)) + }) + return _c +} + +func (_c *Client_Modify_Call) Return(_a0 error) *Client_Modify_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_Modify_Call) RunAndReturn(run func(*ldap.ModifyRequest) error) *Client_Modify_Call { + _c.Call.Return(run) + return _c +} + // ModifyDN provides a mock function with given fields: _a0 func (_m *Client) ModifyDN(_a0 *ldap.ModifyDNRequest) error { ret := _m.Called(_a0) + if len(ret) == 0 { + panic("no return value specified for ModifyDN") + } + var r0 error if rf, ok := ret.Get(0).(func(*ldap.ModifyDNRequest) error); ok { r0 = rf(_a0) @@ -210,10 +581,42 @@ func (_m *Client) ModifyDN(_a0 *ldap.ModifyDNRequest) error { return r0 } +// Client_ModifyDN_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ModifyDN' +type Client_ModifyDN_Call struct { + *mock.Call +} + +// ModifyDN is a helper method to define mock.On call +// - _a0 *ldap.ModifyDNRequest +func (_e *Client_Expecter) ModifyDN(_a0 interface{}) *Client_ModifyDN_Call { + return &Client_ModifyDN_Call{Call: _e.mock.On("ModifyDN", _a0)} +} + +func (_c *Client_ModifyDN_Call) Run(run func(_a0 *ldap.ModifyDNRequest)) *Client_ModifyDN_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*ldap.ModifyDNRequest)) + }) + return _c +} + +func (_c *Client_ModifyDN_Call) Return(_a0 error) *Client_ModifyDN_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_ModifyDN_Call) RunAndReturn(run func(*ldap.ModifyDNRequest) error) *Client_ModifyDN_Call { + _c.Call.Return(run) + return _c +} + // ModifyWithResult provides a mock function with given fields: _a0 func (_m *Client) ModifyWithResult(_a0 *ldap.ModifyRequest) (*ldap.ModifyResult, error) { ret := _m.Called(_a0) + if len(ret) == 0 { + panic("no return value specified for ModifyWithResult") + } + var r0 *ldap.ModifyResult var r1 error if rf, ok := ret.Get(0).(func(*ldap.ModifyRequest) (*ldap.ModifyResult, error)); ok { @@ -236,10 +639,42 @@ func (_m *Client) ModifyWithResult(_a0 *ldap.ModifyRequest) (*ldap.ModifyResult, return r0, r1 } +// Client_ModifyWithResult_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ModifyWithResult' +type Client_ModifyWithResult_Call struct { + *mock.Call +} + +// ModifyWithResult is a helper method to define mock.On call +// - _a0 *ldap.ModifyRequest +func (_e *Client_Expecter) ModifyWithResult(_a0 interface{}) *Client_ModifyWithResult_Call { + return &Client_ModifyWithResult_Call{Call: _e.mock.On("ModifyWithResult", _a0)} +} + +func (_c *Client_ModifyWithResult_Call) Run(run func(_a0 *ldap.ModifyRequest)) *Client_ModifyWithResult_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*ldap.ModifyRequest)) + }) + return _c +} + +func (_c *Client_ModifyWithResult_Call) Return(_a0 *ldap.ModifyResult, _a1 error) *Client_ModifyWithResult_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Client_ModifyWithResult_Call) RunAndReturn(run func(*ldap.ModifyRequest) (*ldap.ModifyResult, error)) *Client_ModifyWithResult_Call { + _c.Call.Return(run) + return _c +} + // NTLMUnauthenticatedBind provides a mock function with given fields: domain, username func (_m *Client) NTLMUnauthenticatedBind(domain string, username string) error { ret := _m.Called(domain, username) + if len(ret) == 0 { + panic("no return value specified for NTLMUnauthenticatedBind") + } + var r0 error if rf, ok := ret.Get(0).(func(string, string) error); ok { r0 = rf(domain, username) @@ -250,10 +685,43 @@ func (_m *Client) NTLMUnauthenticatedBind(domain string, username string) error return r0 } +// Client_NTLMUnauthenticatedBind_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NTLMUnauthenticatedBind' +type Client_NTLMUnauthenticatedBind_Call struct { + *mock.Call +} + +// NTLMUnauthenticatedBind is a helper method to define mock.On call +// - domain string +// - username string +func (_e *Client_Expecter) NTLMUnauthenticatedBind(domain interface{}, username interface{}) *Client_NTLMUnauthenticatedBind_Call { + return &Client_NTLMUnauthenticatedBind_Call{Call: _e.mock.On("NTLMUnauthenticatedBind", domain, username)} +} + +func (_c *Client_NTLMUnauthenticatedBind_Call) Run(run func(domain string, username string)) *Client_NTLMUnauthenticatedBind_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string)) + }) + return _c +} + +func (_c *Client_NTLMUnauthenticatedBind_Call) Return(_a0 error) *Client_NTLMUnauthenticatedBind_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_NTLMUnauthenticatedBind_Call) RunAndReturn(run func(string, string) error) *Client_NTLMUnauthenticatedBind_Call { + _c.Call.Return(run) + return _c +} + // PasswordModify provides a mock function with given fields: _a0 func (_m *Client) PasswordModify(_a0 *ldap.PasswordModifyRequest) (*ldap.PasswordModifyResult, error) { ret := _m.Called(_a0) + if len(ret) == 0 { + panic("no return value specified for PasswordModify") + } + var r0 *ldap.PasswordModifyResult var r1 error if rf, ok := ret.Get(0).(func(*ldap.PasswordModifyRequest) (*ldap.PasswordModifyResult, error)); ok { @@ -276,10 +744,42 @@ func (_m *Client) PasswordModify(_a0 *ldap.PasswordModifyRequest) (*ldap.Passwor return r0, r1 } +// Client_PasswordModify_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PasswordModify' +type Client_PasswordModify_Call struct { + *mock.Call +} + +// PasswordModify is a helper method to define mock.On call +// - _a0 *ldap.PasswordModifyRequest +func (_e *Client_Expecter) PasswordModify(_a0 interface{}) *Client_PasswordModify_Call { + return &Client_PasswordModify_Call{Call: _e.mock.On("PasswordModify", _a0)} +} + +func (_c *Client_PasswordModify_Call) Run(run func(_a0 *ldap.PasswordModifyRequest)) *Client_PasswordModify_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*ldap.PasswordModifyRequest)) + }) + return _c +} + +func (_c *Client_PasswordModify_Call) Return(_a0 *ldap.PasswordModifyResult, _a1 error) *Client_PasswordModify_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Client_PasswordModify_Call) RunAndReturn(run func(*ldap.PasswordModifyRequest) (*ldap.PasswordModifyResult, error)) *Client_PasswordModify_Call { + _c.Call.Return(run) + return _c +} + // Search provides a mock function with given fields: _a0 func (_m *Client) Search(_a0 *ldap.SearchRequest) (*ldap.SearchResult, error) { ret := _m.Called(_a0) + if len(ret) == 0 { + panic("no return value specified for Search") + } + var r0 *ldap.SearchResult var r1 error if rf, ok := ret.Get(0).(func(*ldap.SearchRequest) (*ldap.SearchResult, error)); ok { @@ -302,10 +802,42 @@ func (_m *Client) Search(_a0 *ldap.SearchRequest) (*ldap.SearchResult, error) { return r0, r1 } +// Client_Search_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Search' +type Client_Search_Call struct { + *mock.Call +} + +// Search is a helper method to define mock.On call +// - _a0 *ldap.SearchRequest +func (_e *Client_Expecter) Search(_a0 interface{}) *Client_Search_Call { + return &Client_Search_Call{Call: _e.mock.On("Search", _a0)} +} + +func (_c *Client_Search_Call) Run(run func(_a0 *ldap.SearchRequest)) *Client_Search_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*ldap.SearchRequest)) + }) + return _c +} + +func (_c *Client_Search_Call) Return(_a0 *ldap.SearchResult, _a1 error) *Client_Search_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Client_Search_Call) RunAndReturn(run func(*ldap.SearchRequest) (*ldap.SearchResult, error)) *Client_Search_Call { + _c.Call.Return(run) + return _c +} + // SearchAsync provides a mock function with given fields: ctx, searchRequest, bufferSize func (_m *Client) SearchAsync(ctx context.Context, searchRequest *ldap.SearchRequest, bufferSize int) ldap.Response { ret := _m.Called(ctx, searchRequest, bufferSize) + if len(ret) == 0 { + panic("no return value specified for SearchAsync") + } + var r0 ldap.Response if rf, ok := ret.Get(0).(func(context.Context, *ldap.SearchRequest, int) ldap.Response); ok { r0 = rf(ctx, searchRequest, bufferSize) @@ -318,10 +850,44 @@ func (_m *Client) SearchAsync(ctx context.Context, searchRequest *ldap.SearchReq return r0 } +// Client_SearchAsync_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SearchAsync' +type Client_SearchAsync_Call struct { + *mock.Call +} + +// SearchAsync is a helper method to define mock.On call +// - ctx context.Context +// - searchRequest *ldap.SearchRequest +// - bufferSize int +func (_e *Client_Expecter) SearchAsync(ctx interface{}, searchRequest interface{}, bufferSize interface{}) *Client_SearchAsync_Call { + return &Client_SearchAsync_Call{Call: _e.mock.On("SearchAsync", ctx, searchRequest, bufferSize)} +} + +func (_c *Client_SearchAsync_Call) Run(run func(ctx context.Context, searchRequest *ldap.SearchRequest, bufferSize int)) *Client_SearchAsync_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*ldap.SearchRequest), args[2].(int)) + }) + return _c +} + +func (_c *Client_SearchAsync_Call) Return(_a0 ldap.Response) *Client_SearchAsync_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_SearchAsync_Call) RunAndReturn(run func(context.Context, *ldap.SearchRequest, int) ldap.Response) *Client_SearchAsync_Call { + _c.Call.Return(run) + return _c +} + // 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) + if len(ret) == 0 { + panic("no return value specified for SearchWithPaging") + } + var r0 *ldap.SearchResult var r1 error if rf, ok := ret.Get(0).(func(*ldap.SearchRequest, uint32) (*ldap.SearchResult, error)); ok { @@ -344,15 +910,76 @@ func (_m *Client) SearchWithPaging(searchRequest *ldap.SearchRequest, pagingSize return r0, r1 } +// Client_SearchWithPaging_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SearchWithPaging' +type Client_SearchWithPaging_Call struct { + *mock.Call +} + +// SearchWithPaging is a helper method to define mock.On call +// - searchRequest *ldap.SearchRequest +// - pagingSize uint32 +func (_e *Client_Expecter) SearchWithPaging(searchRequest interface{}, pagingSize interface{}) *Client_SearchWithPaging_Call { + return &Client_SearchWithPaging_Call{Call: _e.mock.On("SearchWithPaging", searchRequest, pagingSize)} +} + +func (_c *Client_SearchWithPaging_Call) Run(run func(searchRequest *ldap.SearchRequest, pagingSize uint32)) *Client_SearchWithPaging_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*ldap.SearchRequest), args[1].(uint32)) + }) + return _c +} + +func (_c *Client_SearchWithPaging_Call) Return(_a0 *ldap.SearchResult, _a1 error) *Client_SearchWithPaging_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Client_SearchWithPaging_Call) RunAndReturn(run func(*ldap.SearchRequest, uint32) (*ldap.SearchResult, error)) *Client_SearchWithPaging_Call { + _c.Call.Return(run) + return _c +} + // SetTimeout provides a mock function with given fields: _a0 func (_m *Client) SetTimeout(_a0 time.Duration) { _m.Called(_a0) } +// Client_SetTimeout_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetTimeout' +type Client_SetTimeout_Call struct { + *mock.Call +} + +// SetTimeout is a helper method to define mock.On call +// - _a0 time.Duration +func (_e *Client_Expecter) SetTimeout(_a0 interface{}) *Client_SetTimeout_Call { + return &Client_SetTimeout_Call{Call: _e.mock.On("SetTimeout", _a0)} +} + +func (_c *Client_SetTimeout_Call) Run(run func(_a0 time.Duration)) *Client_SetTimeout_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(time.Duration)) + }) + return _c +} + +func (_c *Client_SetTimeout_Call) Return() *Client_SetTimeout_Call { + _c.Call.Return() + return _c +} + +func (_c *Client_SetTimeout_Call) RunAndReturn(run func(time.Duration)) *Client_SetTimeout_Call { + _c.Call.Return(run) + return _c +} + // SimpleBind provides a mock function with given fields: _a0 func (_m *Client) SimpleBind(_a0 *ldap.SimpleBindRequest) (*ldap.SimpleBindResult, error) { ret := _m.Called(_a0) + if len(ret) == 0 { + panic("no return value specified for SimpleBind") + } + var r0 *ldap.SimpleBindResult var r1 error if rf, ok := ret.Get(0).(func(*ldap.SimpleBindRequest) (*ldap.SimpleBindResult, error)); ok { @@ -375,15 +1002,74 @@ func (_m *Client) SimpleBind(_a0 *ldap.SimpleBindRequest) (*ldap.SimpleBindResul return r0, r1 } +// Client_SimpleBind_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SimpleBind' +type Client_SimpleBind_Call struct { + *mock.Call +} + +// SimpleBind is a helper method to define mock.On call +// - _a0 *ldap.SimpleBindRequest +func (_e *Client_Expecter) SimpleBind(_a0 interface{}) *Client_SimpleBind_Call { + return &Client_SimpleBind_Call{Call: _e.mock.On("SimpleBind", _a0)} +} + +func (_c *Client_SimpleBind_Call) Run(run func(_a0 *ldap.SimpleBindRequest)) *Client_SimpleBind_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*ldap.SimpleBindRequest)) + }) + return _c +} + +func (_c *Client_SimpleBind_Call) Return(_a0 *ldap.SimpleBindResult, _a1 error) *Client_SimpleBind_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Client_SimpleBind_Call) RunAndReturn(run func(*ldap.SimpleBindRequest) (*ldap.SimpleBindResult, error)) *Client_SimpleBind_Call { + _c.Call.Return(run) + return _c +} + // Start provides a mock function with given fields: func (_m *Client) Start() { _m.Called() } +// Client_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start' +type Client_Start_Call struct { + *mock.Call +} + +// Start is a helper method to define mock.On call +func (_e *Client_Expecter) Start() *Client_Start_Call { + return &Client_Start_Call{Call: _e.mock.On("Start")} +} + +func (_c *Client_Start_Call) Run(run func()) *Client_Start_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Client_Start_Call) Return() *Client_Start_Call { + _c.Call.Return() + return _c +} + +func (_c *Client_Start_Call) RunAndReturn(run func()) *Client_Start_Call { + _c.Call.Return(run) + return _c +} + // StartTLS provides a mock function with given fields: _a0 func (_m *Client) StartTLS(_a0 *tls.Config) error { ret := _m.Called(_a0) + if len(ret) == 0 { + panic("no return value specified for StartTLS") + } + var r0 error if rf, ok := ret.Get(0).(func(*tls.Config) error); ok { r0 = rf(_a0) @@ -394,10 +1080,42 @@ func (_m *Client) StartTLS(_a0 *tls.Config) error { return r0 } +// Client_StartTLS_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StartTLS' +type Client_StartTLS_Call struct { + *mock.Call +} + +// StartTLS is a helper method to define mock.On call +// - _a0 *tls.Config +func (_e *Client_Expecter) StartTLS(_a0 interface{}) *Client_StartTLS_Call { + return &Client_StartTLS_Call{Call: _e.mock.On("StartTLS", _a0)} +} + +func (_c *Client_StartTLS_Call) Run(run func(_a0 *tls.Config)) *Client_StartTLS_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*tls.Config)) + }) + return _c +} + +func (_c *Client_StartTLS_Call) Return(_a0 error) *Client_StartTLS_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_StartTLS_Call) RunAndReturn(run func(*tls.Config) error) *Client_StartTLS_Call { + _c.Call.Return(run) + return _c +} + // Syncrepl provides a mock function with given fields: ctx, searchRequest, bufferSize, mode, cookie, reloadHint func (_m *Client) Syncrepl(ctx context.Context, searchRequest *ldap.SearchRequest, bufferSize int, mode ldap.ControlSyncRequestMode, cookie []byte, reloadHint bool) ldap.Response { ret := _m.Called(ctx, searchRequest, bufferSize, mode, cookie, reloadHint) + if len(ret) == 0 { + panic("no return value specified for Syncrepl") + } + var r0 ldap.Response if rf, ok := ret.Get(0).(func(context.Context, *ldap.SearchRequest, int, ldap.ControlSyncRequestMode, []byte, bool) ldap.Response); ok { r0 = rf(ctx, searchRequest, bufferSize, mode, cookie, reloadHint) @@ -410,10 +1128,47 @@ func (_m *Client) Syncrepl(ctx context.Context, searchRequest *ldap.SearchReques return r0 } +// Client_Syncrepl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Syncrepl' +type Client_Syncrepl_Call struct { + *mock.Call +} + +// Syncrepl is a helper method to define mock.On call +// - ctx context.Context +// - searchRequest *ldap.SearchRequest +// - bufferSize int +// - mode ldap.ControlSyncRequestMode +// - cookie []byte +// - reloadHint bool +func (_e *Client_Expecter) Syncrepl(ctx interface{}, searchRequest interface{}, bufferSize interface{}, mode interface{}, cookie interface{}, reloadHint interface{}) *Client_Syncrepl_Call { + return &Client_Syncrepl_Call{Call: _e.mock.On("Syncrepl", ctx, searchRequest, bufferSize, mode, cookie, reloadHint)} +} + +func (_c *Client_Syncrepl_Call) Run(run func(ctx context.Context, searchRequest *ldap.SearchRequest, bufferSize int, mode ldap.ControlSyncRequestMode, cookie []byte, reloadHint bool)) *Client_Syncrepl_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*ldap.SearchRequest), args[2].(int), args[3].(ldap.ControlSyncRequestMode), args[4].([]byte), args[5].(bool)) + }) + return _c +} + +func (_c *Client_Syncrepl_Call) Return(_a0 ldap.Response) *Client_Syncrepl_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_Syncrepl_Call) RunAndReturn(run func(context.Context, *ldap.SearchRequest, int, ldap.ControlSyncRequestMode, []byte, bool) ldap.Response) *Client_Syncrepl_Call { + _c.Call.Return(run) + return _c +} + // TLSConnectionState provides a mock function with given fields: func (_m *Client) TLSConnectionState() (tls.ConnectionState, bool) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for TLSConnectionState") + } + var r0 tls.ConnectionState var r1 bool if rf, ok := ret.Get(0).(func() (tls.ConnectionState, bool)); ok { @@ -434,10 +1189,41 @@ func (_m *Client) TLSConnectionState() (tls.ConnectionState, bool) { return r0, r1 } +// Client_TLSConnectionState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TLSConnectionState' +type Client_TLSConnectionState_Call struct { + *mock.Call +} + +// TLSConnectionState is a helper method to define mock.On call +func (_e *Client_Expecter) TLSConnectionState() *Client_TLSConnectionState_Call { + return &Client_TLSConnectionState_Call{Call: _e.mock.On("TLSConnectionState")} +} + +func (_c *Client_TLSConnectionState_Call) Run(run func()) *Client_TLSConnectionState_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Client_TLSConnectionState_Call) Return(_a0 tls.ConnectionState, _a1 bool) *Client_TLSConnectionState_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Client_TLSConnectionState_Call) RunAndReturn(run func() (tls.ConnectionState, bool)) *Client_TLSConnectionState_Call { + _c.Call.Return(run) + return _c +} + // UnauthenticatedBind provides a mock function with given fields: username func (_m *Client) UnauthenticatedBind(username string) error { ret := _m.Called(username) + if len(ret) == 0 { + panic("no return value specified for UnauthenticatedBind") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(username) @@ -448,10 +1234,42 @@ func (_m *Client) UnauthenticatedBind(username string) error { return r0 } +// Client_UnauthenticatedBind_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UnauthenticatedBind' +type Client_UnauthenticatedBind_Call struct { + *mock.Call +} + +// UnauthenticatedBind is a helper method to define mock.On call +// - username string +func (_e *Client_Expecter) UnauthenticatedBind(username interface{}) *Client_UnauthenticatedBind_Call { + return &Client_UnauthenticatedBind_Call{Call: _e.mock.On("UnauthenticatedBind", username)} +} + +func (_c *Client_UnauthenticatedBind_Call) Run(run func(username string)) *Client_UnauthenticatedBind_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Client_UnauthenticatedBind_Call) Return(_a0 error) *Client_UnauthenticatedBind_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_UnauthenticatedBind_Call) RunAndReturn(run func(string) error) *Client_UnauthenticatedBind_Call { + _c.Call.Return(run) + return _c +} + // Unbind provides a mock function with given fields: func (_m *Client) Unbind() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Unbind") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -462,13 +1280,39 @@ func (_m *Client) Unbind() error { return r0 } -type mockConstructorTestingTNewClient interface { - mock.TestingT - Cleanup(func()) +// Client_Unbind_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Unbind' +type Client_Unbind_Call struct { + *mock.Call +} + +// Unbind is a helper method to define mock.On call +func (_e *Client_Expecter) Unbind() *Client_Unbind_Call { + return &Client_Unbind_Call{Call: _e.mock.On("Unbind")} +} + +func (_c *Client_Unbind_Call) Run(run func()) *Client_Unbind_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Client_Unbind_Call) Return(_a0 error) *Client_Unbind_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_Unbind_Call) RunAndReturn(run func() error) *Client_Unbind_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. -func NewClient(t mockConstructorTestingTNewClient) *Client { +// The first argument is typically a *testing.T value. +func NewClient(t interface { + mock.TestingT + Cleanup(func()) +}) *Client { mock := &Client{} mock.Mock.Test(t) diff --git a/services/graph/mocks/permissions.go b/services/graph/mocks/permissions.go index 7a0dd07cd9f..73bf9421d57 100644 --- a/services/graph/mocks/permissions.go +++ b/services/graph/mocks/permissions.go @@ -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) diff --git a/services/graph/mocks/publisher.go b/services/graph/mocks/publisher.go index 40dd7e5f2c3..189ebe218ec 100644 --- a/services/graph/mocks/publisher.go +++ b/services/graph/mocks/publisher.go @@ -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) diff --git a/services/graph/mocks/role_service.go b/services/graph/mocks/role_service.go index 3729b66ccbb..70fadd24ed7 100644 --- a/services/graph/mocks/role_service.go +++ b/services/graph/mocks/role_service.go @@ -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) diff --git a/services/graph/mocks/value_service.go b/services/graph/mocks/value_service.go index 1872da1de14..8a099b699d9 100644 --- a/services/graph/mocks/value_service.go +++ b/services/graph/mocks/value_service.go @@ -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 { diff --git a/services/graph/pkg/identity/mocks/backend.go b/services/graph/pkg/identity/mocks/backend.go index 8bb281f42e1..885ee880abd 100644 --- a/services/graph/pkg/identity/mocks/backend.go +++ b/services/graph/pkg/identity/mocks/backend.go @@ -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) diff --git a/services/graph/pkg/identity/mocks/education_backend.go b/services/graph/pkg/identity/mocks/education_backend.go index da0db3e5304..44e831c58eb 100644 --- a/services/graph/pkg/identity/mocks/education_backend.go +++ b/services/graph/pkg/identity/mocks/education_backend.go @@ -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 @@ -15,10 +15,22 @@ type EducationBackend struct { mock.Mock } +type EducationBackend_Expecter struct { + mock *mock.Mock +} + +func (_m *EducationBackend) EXPECT() *EducationBackend_Expecter { + return &EducationBackend_Expecter{mock: &_m.Mock} +} + // AddClassesToEducationSchool provides a mock function with given fields: ctx, schoolNumberOrID, memberIDs func (_m *EducationBackend) AddClassesToEducationSchool(ctx context.Context, schoolNumberOrID string, memberIDs []string) error { ret := _m.Called(ctx, schoolNumberOrID, memberIDs) + if len(ret) == 0 { + panic("no return value specified for AddClassesToEducationSchool") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, string, []string) error); ok { r0 = rf(ctx, schoolNumberOrID, memberIDs) @@ -29,10 +41,44 @@ func (_m *EducationBackend) AddClassesToEducationSchool(ctx context.Context, sch return r0 } +// EducationBackend_AddClassesToEducationSchool_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddClassesToEducationSchool' +type EducationBackend_AddClassesToEducationSchool_Call struct { + *mock.Call +} + +// AddClassesToEducationSchool is a helper method to define mock.On call +// - ctx context.Context +// - schoolNumberOrID string +// - memberIDs []string +func (_e *EducationBackend_Expecter) AddClassesToEducationSchool(ctx interface{}, schoolNumberOrID interface{}, memberIDs interface{}) *EducationBackend_AddClassesToEducationSchool_Call { + return &EducationBackend_AddClassesToEducationSchool_Call{Call: _e.mock.On("AddClassesToEducationSchool", ctx, schoolNumberOrID, memberIDs)} +} + +func (_c *EducationBackend_AddClassesToEducationSchool_Call) Run(run func(ctx context.Context, schoolNumberOrID string, memberIDs []string)) *EducationBackend_AddClassesToEducationSchool_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].([]string)) + }) + return _c +} + +func (_c *EducationBackend_AddClassesToEducationSchool_Call) Return(_a0 error) *EducationBackend_AddClassesToEducationSchool_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *EducationBackend_AddClassesToEducationSchool_Call) RunAndReturn(run func(context.Context, string, []string) error) *EducationBackend_AddClassesToEducationSchool_Call { + _c.Call.Return(run) + return _c +} + // AddTeacherToEducationClass provides a mock function with given fields: ctx, classID, teacherID func (_m *EducationBackend) AddTeacherToEducationClass(ctx context.Context, classID string, teacherID string) error { ret := _m.Called(ctx, classID, teacherID) + if len(ret) == 0 { + panic("no return value specified for AddTeacherToEducationClass") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, string, string) error); ok { r0 = rf(ctx, classID, teacherID) @@ -43,10 +89,44 @@ func (_m *EducationBackend) AddTeacherToEducationClass(ctx context.Context, clas return r0 } +// EducationBackend_AddTeacherToEducationClass_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddTeacherToEducationClass' +type EducationBackend_AddTeacherToEducationClass_Call struct { + *mock.Call +} + +// AddTeacherToEducationClass is a helper method to define mock.On call +// - ctx context.Context +// - classID string +// - teacherID string +func (_e *EducationBackend_Expecter) AddTeacherToEducationClass(ctx interface{}, classID interface{}, teacherID interface{}) *EducationBackend_AddTeacherToEducationClass_Call { + return &EducationBackend_AddTeacherToEducationClass_Call{Call: _e.mock.On("AddTeacherToEducationClass", ctx, classID, teacherID)} +} + +func (_c *EducationBackend_AddTeacherToEducationClass_Call) Run(run func(ctx context.Context, classID string, teacherID string)) *EducationBackend_AddTeacherToEducationClass_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *EducationBackend_AddTeacherToEducationClass_Call) Return(_a0 error) *EducationBackend_AddTeacherToEducationClass_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *EducationBackend_AddTeacherToEducationClass_Call) RunAndReturn(run func(context.Context, string, string) error) *EducationBackend_AddTeacherToEducationClass_Call { + _c.Call.Return(run) + return _c +} + // AddUsersToEducationSchool provides a mock function with given fields: ctx, schoolID, memberID func (_m *EducationBackend) AddUsersToEducationSchool(ctx context.Context, schoolID string, memberID []string) error { ret := _m.Called(ctx, schoolID, memberID) + if len(ret) == 0 { + panic("no return value specified for AddUsersToEducationSchool") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, string, []string) error); ok { r0 = rf(ctx, schoolID, memberID) @@ -57,10 +137,44 @@ func (_m *EducationBackend) AddUsersToEducationSchool(ctx context.Context, schoo return r0 } +// EducationBackend_AddUsersToEducationSchool_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddUsersToEducationSchool' +type EducationBackend_AddUsersToEducationSchool_Call struct { + *mock.Call +} + +// AddUsersToEducationSchool is a helper method to define mock.On call +// - ctx context.Context +// - schoolID string +// - memberID []string +func (_e *EducationBackend_Expecter) AddUsersToEducationSchool(ctx interface{}, schoolID interface{}, memberID interface{}) *EducationBackend_AddUsersToEducationSchool_Call { + return &EducationBackend_AddUsersToEducationSchool_Call{Call: _e.mock.On("AddUsersToEducationSchool", ctx, schoolID, memberID)} +} + +func (_c *EducationBackend_AddUsersToEducationSchool_Call) Run(run func(ctx context.Context, schoolID string, memberID []string)) *EducationBackend_AddUsersToEducationSchool_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].([]string)) + }) + return _c +} + +func (_c *EducationBackend_AddUsersToEducationSchool_Call) Return(_a0 error) *EducationBackend_AddUsersToEducationSchool_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *EducationBackend_AddUsersToEducationSchool_Call) RunAndReturn(run func(context.Context, string, []string) error) *EducationBackend_AddUsersToEducationSchool_Call { + _c.Call.Return(run) + return _c +} + // CreateEducationClass provides a mock function with given fields: ctx, class func (_m *EducationBackend) CreateEducationClass(ctx context.Context, class libregraph.EducationClass) (*libregraph.EducationClass, error) { ret := _m.Called(ctx, class) + if len(ret) == 0 { + panic("no return value specified for CreateEducationClass") + } + var r0 *libregraph.EducationClass var r1 error if rf, ok := ret.Get(0).(func(context.Context, libregraph.EducationClass) (*libregraph.EducationClass, error)); ok { @@ -83,10 +197,43 @@ func (_m *EducationBackend) CreateEducationClass(ctx context.Context, class libr return r0, r1 } +// EducationBackend_CreateEducationClass_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateEducationClass' +type EducationBackend_CreateEducationClass_Call struct { + *mock.Call +} + +// CreateEducationClass is a helper method to define mock.On call +// - ctx context.Context +// - class libregraph.EducationClass +func (_e *EducationBackend_Expecter) CreateEducationClass(ctx interface{}, class interface{}) *EducationBackend_CreateEducationClass_Call { + return &EducationBackend_CreateEducationClass_Call{Call: _e.mock.On("CreateEducationClass", ctx, class)} +} + +func (_c *EducationBackend_CreateEducationClass_Call) Run(run func(ctx context.Context, class libregraph.EducationClass)) *EducationBackend_CreateEducationClass_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(libregraph.EducationClass)) + }) + return _c +} + +func (_c *EducationBackend_CreateEducationClass_Call) Return(_a0 *libregraph.EducationClass, _a1 error) *EducationBackend_CreateEducationClass_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EducationBackend_CreateEducationClass_Call) RunAndReturn(run func(context.Context, libregraph.EducationClass) (*libregraph.EducationClass, error)) *EducationBackend_CreateEducationClass_Call { + _c.Call.Return(run) + return _c +} + // CreateEducationSchool provides a mock function with given fields: ctx, group func (_m *EducationBackend) CreateEducationSchool(ctx context.Context, group libregraph.EducationSchool) (*libregraph.EducationSchool, error) { ret := _m.Called(ctx, group) + if len(ret) == 0 { + panic("no return value specified for CreateEducationSchool") + } + var r0 *libregraph.EducationSchool var r1 error if rf, ok := ret.Get(0).(func(context.Context, libregraph.EducationSchool) (*libregraph.EducationSchool, error)); ok { @@ -109,10 +256,43 @@ func (_m *EducationBackend) CreateEducationSchool(ctx context.Context, group lib return r0, r1 } +// EducationBackend_CreateEducationSchool_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateEducationSchool' +type EducationBackend_CreateEducationSchool_Call struct { + *mock.Call +} + +// CreateEducationSchool is a helper method to define mock.On call +// - ctx context.Context +// - group libregraph.EducationSchool +func (_e *EducationBackend_Expecter) CreateEducationSchool(ctx interface{}, group interface{}) *EducationBackend_CreateEducationSchool_Call { + return &EducationBackend_CreateEducationSchool_Call{Call: _e.mock.On("CreateEducationSchool", ctx, group)} +} + +func (_c *EducationBackend_CreateEducationSchool_Call) Run(run func(ctx context.Context, group libregraph.EducationSchool)) *EducationBackend_CreateEducationSchool_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(libregraph.EducationSchool)) + }) + return _c +} + +func (_c *EducationBackend_CreateEducationSchool_Call) Return(_a0 *libregraph.EducationSchool, _a1 error) *EducationBackend_CreateEducationSchool_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EducationBackend_CreateEducationSchool_Call) RunAndReturn(run func(context.Context, libregraph.EducationSchool) (*libregraph.EducationSchool, error)) *EducationBackend_CreateEducationSchool_Call { + _c.Call.Return(run) + return _c +} + // CreateEducationUser provides a mock function with given fields: ctx, user func (_m *EducationBackend) CreateEducationUser(ctx context.Context, user libregraph.EducationUser) (*libregraph.EducationUser, error) { ret := _m.Called(ctx, user) + if len(ret) == 0 { + panic("no return value specified for CreateEducationUser") + } + var r0 *libregraph.EducationUser var r1 error if rf, ok := ret.Get(0).(func(context.Context, libregraph.EducationUser) (*libregraph.EducationUser, error)); ok { @@ -135,10 +315,43 @@ func (_m *EducationBackend) CreateEducationUser(ctx context.Context, user libreg return r0, r1 } +// EducationBackend_CreateEducationUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateEducationUser' +type EducationBackend_CreateEducationUser_Call struct { + *mock.Call +} + +// CreateEducationUser is a helper method to define mock.On call +// - ctx context.Context +// - user libregraph.EducationUser +func (_e *EducationBackend_Expecter) CreateEducationUser(ctx interface{}, user interface{}) *EducationBackend_CreateEducationUser_Call { + return &EducationBackend_CreateEducationUser_Call{Call: _e.mock.On("CreateEducationUser", ctx, user)} +} + +func (_c *EducationBackend_CreateEducationUser_Call) Run(run func(ctx context.Context, user libregraph.EducationUser)) *EducationBackend_CreateEducationUser_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(libregraph.EducationUser)) + }) + return _c +} + +func (_c *EducationBackend_CreateEducationUser_Call) Return(_a0 *libregraph.EducationUser, _a1 error) *EducationBackend_CreateEducationUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EducationBackend_CreateEducationUser_Call) RunAndReturn(run func(context.Context, libregraph.EducationUser) (*libregraph.EducationUser, error)) *EducationBackend_CreateEducationUser_Call { + _c.Call.Return(run) + return _c +} + // DeleteEducationClass provides a mock function with given fields: ctx, nameOrID func (_m *EducationBackend) DeleteEducationClass(ctx context.Context, nameOrID string) error { ret := _m.Called(ctx, nameOrID) + if len(ret) == 0 { + panic("no return value specified for DeleteEducationClass") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { r0 = rf(ctx, nameOrID) @@ -149,10 +362,43 @@ func (_m *EducationBackend) DeleteEducationClass(ctx context.Context, nameOrID s return r0 } +// EducationBackend_DeleteEducationClass_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteEducationClass' +type EducationBackend_DeleteEducationClass_Call struct { + *mock.Call +} + +// DeleteEducationClass is a helper method to define mock.On call +// - ctx context.Context +// - nameOrID string +func (_e *EducationBackend_Expecter) DeleteEducationClass(ctx interface{}, nameOrID interface{}) *EducationBackend_DeleteEducationClass_Call { + return &EducationBackend_DeleteEducationClass_Call{Call: _e.mock.On("DeleteEducationClass", ctx, nameOrID)} +} + +func (_c *EducationBackend_DeleteEducationClass_Call) Run(run func(ctx context.Context, nameOrID string)) *EducationBackend_DeleteEducationClass_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *EducationBackend_DeleteEducationClass_Call) Return(_a0 error) *EducationBackend_DeleteEducationClass_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *EducationBackend_DeleteEducationClass_Call) RunAndReturn(run func(context.Context, string) error) *EducationBackend_DeleteEducationClass_Call { + _c.Call.Return(run) + return _c +} + // DeleteEducationSchool provides a mock function with given fields: ctx, id func (_m *EducationBackend) DeleteEducationSchool(ctx context.Context, id string) error { ret := _m.Called(ctx, id) + if len(ret) == 0 { + panic("no return value specified for DeleteEducationSchool") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { r0 = rf(ctx, id) @@ -163,10 +409,43 @@ func (_m *EducationBackend) DeleteEducationSchool(ctx context.Context, id string return r0 } +// EducationBackend_DeleteEducationSchool_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteEducationSchool' +type EducationBackend_DeleteEducationSchool_Call struct { + *mock.Call +} + +// DeleteEducationSchool is a helper method to define mock.On call +// - ctx context.Context +// - id string +func (_e *EducationBackend_Expecter) DeleteEducationSchool(ctx interface{}, id interface{}) *EducationBackend_DeleteEducationSchool_Call { + return &EducationBackend_DeleteEducationSchool_Call{Call: _e.mock.On("DeleteEducationSchool", ctx, id)} +} + +func (_c *EducationBackend_DeleteEducationSchool_Call) Run(run func(ctx context.Context, id string)) *EducationBackend_DeleteEducationSchool_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *EducationBackend_DeleteEducationSchool_Call) Return(_a0 error) *EducationBackend_DeleteEducationSchool_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *EducationBackend_DeleteEducationSchool_Call) RunAndReturn(run func(context.Context, string) error) *EducationBackend_DeleteEducationSchool_Call { + _c.Call.Return(run) + return _c +} + // DeleteEducationUser provides a mock function with given fields: ctx, nameOrID func (_m *EducationBackend) DeleteEducationUser(ctx context.Context, nameOrID string) error { ret := _m.Called(ctx, nameOrID) + if len(ret) == 0 { + panic("no return value specified for DeleteEducationUser") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { r0 = rf(ctx, nameOrID) @@ -177,10 +456,43 @@ func (_m *EducationBackend) DeleteEducationUser(ctx context.Context, nameOrID st return r0 } +// EducationBackend_DeleteEducationUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteEducationUser' +type EducationBackend_DeleteEducationUser_Call struct { + *mock.Call +} + +// DeleteEducationUser is a helper method to define mock.On call +// - ctx context.Context +// - nameOrID string +func (_e *EducationBackend_Expecter) DeleteEducationUser(ctx interface{}, nameOrID interface{}) *EducationBackend_DeleteEducationUser_Call { + return &EducationBackend_DeleteEducationUser_Call{Call: _e.mock.On("DeleteEducationUser", ctx, nameOrID)} +} + +func (_c *EducationBackend_DeleteEducationUser_Call) Run(run func(ctx context.Context, nameOrID string)) *EducationBackend_DeleteEducationUser_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *EducationBackend_DeleteEducationUser_Call) Return(_a0 error) *EducationBackend_DeleteEducationUser_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *EducationBackend_DeleteEducationUser_Call) RunAndReturn(run func(context.Context, string) error) *EducationBackend_DeleteEducationUser_Call { + _c.Call.Return(run) + return _c +} + // GetEducationClass provides a mock function with given fields: ctx, namedOrID func (_m *EducationBackend) GetEducationClass(ctx context.Context, namedOrID string) (*libregraph.EducationClass, error) { ret := _m.Called(ctx, namedOrID) + if len(ret) == 0 { + panic("no return value specified for GetEducationClass") + } + var r0 *libregraph.EducationClass var r1 error if rf, ok := ret.Get(0).(func(context.Context, string) (*libregraph.EducationClass, error)); ok { @@ -203,10 +515,43 @@ func (_m *EducationBackend) GetEducationClass(ctx context.Context, namedOrID str return r0, r1 } +// EducationBackend_GetEducationClass_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEducationClass' +type EducationBackend_GetEducationClass_Call struct { + *mock.Call +} + +// GetEducationClass is a helper method to define mock.On call +// - ctx context.Context +// - namedOrID string +func (_e *EducationBackend_Expecter) GetEducationClass(ctx interface{}, namedOrID interface{}) *EducationBackend_GetEducationClass_Call { + return &EducationBackend_GetEducationClass_Call{Call: _e.mock.On("GetEducationClass", ctx, namedOrID)} +} + +func (_c *EducationBackend_GetEducationClass_Call) Run(run func(ctx context.Context, namedOrID string)) *EducationBackend_GetEducationClass_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *EducationBackend_GetEducationClass_Call) Return(_a0 *libregraph.EducationClass, _a1 error) *EducationBackend_GetEducationClass_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EducationBackend_GetEducationClass_Call) RunAndReturn(run func(context.Context, string) (*libregraph.EducationClass, error)) *EducationBackend_GetEducationClass_Call { + _c.Call.Return(run) + return _c +} + // GetEducationClassMembers provides a mock function with given fields: ctx, nameOrID func (_m *EducationBackend) GetEducationClassMembers(ctx context.Context, nameOrID string) ([]*libregraph.EducationUser, error) { ret := _m.Called(ctx, nameOrID) + if len(ret) == 0 { + panic("no return value specified for GetEducationClassMembers") + } + var r0 []*libregraph.EducationUser var r1 error if rf, ok := ret.Get(0).(func(context.Context, string) ([]*libregraph.EducationUser, error)); ok { @@ -229,10 +574,43 @@ func (_m *EducationBackend) GetEducationClassMembers(ctx context.Context, nameOr return r0, r1 } +// EducationBackend_GetEducationClassMembers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEducationClassMembers' +type EducationBackend_GetEducationClassMembers_Call struct { + *mock.Call +} + +// GetEducationClassMembers is a helper method to define mock.On call +// - ctx context.Context +// - nameOrID string +func (_e *EducationBackend_Expecter) GetEducationClassMembers(ctx interface{}, nameOrID interface{}) *EducationBackend_GetEducationClassMembers_Call { + return &EducationBackend_GetEducationClassMembers_Call{Call: _e.mock.On("GetEducationClassMembers", ctx, nameOrID)} +} + +func (_c *EducationBackend_GetEducationClassMembers_Call) Run(run func(ctx context.Context, nameOrID string)) *EducationBackend_GetEducationClassMembers_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *EducationBackend_GetEducationClassMembers_Call) Return(_a0 []*libregraph.EducationUser, _a1 error) *EducationBackend_GetEducationClassMembers_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EducationBackend_GetEducationClassMembers_Call) RunAndReturn(run func(context.Context, string) ([]*libregraph.EducationUser, error)) *EducationBackend_GetEducationClassMembers_Call { + _c.Call.Return(run) + return _c +} + // GetEducationClassTeachers provides a mock function with given fields: ctx, classID func (_m *EducationBackend) GetEducationClassTeachers(ctx context.Context, classID string) ([]*libregraph.EducationUser, error) { ret := _m.Called(ctx, classID) + if len(ret) == 0 { + panic("no return value specified for GetEducationClassTeachers") + } + var r0 []*libregraph.EducationUser var r1 error if rf, ok := ret.Get(0).(func(context.Context, string) ([]*libregraph.EducationUser, error)); ok { @@ -255,10 +633,43 @@ func (_m *EducationBackend) GetEducationClassTeachers(ctx context.Context, class return r0, r1 } +// EducationBackend_GetEducationClassTeachers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEducationClassTeachers' +type EducationBackend_GetEducationClassTeachers_Call struct { + *mock.Call +} + +// GetEducationClassTeachers is a helper method to define mock.On call +// - ctx context.Context +// - classID string +func (_e *EducationBackend_Expecter) GetEducationClassTeachers(ctx interface{}, classID interface{}) *EducationBackend_GetEducationClassTeachers_Call { + return &EducationBackend_GetEducationClassTeachers_Call{Call: _e.mock.On("GetEducationClassTeachers", ctx, classID)} +} + +func (_c *EducationBackend_GetEducationClassTeachers_Call) Run(run func(ctx context.Context, classID string)) *EducationBackend_GetEducationClassTeachers_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *EducationBackend_GetEducationClassTeachers_Call) Return(_a0 []*libregraph.EducationUser, _a1 error) *EducationBackend_GetEducationClassTeachers_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EducationBackend_GetEducationClassTeachers_Call) RunAndReturn(run func(context.Context, string) ([]*libregraph.EducationUser, error)) *EducationBackend_GetEducationClassTeachers_Call { + _c.Call.Return(run) + return _c +} + // GetEducationClasses provides a mock function with given fields: ctx func (_m *EducationBackend) GetEducationClasses(ctx context.Context) ([]*libregraph.EducationClass, error) { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for GetEducationClasses") + } + var r0 []*libregraph.EducationClass var r1 error if rf, ok := ret.Get(0).(func(context.Context) ([]*libregraph.EducationClass, error)); ok { @@ -281,10 +692,42 @@ func (_m *EducationBackend) GetEducationClasses(ctx context.Context) ([]*libregr return r0, r1 } +// EducationBackend_GetEducationClasses_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEducationClasses' +type EducationBackend_GetEducationClasses_Call struct { + *mock.Call +} + +// GetEducationClasses is a helper method to define mock.On call +// - ctx context.Context +func (_e *EducationBackend_Expecter) GetEducationClasses(ctx interface{}) *EducationBackend_GetEducationClasses_Call { + return &EducationBackend_GetEducationClasses_Call{Call: _e.mock.On("GetEducationClasses", ctx)} +} + +func (_c *EducationBackend_GetEducationClasses_Call) Run(run func(ctx context.Context)) *EducationBackend_GetEducationClasses_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *EducationBackend_GetEducationClasses_Call) Return(_a0 []*libregraph.EducationClass, _a1 error) *EducationBackend_GetEducationClasses_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EducationBackend_GetEducationClasses_Call) RunAndReturn(run func(context.Context) ([]*libregraph.EducationClass, error)) *EducationBackend_GetEducationClasses_Call { + _c.Call.Return(run) + return _c +} + // GetEducationSchool provides a mock function with given fields: ctx, nameOrID func (_m *EducationBackend) GetEducationSchool(ctx context.Context, nameOrID string) (*libregraph.EducationSchool, error) { ret := _m.Called(ctx, nameOrID) + if len(ret) == 0 { + panic("no return value specified for GetEducationSchool") + } + var r0 *libregraph.EducationSchool var r1 error if rf, ok := ret.Get(0).(func(context.Context, string) (*libregraph.EducationSchool, error)); ok { @@ -307,10 +750,43 @@ func (_m *EducationBackend) GetEducationSchool(ctx context.Context, nameOrID str return r0, r1 } +// EducationBackend_GetEducationSchool_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEducationSchool' +type EducationBackend_GetEducationSchool_Call struct { + *mock.Call +} + +// GetEducationSchool is a helper method to define mock.On call +// - ctx context.Context +// - nameOrID string +func (_e *EducationBackend_Expecter) GetEducationSchool(ctx interface{}, nameOrID interface{}) *EducationBackend_GetEducationSchool_Call { + return &EducationBackend_GetEducationSchool_Call{Call: _e.mock.On("GetEducationSchool", ctx, nameOrID)} +} + +func (_c *EducationBackend_GetEducationSchool_Call) Run(run func(ctx context.Context, nameOrID string)) *EducationBackend_GetEducationSchool_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *EducationBackend_GetEducationSchool_Call) Return(_a0 *libregraph.EducationSchool, _a1 error) *EducationBackend_GetEducationSchool_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EducationBackend_GetEducationSchool_Call) RunAndReturn(run func(context.Context, string) (*libregraph.EducationSchool, error)) *EducationBackend_GetEducationSchool_Call { + _c.Call.Return(run) + return _c +} + // GetEducationSchoolClasses provides a mock function with given fields: ctx, schoolNumberOrID func (_m *EducationBackend) GetEducationSchoolClasses(ctx context.Context, schoolNumberOrID string) ([]*libregraph.EducationClass, error) { ret := _m.Called(ctx, schoolNumberOrID) + if len(ret) == 0 { + panic("no return value specified for GetEducationSchoolClasses") + } + var r0 []*libregraph.EducationClass var r1 error if rf, ok := ret.Get(0).(func(context.Context, string) ([]*libregraph.EducationClass, error)); ok { @@ -333,10 +809,43 @@ func (_m *EducationBackend) GetEducationSchoolClasses(ctx context.Context, schoo return r0, r1 } +// EducationBackend_GetEducationSchoolClasses_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEducationSchoolClasses' +type EducationBackend_GetEducationSchoolClasses_Call struct { + *mock.Call +} + +// GetEducationSchoolClasses is a helper method to define mock.On call +// - ctx context.Context +// - schoolNumberOrID string +func (_e *EducationBackend_Expecter) GetEducationSchoolClasses(ctx interface{}, schoolNumberOrID interface{}) *EducationBackend_GetEducationSchoolClasses_Call { + return &EducationBackend_GetEducationSchoolClasses_Call{Call: _e.mock.On("GetEducationSchoolClasses", ctx, schoolNumberOrID)} +} + +func (_c *EducationBackend_GetEducationSchoolClasses_Call) Run(run func(ctx context.Context, schoolNumberOrID string)) *EducationBackend_GetEducationSchoolClasses_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *EducationBackend_GetEducationSchoolClasses_Call) Return(_a0 []*libregraph.EducationClass, _a1 error) *EducationBackend_GetEducationSchoolClasses_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EducationBackend_GetEducationSchoolClasses_Call) RunAndReturn(run func(context.Context, string) ([]*libregraph.EducationClass, error)) *EducationBackend_GetEducationSchoolClasses_Call { + _c.Call.Return(run) + return _c +} + // GetEducationSchoolUsers provides a mock function with given fields: ctx, id func (_m *EducationBackend) GetEducationSchoolUsers(ctx context.Context, id string) ([]*libregraph.EducationUser, error) { ret := _m.Called(ctx, id) + if len(ret) == 0 { + panic("no return value specified for GetEducationSchoolUsers") + } + var r0 []*libregraph.EducationUser var r1 error if rf, ok := ret.Get(0).(func(context.Context, string) ([]*libregraph.EducationUser, error)); ok { @@ -359,10 +868,43 @@ func (_m *EducationBackend) GetEducationSchoolUsers(ctx context.Context, id stri return r0, r1 } +// EducationBackend_GetEducationSchoolUsers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEducationSchoolUsers' +type EducationBackend_GetEducationSchoolUsers_Call struct { + *mock.Call +} + +// GetEducationSchoolUsers is a helper method to define mock.On call +// - ctx context.Context +// - id string +func (_e *EducationBackend_Expecter) GetEducationSchoolUsers(ctx interface{}, id interface{}) *EducationBackend_GetEducationSchoolUsers_Call { + return &EducationBackend_GetEducationSchoolUsers_Call{Call: _e.mock.On("GetEducationSchoolUsers", ctx, id)} +} + +func (_c *EducationBackend_GetEducationSchoolUsers_Call) Run(run func(ctx context.Context, id string)) *EducationBackend_GetEducationSchoolUsers_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *EducationBackend_GetEducationSchoolUsers_Call) Return(_a0 []*libregraph.EducationUser, _a1 error) *EducationBackend_GetEducationSchoolUsers_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EducationBackend_GetEducationSchoolUsers_Call) RunAndReturn(run func(context.Context, string) ([]*libregraph.EducationUser, error)) *EducationBackend_GetEducationSchoolUsers_Call { + _c.Call.Return(run) + return _c +} + // GetEducationSchools provides a mock function with given fields: ctx func (_m *EducationBackend) GetEducationSchools(ctx context.Context) ([]*libregraph.EducationSchool, error) { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for GetEducationSchools") + } + var r0 []*libregraph.EducationSchool var r1 error if rf, ok := ret.Get(0).(func(context.Context) ([]*libregraph.EducationSchool, error)); ok { @@ -385,10 +927,42 @@ func (_m *EducationBackend) GetEducationSchools(ctx context.Context) ([]*libregr return r0, r1 } +// EducationBackend_GetEducationSchools_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEducationSchools' +type EducationBackend_GetEducationSchools_Call struct { + *mock.Call +} + +// GetEducationSchools is a helper method to define mock.On call +// - ctx context.Context +func (_e *EducationBackend_Expecter) GetEducationSchools(ctx interface{}) *EducationBackend_GetEducationSchools_Call { + return &EducationBackend_GetEducationSchools_Call{Call: _e.mock.On("GetEducationSchools", ctx)} +} + +func (_c *EducationBackend_GetEducationSchools_Call) Run(run func(ctx context.Context)) *EducationBackend_GetEducationSchools_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *EducationBackend_GetEducationSchools_Call) Return(_a0 []*libregraph.EducationSchool, _a1 error) *EducationBackend_GetEducationSchools_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EducationBackend_GetEducationSchools_Call) RunAndReturn(run func(context.Context) ([]*libregraph.EducationSchool, error)) *EducationBackend_GetEducationSchools_Call { + _c.Call.Return(run) + return _c +} + // GetEducationUser provides a mock function with given fields: ctx, nameOrID func (_m *EducationBackend) GetEducationUser(ctx context.Context, nameOrID string) (*libregraph.EducationUser, error) { ret := _m.Called(ctx, nameOrID) + if len(ret) == 0 { + panic("no return value specified for GetEducationUser") + } + var r0 *libregraph.EducationUser var r1 error if rf, ok := ret.Get(0).(func(context.Context, string) (*libregraph.EducationUser, error)); ok { @@ -411,10 +985,43 @@ func (_m *EducationBackend) GetEducationUser(ctx context.Context, nameOrID strin return r0, r1 } +// EducationBackend_GetEducationUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEducationUser' +type EducationBackend_GetEducationUser_Call struct { + *mock.Call +} + +// GetEducationUser is a helper method to define mock.On call +// - ctx context.Context +// - nameOrID string +func (_e *EducationBackend_Expecter) GetEducationUser(ctx interface{}, nameOrID interface{}) *EducationBackend_GetEducationUser_Call { + return &EducationBackend_GetEducationUser_Call{Call: _e.mock.On("GetEducationUser", ctx, nameOrID)} +} + +func (_c *EducationBackend_GetEducationUser_Call) Run(run func(ctx context.Context, nameOrID string)) *EducationBackend_GetEducationUser_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *EducationBackend_GetEducationUser_Call) Return(_a0 *libregraph.EducationUser, _a1 error) *EducationBackend_GetEducationUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EducationBackend_GetEducationUser_Call) RunAndReturn(run func(context.Context, string) (*libregraph.EducationUser, error)) *EducationBackend_GetEducationUser_Call { + _c.Call.Return(run) + return _c +} + // GetEducationUsers provides a mock function with given fields: ctx func (_m *EducationBackend) GetEducationUsers(ctx context.Context) ([]*libregraph.EducationUser, error) { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for GetEducationUsers") + } + var r0 []*libregraph.EducationUser var r1 error if rf, ok := ret.Get(0).(func(context.Context) ([]*libregraph.EducationUser, error)); ok { @@ -437,10 +1044,42 @@ func (_m *EducationBackend) GetEducationUsers(ctx context.Context) ([]*libregrap return r0, r1 } +// EducationBackend_GetEducationUsers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEducationUsers' +type EducationBackend_GetEducationUsers_Call struct { + *mock.Call +} + +// GetEducationUsers is a helper method to define mock.On call +// - ctx context.Context +func (_e *EducationBackend_Expecter) GetEducationUsers(ctx interface{}) *EducationBackend_GetEducationUsers_Call { + return &EducationBackend_GetEducationUsers_Call{Call: _e.mock.On("GetEducationUsers", ctx)} +} + +func (_c *EducationBackend_GetEducationUsers_Call) Run(run func(ctx context.Context)) *EducationBackend_GetEducationUsers_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *EducationBackend_GetEducationUsers_Call) Return(_a0 []*libregraph.EducationUser, _a1 error) *EducationBackend_GetEducationUsers_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EducationBackend_GetEducationUsers_Call) RunAndReturn(run func(context.Context) ([]*libregraph.EducationUser, error)) *EducationBackend_GetEducationUsers_Call { + _c.Call.Return(run) + return _c +} + // RemoveClassFromEducationSchool provides a mock function with given fields: ctx, schoolNumberOrID, memberID func (_m *EducationBackend) RemoveClassFromEducationSchool(ctx context.Context, schoolNumberOrID string, memberID string) error { ret := _m.Called(ctx, schoolNumberOrID, memberID) + if len(ret) == 0 { + panic("no return value specified for RemoveClassFromEducationSchool") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, string, string) error); ok { r0 = rf(ctx, schoolNumberOrID, memberID) @@ -451,10 +1090,44 @@ func (_m *EducationBackend) RemoveClassFromEducationSchool(ctx context.Context, return r0 } +// EducationBackend_RemoveClassFromEducationSchool_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveClassFromEducationSchool' +type EducationBackend_RemoveClassFromEducationSchool_Call struct { + *mock.Call +} + +// RemoveClassFromEducationSchool is a helper method to define mock.On call +// - ctx context.Context +// - schoolNumberOrID string +// - memberID string +func (_e *EducationBackend_Expecter) RemoveClassFromEducationSchool(ctx interface{}, schoolNumberOrID interface{}, memberID interface{}) *EducationBackend_RemoveClassFromEducationSchool_Call { + return &EducationBackend_RemoveClassFromEducationSchool_Call{Call: _e.mock.On("RemoveClassFromEducationSchool", ctx, schoolNumberOrID, memberID)} +} + +func (_c *EducationBackend_RemoveClassFromEducationSchool_Call) Run(run func(ctx context.Context, schoolNumberOrID string, memberID string)) *EducationBackend_RemoveClassFromEducationSchool_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *EducationBackend_RemoveClassFromEducationSchool_Call) Return(_a0 error) *EducationBackend_RemoveClassFromEducationSchool_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *EducationBackend_RemoveClassFromEducationSchool_Call) RunAndReturn(run func(context.Context, string, string) error) *EducationBackend_RemoveClassFromEducationSchool_Call { + _c.Call.Return(run) + return _c +} + // RemoveTeacherFromEducationClass provides a mock function with given fields: ctx, classID, teacherID func (_m *EducationBackend) RemoveTeacherFromEducationClass(ctx context.Context, classID string, teacherID string) error { ret := _m.Called(ctx, classID, teacherID) + if len(ret) == 0 { + panic("no return value specified for RemoveTeacherFromEducationClass") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, string, string) error); ok { r0 = rf(ctx, classID, teacherID) @@ -465,10 +1138,44 @@ func (_m *EducationBackend) RemoveTeacherFromEducationClass(ctx context.Context, return r0 } +// EducationBackend_RemoveTeacherFromEducationClass_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveTeacherFromEducationClass' +type EducationBackend_RemoveTeacherFromEducationClass_Call struct { + *mock.Call +} + +// RemoveTeacherFromEducationClass is a helper method to define mock.On call +// - ctx context.Context +// - classID string +// - teacherID string +func (_e *EducationBackend_Expecter) RemoveTeacherFromEducationClass(ctx interface{}, classID interface{}, teacherID interface{}) *EducationBackend_RemoveTeacherFromEducationClass_Call { + return &EducationBackend_RemoveTeacherFromEducationClass_Call{Call: _e.mock.On("RemoveTeacherFromEducationClass", ctx, classID, teacherID)} +} + +func (_c *EducationBackend_RemoveTeacherFromEducationClass_Call) Run(run func(ctx context.Context, classID string, teacherID string)) *EducationBackend_RemoveTeacherFromEducationClass_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *EducationBackend_RemoveTeacherFromEducationClass_Call) Return(_a0 error) *EducationBackend_RemoveTeacherFromEducationClass_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *EducationBackend_RemoveTeacherFromEducationClass_Call) RunAndReturn(run func(context.Context, string, string) error) *EducationBackend_RemoveTeacherFromEducationClass_Call { + _c.Call.Return(run) + return _c +} + // RemoveUserFromEducationSchool provides a mock function with given fields: ctx, schoolID, memberID func (_m *EducationBackend) RemoveUserFromEducationSchool(ctx context.Context, schoolID string, memberID string) error { ret := _m.Called(ctx, schoolID, memberID) + if len(ret) == 0 { + panic("no return value specified for RemoveUserFromEducationSchool") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, string, string) error); ok { r0 = rf(ctx, schoolID, memberID) @@ -479,10 +1186,44 @@ func (_m *EducationBackend) RemoveUserFromEducationSchool(ctx context.Context, s return r0 } +// EducationBackend_RemoveUserFromEducationSchool_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUserFromEducationSchool' +type EducationBackend_RemoveUserFromEducationSchool_Call struct { + *mock.Call +} + +// RemoveUserFromEducationSchool is a helper method to define mock.On call +// - ctx context.Context +// - schoolID string +// - memberID string +func (_e *EducationBackend_Expecter) RemoveUserFromEducationSchool(ctx interface{}, schoolID interface{}, memberID interface{}) *EducationBackend_RemoveUserFromEducationSchool_Call { + return &EducationBackend_RemoveUserFromEducationSchool_Call{Call: _e.mock.On("RemoveUserFromEducationSchool", ctx, schoolID, memberID)} +} + +func (_c *EducationBackend_RemoveUserFromEducationSchool_Call) Run(run func(ctx context.Context, schoolID string, memberID string)) *EducationBackend_RemoveUserFromEducationSchool_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *EducationBackend_RemoveUserFromEducationSchool_Call) Return(_a0 error) *EducationBackend_RemoveUserFromEducationSchool_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *EducationBackend_RemoveUserFromEducationSchool_Call) RunAndReturn(run func(context.Context, string, string) error) *EducationBackend_RemoveUserFromEducationSchool_Call { + _c.Call.Return(run) + return _c +} + // UpdateEducationClass provides a mock function with given fields: ctx, id, class func (_m *EducationBackend) UpdateEducationClass(ctx context.Context, id string, class libregraph.EducationClass) (*libregraph.EducationClass, error) { ret := _m.Called(ctx, id, class) + if len(ret) == 0 { + panic("no return value specified for UpdateEducationClass") + } + var r0 *libregraph.EducationClass var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, libregraph.EducationClass) (*libregraph.EducationClass, error)); ok { @@ -505,10 +1246,44 @@ func (_m *EducationBackend) UpdateEducationClass(ctx context.Context, id string, return r0, r1 } +// EducationBackend_UpdateEducationClass_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateEducationClass' +type EducationBackend_UpdateEducationClass_Call struct { + *mock.Call +} + +// UpdateEducationClass is a helper method to define mock.On call +// - ctx context.Context +// - id string +// - class libregraph.EducationClass +func (_e *EducationBackend_Expecter) UpdateEducationClass(ctx interface{}, id interface{}, class interface{}) *EducationBackend_UpdateEducationClass_Call { + return &EducationBackend_UpdateEducationClass_Call{Call: _e.mock.On("UpdateEducationClass", ctx, id, class)} +} + +func (_c *EducationBackend_UpdateEducationClass_Call) Run(run func(ctx context.Context, id string, class libregraph.EducationClass)) *EducationBackend_UpdateEducationClass_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(libregraph.EducationClass)) + }) + return _c +} + +func (_c *EducationBackend_UpdateEducationClass_Call) Return(_a0 *libregraph.EducationClass, _a1 error) *EducationBackend_UpdateEducationClass_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EducationBackend_UpdateEducationClass_Call) RunAndReturn(run func(context.Context, string, libregraph.EducationClass) (*libregraph.EducationClass, error)) *EducationBackend_UpdateEducationClass_Call { + _c.Call.Return(run) + return _c +} + // UpdateEducationSchool provides a mock function with given fields: ctx, numberOrID, school func (_m *EducationBackend) UpdateEducationSchool(ctx context.Context, numberOrID string, school libregraph.EducationSchool) (*libregraph.EducationSchool, error) { ret := _m.Called(ctx, numberOrID, school) + if len(ret) == 0 { + panic("no return value specified for UpdateEducationSchool") + } + var r0 *libregraph.EducationSchool var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, libregraph.EducationSchool) (*libregraph.EducationSchool, error)); ok { @@ -531,10 +1306,44 @@ func (_m *EducationBackend) UpdateEducationSchool(ctx context.Context, numberOrI return r0, r1 } +// EducationBackend_UpdateEducationSchool_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateEducationSchool' +type EducationBackend_UpdateEducationSchool_Call struct { + *mock.Call +} + +// UpdateEducationSchool is a helper method to define mock.On call +// - ctx context.Context +// - numberOrID string +// - school libregraph.EducationSchool +func (_e *EducationBackend_Expecter) UpdateEducationSchool(ctx interface{}, numberOrID interface{}, school interface{}) *EducationBackend_UpdateEducationSchool_Call { + return &EducationBackend_UpdateEducationSchool_Call{Call: _e.mock.On("UpdateEducationSchool", ctx, numberOrID, school)} +} + +func (_c *EducationBackend_UpdateEducationSchool_Call) Run(run func(ctx context.Context, numberOrID string, school libregraph.EducationSchool)) *EducationBackend_UpdateEducationSchool_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(libregraph.EducationSchool)) + }) + return _c +} + +func (_c *EducationBackend_UpdateEducationSchool_Call) Return(_a0 *libregraph.EducationSchool, _a1 error) *EducationBackend_UpdateEducationSchool_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EducationBackend_UpdateEducationSchool_Call) RunAndReturn(run func(context.Context, string, libregraph.EducationSchool) (*libregraph.EducationSchool, error)) *EducationBackend_UpdateEducationSchool_Call { + _c.Call.Return(run) + return _c +} + // UpdateEducationUser provides a mock function with given fields: ctx, nameOrID, user func (_m *EducationBackend) UpdateEducationUser(ctx context.Context, nameOrID string, user libregraph.EducationUser) (*libregraph.EducationUser, error) { ret := _m.Called(ctx, nameOrID, user) + if len(ret) == 0 { + panic("no return value specified for UpdateEducationUser") + } + var r0 *libregraph.EducationUser var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, libregraph.EducationUser) (*libregraph.EducationUser, error)); ok { @@ -557,13 +1366,42 @@ func (_m *EducationBackend) UpdateEducationUser(ctx context.Context, nameOrID st return r0, r1 } -type mockConstructorTestingTNewEducationBackend interface { - mock.TestingT - Cleanup(func()) +// EducationBackend_UpdateEducationUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateEducationUser' +type EducationBackend_UpdateEducationUser_Call struct { + *mock.Call +} + +// UpdateEducationUser is a helper method to define mock.On call +// - ctx context.Context +// - nameOrID string +// - user libregraph.EducationUser +func (_e *EducationBackend_Expecter) UpdateEducationUser(ctx interface{}, nameOrID interface{}, user interface{}) *EducationBackend_UpdateEducationUser_Call { + return &EducationBackend_UpdateEducationUser_Call{Call: _e.mock.On("UpdateEducationUser", ctx, nameOrID, user)} +} + +func (_c *EducationBackend_UpdateEducationUser_Call) Run(run func(ctx context.Context, nameOrID string, user libregraph.EducationUser)) *EducationBackend_UpdateEducationUser_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(libregraph.EducationUser)) + }) + return _c +} + +func (_c *EducationBackend_UpdateEducationUser_Call) Return(_a0 *libregraph.EducationUser, _a1 error) *EducationBackend_UpdateEducationUser_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EducationBackend_UpdateEducationUser_Call) RunAndReturn(run func(context.Context, string, libregraph.EducationUser) (*libregraph.EducationUser, error)) *EducationBackend_UpdateEducationUser_Call { + _c.Call.Return(run) + return _c } // NewEducationBackend creates a new instance of EducationBackend. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewEducationBackend(t mockConstructorTestingTNewEducationBackend) *EducationBackend { +// The first argument is typically a *testing.T value. +func NewEducationBackend(t interface { + mock.TestingT + Cleanup(func()) +}) *EducationBackend { mock := &EducationBackend{} mock.Mock.Test(t) diff --git a/services/graph/pkg/identity/mocks/ldapclient.go b/services/graph/pkg/identity/mocks/ldapclient.go new file mode 100644 index 00000000000..f9f1e15b6f6 --- /dev/null +++ b/services/graph/pkg/identity/mocks/ldapclient.go @@ -0,0 +1,1322 @@ +// Code generated by mockery v2.40.1. DO NOT EDIT. + +package mocks + +import ( + context "context" + + 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 +} + +type Client_Expecter struct { + mock *mock.Mock +} + +func (_m *Client) EXPECT() *Client_Expecter { + return &Client_Expecter{mock: &_m.Mock} +} + +// Add provides a mock function with given fields: _a0 +func (_m *Client) Add(_a0 *ldap.AddRequest) error { + ret := _m.Called(_a0) + + if len(ret) == 0 { + panic("no return value specified for Add") + } + + var r0 error + if rf, ok := ret.Get(0).(func(*ldap.AddRequest) error); ok { + r0 = rf(_a0) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Client_Add_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Add' +type Client_Add_Call struct { + *mock.Call +} + +// Add is a helper method to define mock.On call +// - _a0 *ldap.AddRequest +func (_e *Client_Expecter) Add(_a0 interface{}) *Client_Add_Call { + return &Client_Add_Call{Call: _e.mock.On("Add", _a0)} +} + +func (_c *Client_Add_Call) Run(run func(_a0 *ldap.AddRequest)) *Client_Add_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*ldap.AddRequest)) + }) + return _c +} + +func (_c *Client_Add_Call) Return(_a0 error) *Client_Add_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_Add_Call) RunAndReturn(run func(*ldap.AddRequest) error) *Client_Add_Call { + _c.Call.Return(run) + return _c +} + +// Bind provides a mock function with given fields: username, password +func (_m *Client) Bind(username string, password string) error { + ret := _m.Called(username, password) + + if len(ret) == 0 { + panic("no return value specified for Bind") + } + + 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 +} + +// Client_Bind_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Bind' +type Client_Bind_Call struct { + *mock.Call +} + +// Bind is a helper method to define mock.On call +// - username string +// - password string +func (_e *Client_Expecter) Bind(username interface{}, password interface{}) *Client_Bind_Call { + return &Client_Bind_Call{Call: _e.mock.On("Bind", username, password)} +} + +func (_c *Client_Bind_Call) Run(run func(username string, password string)) *Client_Bind_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string)) + }) + return _c +} + +func (_c *Client_Bind_Call) Return(_a0 error) *Client_Bind_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_Bind_Call) RunAndReturn(run func(string, string) error) *Client_Bind_Call { + _c.Call.Return(run) + return _c +} + +// Close provides a mock function with given fields: +func (_m *Client) Close() error { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Close") + } + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Client_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close' +type Client_Close_Call struct { + *mock.Call +} + +// Close is a helper method to define mock.On call +func (_e *Client_Expecter) Close() *Client_Close_Call { + return &Client_Close_Call{Call: _e.mock.On("Close")} +} + +func (_c *Client_Close_Call) Run(run func()) *Client_Close_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Client_Close_Call) Return(_a0 error) *Client_Close_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_Close_Call) RunAndReturn(run func() error) *Client_Close_Call { + _c.Call.Return(run) + return _c +} + +// 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) + + if len(ret) == 0 { + panic("no return value specified for Compare") + } + + 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 +} + +// Client_Compare_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Compare' +type Client_Compare_Call struct { + *mock.Call +} + +// Compare is a helper method to define mock.On call +// - dn string +// - attribute string +// - value string +func (_e *Client_Expecter) Compare(dn interface{}, attribute interface{}, value interface{}) *Client_Compare_Call { + return &Client_Compare_Call{Call: _e.mock.On("Compare", dn, attribute, value)} +} + +func (_c *Client_Compare_Call) Run(run func(dn string, attribute string, value string)) *Client_Compare_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *Client_Compare_Call) Return(_a0 bool, _a1 error) *Client_Compare_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Client_Compare_Call) RunAndReturn(run func(string, string, string) (bool, error)) *Client_Compare_Call { + _c.Call.Return(run) + return _c +} + +// Del provides a mock function with given fields: _a0 +func (_m *Client) Del(_a0 *ldap.DelRequest) error { + ret := _m.Called(_a0) + + if len(ret) == 0 { + panic("no return value specified for Del") + } + + var r0 error + if rf, ok := ret.Get(0).(func(*ldap.DelRequest) error); ok { + r0 = rf(_a0) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Client_Del_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Del' +type Client_Del_Call struct { + *mock.Call +} + +// Del is a helper method to define mock.On call +// - _a0 *ldap.DelRequest +func (_e *Client_Expecter) Del(_a0 interface{}) *Client_Del_Call { + return &Client_Del_Call{Call: _e.mock.On("Del", _a0)} +} + +func (_c *Client_Del_Call) Run(run func(_a0 *ldap.DelRequest)) *Client_Del_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*ldap.DelRequest)) + }) + return _c +} + +func (_c *Client_Del_Call) Return(_a0 error) *Client_Del_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_Del_Call) RunAndReturn(run func(*ldap.DelRequest) error) *Client_Del_Call { + _c.Call.Return(run) + return _c +} + +// 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) + + if len(ret) == 0 { + panic("no return value specified for DirSync") + } + + 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 +} + +// Client_DirSync_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DirSync' +type Client_DirSync_Call struct { + *mock.Call +} + +// DirSync is a helper method to define mock.On call +// - searchRequest *ldap.SearchRequest +// - flags int64 +// - maxAttrCount int64 +// - cookie []byte +func (_e *Client_Expecter) DirSync(searchRequest interface{}, flags interface{}, maxAttrCount interface{}, cookie interface{}) *Client_DirSync_Call { + return &Client_DirSync_Call{Call: _e.mock.On("DirSync", searchRequest, flags, maxAttrCount, cookie)} +} + +func (_c *Client_DirSync_Call) Run(run func(searchRequest *ldap.SearchRequest, flags int64, maxAttrCount int64, cookie []byte)) *Client_DirSync_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*ldap.SearchRequest), args[1].(int64), args[2].(int64), args[3].([]byte)) + }) + return _c +} + +func (_c *Client_DirSync_Call) Return(_a0 *ldap.SearchResult, _a1 error) *Client_DirSync_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Client_DirSync_Call) RunAndReturn(run func(*ldap.SearchRequest, int64, int64, []byte) (*ldap.SearchResult, error)) *Client_DirSync_Call { + _c.Call.Return(run) + return _c +} + +// DirSyncAsync provides a mock function with given fields: ctx, searchRequest, bufferSize, flags, maxAttrCount, cookie +func (_m *Client) DirSyncAsync(ctx context.Context, searchRequest *ldap.SearchRequest, bufferSize int, flags int64, maxAttrCount int64, cookie []byte) ldap.Response { + ret := _m.Called(ctx, searchRequest, bufferSize, flags, maxAttrCount, cookie) + + if len(ret) == 0 { + panic("no return value specified for DirSyncAsync") + } + + var r0 ldap.Response + if rf, ok := ret.Get(0).(func(context.Context, *ldap.SearchRequest, int, int64, int64, []byte) ldap.Response); ok { + r0 = rf(ctx, searchRequest, bufferSize, flags, maxAttrCount, cookie) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(ldap.Response) + } + } + + return r0 +} + +// Client_DirSyncAsync_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DirSyncAsync' +type Client_DirSyncAsync_Call struct { + *mock.Call +} + +// DirSyncAsync is a helper method to define mock.On call +// - ctx context.Context +// - searchRequest *ldap.SearchRequest +// - bufferSize int +// - flags int64 +// - maxAttrCount int64 +// - cookie []byte +func (_e *Client_Expecter) DirSyncAsync(ctx interface{}, searchRequest interface{}, bufferSize interface{}, flags interface{}, maxAttrCount interface{}, cookie interface{}) *Client_DirSyncAsync_Call { + return &Client_DirSyncAsync_Call{Call: _e.mock.On("DirSyncAsync", ctx, searchRequest, bufferSize, flags, maxAttrCount, cookie)} +} + +func (_c *Client_DirSyncAsync_Call) Run(run func(ctx context.Context, searchRequest *ldap.SearchRequest, bufferSize int, flags int64, maxAttrCount int64, cookie []byte)) *Client_DirSyncAsync_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*ldap.SearchRequest), args[2].(int), args[3].(int64), args[4].(int64), args[5].([]byte)) + }) + return _c +} + +func (_c *Client_DirSyncAsync_Call) Return(_a0 ldap.Response) *Client_DirSyncAsync_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_DirSyncAsync_Call) RunAndReturn(run func(context.Context, *ldap.SearchRequest, int, int64, int64, []byte) ldap.Response) *Client_DirSyncAsync_Call { + _c.Call.Return(run) + return _c +} + +// ExternalBind provides a mock function with given fields: +func (_m *Client) ExternalBind() error { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for ExternalBind") + } + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Client_ExternalBind_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ExternalBind' +type Client_ExternalBind_Call struct { + *mock.Call +} + +// ExternalBind is a helper method to define mock.On call +func (_e *Client_Expecter) ExternalBind() *Client_ExternalBind_Call { + return &Client_ExternalBind_Call{Call: _e.mock.On("ExternalBind")} +} + +func (_c *Client_ExternalBind_Call) Run(run func()) *Client_ExternalBind_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Client_ExternalBind_Call) Return(_a0 error) *Client_ExternalBind_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_ExternalBind_Call) RunAndReturn(run func() error) *Client_ExternalBind_Call { + _c.Call.Return(run) + return _c +} + +// GetLastError provides a mock function with given fields: +func (_m *Client) GetLastError() error { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetLastError") + } + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Client_GetLastError_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLastError' +type Client_GetLastError_Call struct { + *mock.Call +} + +// GetLastError is a helper method to define mock.On call +func (_e *Client_Expecter) GetLastError() *Client_GetLastError_Call { + return &Client_GetLastError_Call{Call: _e.mock.On("GetLastError")} +} + +func (_c *Client_GetLastError_Call) Run(run func()) *Client_GetLastError_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Client_GetLastError_Call) Return(_a0 error) *Client_GetLastError_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_GetLastError_Call) RunAndReturn(run func() error) *Client_GetLastError_Call { + _c.Call.Return(run) + return _c +} + +// IsClosing provides a mock function with given fields: +func (_m *Client) IsClosing() bool { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for IsClosing") + } + + var r0 bool + if rf, ok := ret.Get(0).(func() bool); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + +// Client_IsClosing_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsClosing' +type Client_IsClosing_Call struct { + *mock.Call +} + +// IsClosing is a helper method to define mock.On call +func (_e *Client_Expecter) IsClosing() *Client_IsClosing_Call { + return &Client_IsClosing_Call{Call: _e.mock.On("IsClosing")} +} + +func (_c *Client_IsClosing_Call) Run(run func()) *Client_IsClosing_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Client_IsClosing_Call) Return(_a0 bool) *Client_IsClosing_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_IsClosing_Call) RunAndReturn(run func() bool) *Client_IsClosing_Call { + _c.Call.Return(run) + return _c +} + +// Modify provides a mock function with given fields: _a0 +func (_m *Client) Modify(_a0 *ldap.ModifyRequest) error { + ret := _m.Called(_a0) + + if len(ret) == 0 { + panic("no return value specified for Modify") + } + + var r0 error + if rf, ok := ret.Get(0).(func(*ldap.ModifyRequest) error); ok { + r0 = rf(_a0) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Client_Modify_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Modify' +type Client_Modify_Call struct { + *mock.Call +} + +// Modify is a helper method to define mock.On call +// - _a0 *ldap.ModifyRequest +func (_e *Client_Expecter) Modify(_a0 interface{}) *Client_Modify_Call { + return &Client_Modify_Call{Call: _e.mock.On("Modify", _a0)} +} + +func (_c *Client_Modify_Call) Run(run func(_a0 *ldap.ModifyRequest)) *Client_Modify_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*ldap.ModifyRequest)) + }) + return _c +} + +func (_c *Client_Modify_Call) Return(_a0 error) *Client_Modify_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_Modify_Call) RunAndReturn(run func(*ldap.ModifyRequest) error) *Client_Modify_Call { + _c.Call.Return(run) + return _c +} + +// ModifyDN provides a mock function with given fields: _a0 +func (_m *Client) ModifyDN(_a0 *ldap.ModifyDNRequest) error { + ret := _m.Called(_a0) + + if len(ret) == 0 { + panic("no return value specified for ModifyDN") + } + + var r0 error + if rf, ok := ret.Get(0).(func(*ldap.ModifyDNRequest) error); ok { + r0 = rf(_a0) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Client_ModifyDN_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ModifyDN' +type Client_ModifyDN_Call struct { + *mock.Call +} + +// ModifyDN is a helper method to define mock.On call +// - _a0 *ldap.ModifyDNRequest +func (_e *Client_Expecter) ModifyDN(_a0 interface{}) *Client_ModifyDN_Call { + return &Client_ModifyDN_Call{Call: _e.mock.On("ModifyDN", _a0)} +} + +func (_c *Client_ModifyDN_Call) Run(run func(_a0 *ldap.ModifyDNRequest)) *Client_ModifyDN_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*ldap.ModifyDNRequest)) + }) + return _c +} + +func (_c *Client_ModifyDN_Call) Return(_a0 error) *Client_ModifyDN_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_ModifyDN_Call) RunAndReturn(run func(*ldap.ModifyDNRequest) error) *Client_ModifyDN_Call { + _c.Call.Return(run) + return _c +} + +// ModifyWithResult provides a mock function with given fields: _a0 +func (_m *Client) ModifyWithResult(_a0 *ldap.ModifyRequest) (*ldap.ModifyResult, error) { + ret := _m.Called(_a0) + + if len(ret) == 0 { + panic("no return value specified for ModifyWithResult") + } + + 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 +} + +// Client_ModifyWithResult_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ModifyWithResult' +type Client_ModifyWithResult_Call struct { + *mock.Call +} + +// ModifyWithResult is a helper method to define mock.On call +// - _a0 *ldap.ModifyRequest +func (_e *Client_Expecter) ModifyWithResult(_a0 interface{}) *Client_ModifyWithResult_Call { + return &Client_ModifyWithResult_Call{Call: _e.mock.On("ModifyWithResult", _a0)} +} + +func (_c *Client_ModifyWithResult_Call) Run(run func(_a0 *ldap.ModifyRequest)) *Client_ModifyWithResult_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*ldap.ModifyRequest)) + }) + return _c +} + +func (_c *Client_ModifyWithResult_Call) Return(_a0 *ldap.ModifyResult, _a1 error) *Client_ModifyWithResult_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Client_ModifyWithResult_Call) RunAndReturn(run func(*ldap.ModifyRequest) (*ldap.ModifyResult, error)) *Client_ModifyWithResult_Call { + _c.Call.Return(run) + return _c +} + +// NTLMUnauthenticatedBind provides a mock function with given fields: domain, username +func (_m *Client) NTLMUnauthenticatedBind(domain string, username string) error { + ret := _m.Called(domain, username) + + if len(ret) == 0 { + panic("no return value specified for NTLMUnauthenticatedBind") + } + + 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 +} + +// Client_NTLMUnauthenticatedBind_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NTLMUnauthenticatedBind' +type Client_NTLMUnauthenticatedBind_Call struct { + *mock.Call +} + +// NTLMUnauthenticatedBind is a helper method to define mock.On call +// - domain string +// - username string +func (_e *Client_Expecter) NTLMUnauthenticatedBind(domain interface{}, username interface{}) *Client_NTLMUnauthenticatedBind_Call { + return &Client_NTLMUnauthenticatedBind_Call{Call: _e.mock.On("NTLMUnauthenticatedBind", domain, username)} +} + +func (_c *Client_NTLMUnauthenticatedBind_Call) Run(run func(domain string, username string)) *Client_NTLMUnauthenticatedBind_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string)) + }) + return _c +} + +func (_c *Client_NTLMUnauthenticatedBind_Call) Return(_a0 error) *Client_NTLMUnauthenticatedBind_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_NTLMUnauthenticatedBind_Call) RunAndReturn(run func(string, string) error) *Client_NTLMUnauthenticatedBind_Call { + _c.Call.Return(run) + return _c +} + +// PasswordModify provides a mock function with given fields: _a0 +func (_m *Client) PasswordModify(_a0 *ldap.PasswordModifyRequest) (*ldap.PasswordModifyResult, error) { + ret := _m.Called(_a0) + + if len(ret) == 0 { + panic("no return value specified for PasswordModify") + } + + 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 +} + +// Client_PasswordModify_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PasswordModify' +type Client_PasswordModify_Call struct { + *mock.Call +} + +// PasswordModify is a helper method to define mock.On call +// - _a0 *ldap.PasswordModifyRequest +func (_e *Client_Expecter) PasswordModify(_a0 interface{}) *Client_PasswordModify_Call { + return &Client_PasswordModify_Call{Call: _e.mock.On("PasswordModify", _a0)} +} + +func (_c *Client_PasswordModify_Call) Run(run func(_a0 *ldap.PasswordModifyRequest)) *Client_PasswordModify_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*ldap.PasswordModifyRequest)) + }) + return _c +} + +func (_c *Client_PasswordModify_Call) Return(_a0 *ldap.PasswordModifyResult, _a1 error) *Client_PasswordModify_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Client_PasswordModify_Call) RunAndReturn(run func(*ldap.PasswordModifyRequest) (*ldap.PasswordModifyResult, error)) *Client_PasswordModify_Call { + _c.Call.Return(run) + return _c +} + +// Search provides a mock function with given fields: _a0 +func (_m *Client) Search(_a0 *ldap.SearchRequest) (*ldap.SearchResult, error) { + ret := _m.Called(_a0) + + if len(ret) == 0 { + panic("no return value specified for Search") + } + + 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 +} + +// Client_Search_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Search' +type Client_Search_Call struct { + *mock.Call +} + +// Search is a helper method to define mock.On call +// - _a0 *ldap.SearchRequest +func (_e *Client_Expecter) Search(_a0 interface{}) *Client_Search_Call { + return &Client_Search_Call{Call: _e.mock.On("Search", _a0)} +} + +func (_c *Client_Search_Call) Run(run func(_a0 *ldap.SearchRequest)) *Client_Search_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*ldap.SearchRequest)) + }) + return _c +} + +func (_c *Client_Search_Call) Return(_a0 *ldap.SearchResult, _a1 error) *Client_Search_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Client_Search_Call) RunAndReturn(run func(*ldap.SearchRequest) (*ldap.SearchResult, error)) *Client_Search_Call { + _c.Call.Return(run) + return _c +} + +// SearchAsync provides a mock function with given fields: ctx, searchRequest, bufferSize +func (_m *Client) SearchAsync(ctx context.Context, searchRequest *ldap.SearchRequest, bufferSize int) ldap.Response { + ret := _m.Called(ctx, searchRequest, bufferSize) + + if len(ret) == 0 { + panic("no return value specified for SearchAsync") + } + + var r0 ldap.Response + if rf, ok := ret.Get(0).(func(context.Context, *ldap.SearchRequest, int) ldap.Response); ok { + r0 = rf(ctx, searchRequest, bufferSize) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(ldap.Response) + } + } + + return r0 +} + +// Client_SearchAsync_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SearchAsync' +type Client_SearchAsync_Call struct { + *mock.Call +} + +// SearchAsync is a helper method to define mock.On call +// - ctx context.Context +// - searchRequest *ldap.SearchRequest +// - bufferSize int +func (_e *Client_Expecter) SearchAsync(ctx interface{}, searchRequest interface{}, bufferSize interface{}) *Client_SearchAsync_Call { + return &Client_SearchAsync_Call{Call: _e.mock.On("SearchAsync", ctx, searchRequest, bufferSize)} +} + +func (_c *Client_SearchAsync_Call) Run(run func(ctx context.Context, searchRequest *ldap.SearchRequest, bufferSize int)) *Client_SearchAsync_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*ldap.SearchRequest), args[2].(int)) + }) + return _c +} + +func (_c *Client_SearchAsync_Call) Return(_a0 ldap.Response) *Client_SearchAsync_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_SearchAsync_Call) RunAndReturn(run func(context.Context, *ldap.SearchRequest, int) ldap.Response) *Client_SearchAsync_Call { + _c.Call.Return(run) + return _c +} + +// 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) + + if len(ret) == 0 { + panic("no return value specified for SearchWithPaging") + } + + 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 +} + +// Client_SearchWithPaging_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SearchWithPaging' +type Client_SearchWithPaging_Call struct { + *mock.Call +} + +// SearchWithPaging is a helper method to define mock.On call +// - searchRequest *ldap.SearchRequest +// - pagingSize uint32 +func (_e *Client_Expecter) SearchWithPaging(searchRequest interface{}, pagingSize interface{}) *Client_SearchWithPaging_Call { + return &Client_SearchWithPaging_Call{Call: _e.mock.On("SearchWithPaging", searchRequest, pagingSize)} +} + +func (_c *Client_SearchWithPaging_Call) Run(run func(searchRequest *ldap.SearchRequest, pagingSize uint32)) *Client_SearchWithPaging_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*ldap.SearchRequest), args[1].(uint32)) + }) + return _c +} + +func (_c *Client_SearchWithPaging_Call) Return(_a0 *ldap.SearchResult, _a1 error) *Client_SearchWithPaging_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Client_SearchWithPaging_Call) RunAndReturn(run func(*ldap.SearchRequest, uint32) (*ldap.SearchResult, error)) *Client_SearchWithPaging_Call { + _c.Call.Return(run) + return _c +} + +// SetTimeout provides a mock function with given fields: _a0 +func (_m *Client) SetTimeout(_a0 time.Duration) { + _m.Called(_a0) +} + +// Client_SetTimeout_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetTimeout' +type Client_SetTimeout_Call struct { + *mock.Call +} + +// SetTimeout is a helper method to define mock.On call +// - _a0 time.Duration +func (_e *Client_Expecter) SetTimeout(_a0 interface{}) *Client_SetTimeout_Call { + return &Client_SetTimeout_Call{Call: _e.mock.On("SetTimeout", _a0)} +} + +func (_c *Client_SetTimeout_Call) Run(run func(_a0 time.Duration)) *Client_SetTimeout_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(time.Duration)) + }) + return _c +} + +func (_c *Client_SetTimeout_Call) Return() *Client_SetTimeout_Call { + _c.Call.Return() + return _c +} + +func (_c *Client_SetTimeout_Call) RunAndReturn(run func(time.Duration)) *Client_SetTimeout_Call { + _c.Call.Return(run) + return _c +} + +// SimpleBind provides a mock function with given fields: _a0 +func (_m *Client) SimpleBind(_a0 *ldap.SimpleBindRequest) (*ldap.SimpleBindResult, error) { + ret := _m.Called(_a0) + + if len(ret) == 0 { + panic("no return value specified for SimpleBind") + } + + 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 +} + +// Client_SimpleBind_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SimpleBind' +type Client_SimpleBind_Call struct { + *mock.Call +} + +// SimpleBind is a helper method to define mock.On call +// - _a0 *ldap.SimpleBindRequest +func (_e *Client_Expecter) SimpleBind(_a0 interface{}) *Client_SimpleBind_Call { + return &Client_SimpleBind_Call{Call: _e.mock.On("SimpleBind", _a0)} +} + +func (_c *Client_SimpleBind_Call) Run(run func(_a0 *ldap.SimpleBindRequest)) *Client_SimpleBind_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*ldap.SimpleBindRequest)) + }) + return _c +} + +func (_c *Client_SimpleBind_Call) Return(_a0 *ldap.SimpleBindResult, _a1 error) *Client_SimpleBind_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Client_SimpleBind_Call) RunAndReturn(run func(*ldap.SimpleBindRequest) (*ldap.SimpleBindResult, error)) *Client_SimpleBind_Call { + _c.Call.Return(run) + return _c +} + +// Start provides a mock function with given fields: +func (_m *Client) Start() { + _m.Called() +} + +// Client_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start' +type Client_Start_Call struct { + *mock.Call +} + +// Start is a helper method to define mock.On call +func (_e *Client_Expecter) Start() *Client_Start_Call { + return &Client_Start_Call{Call: _e.mock.On("Start")} +} + +func (_c *Client_Start_Call) Run(run func()) *Client_Start_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Client_Start_Call) Return() *Client_Start_Call { + _c.Call.Return() + return _c +} + +func (_c *Client_Start_Call) RunAndReturn(run func()) *Client_Start_Call { + _c.Call.Return(run) + return _c +} + +// StartTLS provides a mock function with given fields: _a0 +func (_m *Client) StartTLS(_a0 *tls.Config) error { + ret := _m.Called(_a0) + + if len(ret) == 0 { + panic("no return value specified for StartTLS") + } + + var r0 error + if rf, ok := ret.Get(0).(func(*tls.Config) error); ok { + r0 = rf(_a0) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Client_StartTLS_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StartTLS' +type Client_StartTLS_Call struct { + *mock.Call +} + +// StartTLS is a helper method to define mock.On call +// - _a0 *tls.Config +func (_e *Client_Expecter) StartTLS(_a0 interface{}) *Client_StartTLS_Call { + return &Client_StartTLS_Call{Call: _e.mock.On("StartTLS", _a0)} +} + +func (_c *Client_StartTLS_Call) Run(run func(_a0 *tls.Config)) *Client_StartTLS_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*tls.Config)) + }) + return _c +} + +func (_c *Client_StartTLS_Call) Return(_a0 error) *Client_StartTLS_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_StartTLS_Call) RunAndReturn(run func(*tls.Config) error) *Client_StartTLS_Call { + _c.Call.Return(run) + return _c +} + +// Syncrepl provides a mock function with given fields: ctx, searchRequest, bufferSize, mode, cookie, reloadHint +func (_m *Client) Syncrepl(ctx context.Context, searchRequest *ldap.SearchRequest, bufferSize int, mode ldap.ControlSyncRequestMode, cookie []byte, reloadHint bool) ldap.Response { + ret := _m.Called(ctx, searchRequest, bufferSize, mode, cookie, reloadHint) + + if len(ret) == 0 { + panic("no return value specified for Syncrepl") + } + + var r0 ldap.Response + if rf, ok := ret.Get(0).(func(context.Context, *ldap.SearchRequest, int, ldap.ControlSyncRequestMode, []byte, bool) ldap.Response); ok { + r0 = rf(ctx, searchRequest, bufferSize, mode, cookie, reloadHint) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(ldap.Response) + } + } + + return r0 +} + +// Client_Syncrepl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Syncrepl' +type Client_Syncrepl_Call struct { + *mock.Call +} + +// Syncrepl is a helper method to define mock.On call +// - ctx context.Context +// - searchRequest *ldap.SearchRequest +// - bufferSize int +// - mode ldap.ControlSyncRequestMode +// - cookie []byte +// - reloadHint bool +func (_e *Client_Expecter) Syncrepl(ctx interface{}, searchRequest interface{}, bufferSize interface{}, mode interface{}, cookie interface{}, reloadHint interface{}) *Client_Syncrepl_Call { + return &Client_Syncrepl_Call{Call: _e.mock.On("Syncrepl", ctx, searchRequest, bufferSize, mode, cookie, reloadHint)} +} + +func (_c *Client_Syncrepl_Call) Run(run func(ctx context.Context, searchRequest *ldap.SearchRequest, bufferSize int, mode ldap.ControlSyncRequestMode, cookie []byte, reloadHint bool)) *Client_Syncrepl_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*ldap.SearchRequest), args[2].(int), args[3].(ldap.ControlSyncRequestMode), args[4].([]byte), args[5].(bool)) + }) + return _c +} + +func (_c *Client_Syncrepl_Call) Return(_a0 ldap.Response) *Client_Syncrepl_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_Syncrepl_Call) RunAndReturn(run func(context.Context, *ldap.SearchRequest, int, ldap.ControlSyncRequestMode, []byte, bool) ldap.Response) *Client_Syncrepl_Call { + _c.Call.Return(run) + return _c +} + +// TLSConnectionState provides a mock function with given fields: +func (_m *Client) TLSConnectionState() (tls.ConnectionState, bool) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for TLSConnectionState") + } + + 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 +} + +// Client_TLSConnectionState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TLSConnectionState' +type Client_TLSConnectionState_Call struct { + *mock.Call +} + +// TLSConnectionState is a helper method to define mock.On call +func (_e *Client_Expecter) TLSConnectionState() *Client_TLSConnectionState_Call { + return &Client_TLSConnectionState_Call{Call: _e.mock.On("TLSConnectionState")} +} + +func (_c *Client_TLSConnectionState_Call) Run(run func()) *Client_TLSConnectionState_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Client_TLSConnectionState_Call) Return(_a0 tls.ConnectionState, _a1 bool) *Client_TLSConnectionState_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Client_TLSConnectionState_Call) RunAndReturn(run func() (tls.ConnectionState, bool)) *Client_TLSConnectionState_Call { + _c.Call.Return(run) + return _c +} + +// UnauthenticatedBind provides a mock function with given fields: username +func (_m *Client) UnauthenticatedBind(username string) error { + ret := _m.Called(username) + + if len(ret) == 0 { + panic("no return value specified for UnauthenticatedBind") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string) error); ok { + r0 = rf(username) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Client_UnauthenticatedBind_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UnauthenticatedBind' +type Client_UnauthenticatedBind_Call struct { + *mock.Call +} + +// UnauthenticatedBind is a helper method to define mock.On call +// - username string +func (_e *Client_Expecter) UnauthenticatedBind(username interface{}) *Client_UnauthenticatedBind_Call { + return &Client_UnauthenticatedBind_Call{Call: _e.mock.On("UnauthenticatedBind", username)} +} + +func (_c *Client_UnauthenticatedBind_Call) Run(run func(username string)) *Client_UnauthenticatedBind_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Client_UnauthenticatedBind_Call) Return(_a0 error) *Client_UnauthenticatedBind_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_UnauthenticatedBind_Call) RunAndReturn(run func(string) error) *Client_UnauthenticatedBind_Call { + _c.Call.Return(run) + return _c +} + +// Unbind provides a mock function with given fields: +func (_m *Client) Unbind() error { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Unbind") + } + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Client_Unbind_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Unbind' +type Client_Unbind_Call struct { + *mock.Call +} + +// Unbind is a helper method to define mock.On call +func (_e *Client_Expecter) Unbind() *Client_Unbind_Call { + return &Client_Unbind_Call{Call: _e.mock.On("Unbind")} +} + +func (_c *Client_Unbind_Call) Run(run func()) *Client_Unbind_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Client_Unbind_Call) Return(_a0 error) *Client_Unbind_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_Unbind_Call) RunAndReturn(run func() error) *Client_Unbind_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 +} diff --git a/services/invitations/.mockery.yaml b/services/invitations/.mockery.yaml new file mode 100644 index 00000000000..6a44afde729 --- /dev/null +++ b/services/invitations/.mockery.yaml @@ -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: \ No newline at end of file diff --git a/services/invitations/Makefile b/services/invitations/Makefile index 5e06194da78..ceb8ad3fffa 100644 --- a/services/invitations/Makefile +++ b/services/invitations/Makefile @@ -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: diff --git a/services/invitations/pkg/backends/keycloak/backend_test.go b/services/invitations/pkg/backends/keycloak/backend_test.go index d1e8bc93d72..4d4a197c335 100644 --- a/services/invitations/pkg/backends/keycloak/backend_test.go +++ b/services/invitations/pkg/backends/keycloak/backend_test.go @@ -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" ) diff --git a/services/invitations/pkg/backends/keycloak/gocloak.go b/services/invitations/pkg/backends/keycloak/gocloak.go index a72b8a6e9d2..ad73fd853a1 100644 --- a/services/invitations/pkg/backends/keycloak/gocloak.go +++ b/services/invitations/pkg/backends/keycloak/gocloak.go @@ -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 diff --git a/services/invitations/pkg/backends/keycloak/mocks/client.go b/services/invitations/pkg/backends/keycloak/mocks/client.go new file mode 100644 index 00000000000..be451669b32 --- /dev/null +++ b/services/invitations/pkg/backends/keycloak/mocks/client.go @@ -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 +} diff --git a/services/invitations/pkg/mocks/client.go b/services/invitations/pkg/mocks/client.go deleted file mode 100644 index a83ddafe4b9..00000000000 --- a/services/invitations/pkg/mocks/client.go +++ /dev/null @@ -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 -} diff --git a/services/proxy/Makefile b/services/proxy/Makefile index eec748b4da9..44e10f95e46 100644 --- a/services/proxy/Makefile +++ b/services/proxy/Makefile @@ -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: diff --git a/services/proxy/mocks/policies_provider_service.go b/services/proxy/mocks/policies_provider_service.go deleted file mode 100644 index 3ace0f52203..00000000000 --- a/services/proxy/mocks/policies_provider_service.go +++ /dev/null @@ -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 -} diff --git a/services/proxy/pkg/middleware/oidc_auth_test.go b/services/proxy/pkg/middleware/oidc_auth_test.go new file mode 100644 index 00000000000..589cbbc5c6e --- /dev/null +++ b/services/proxy/pkg/middleware/oidc_auth_test.go @@ -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()) + }) + }) +}) diff --git a/services/proxy/pkg/middleware/options.go b/services/proxy/pkg/middleware/options.go index d66c6b1e7b5..68c567a673a 100644 --- a/services/proxy/pkg/middleware/options.go +++ b/services/proxy/pkg/middleware/options.go @@ -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 diff --git a/services/proxy/pkg/middleware/policies_test.go b/services/proxy/pkg/middleware/policies_test.go index 78af83c4993..e02508981bd 100644 --- a/services/proxy/pkg/middleware/policies_test.go +++ b/services/proxy/pkg/middleware/policies_test.go @@ -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) { diff --git a/services/proxy/pkg/user/backend/backend.go b/services/proxy/pkg/user/backend/backend.go index 8ff2c254a00..cc9c86a8a8a 100644 --- a/services/proxy/pkg/user/backend/backend.go +++ b/services/proxy/pkg/user/backend/backend.go @@ -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) diff --git a/services/proxy/pkg/userroles/userroles.go b/services/proxy/pkg/userroles/userroles.go index f72c51bad8b..c8e51f54e8f 100644 --- a/services/proxy/pkg/userroles/userroles.go +++ b/services/proxy/pkg/userroles/userroles.go @@ -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 { diff --git a/services/search/.mockery.yaml b/services/search/.mockery.yaml new file mode 100644 index 00000000000..903e54e0cd4 --- /dev/null +++ b/services/search/.mockery.yaml @@ -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: \ No newline at end of file diff --git a/services/search/Makefile b/services/search/Makefile index aa008626937..bc58a2eb79f 100644 --- a/services/search/Makefile +++ b/services/search/Makefile @@ -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 diff --git a/services/search/pkg/content/extractor.go b/services/search/pkg/content/extractor.go index 75f69af16e1..a91be6cb4ec 100644 --- a/services/search/pkg/content/extractor.go +++ b/services/search/pkg/content/extractor.go @@ -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) } diff --git a/services/search/pkg/content/mocks/extractor.go b/services/search/pkg/content/mocks/extractor.go index 18eca6fe3ef..80a795af36d 100644 --- a/services/search/pkg/content/mocks/extractor.go +++ b/services/search/pkg/content/mocks/extractor.go @@ -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) diff --git a/services/search/pkg/content/mocks/retriever.go b/services/search/pkg/content/mocks/retriever.go index 30fa3cb8784..76271c2205c 100644 --- a/services/search/pkg/content/mocks/retriever.go +++ b/services/search/pkg/content/mocks/retriever.go @@ -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) diff --git a/services/search/pkg/content/retriever.go b/services/search/pkg/content/retriever.go index 1548a5bb9ca..bb64584d6f8 100644 --- a/services/search/pkg/content/retriever.go +++ b/services/search/pkg/content/retriever.go @@ -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) } diff --git a/services/search/pkg/engine/engine.go b/services/search/pkg/engine/engine.go index 931b0426557..734cf607f3d 100644 --- a/services/search/pkg/engine/engine.go +++ b/services/search/pkg/engine/engine.go @@ -14,8 +14,6 @@ import ( var queryEscape = regexp.MustCompile(`([` + regexp.QuoteMeta(`+=&|>