Merge branch 'master' into backmerge-master-3

This commit is contained in:
Michael Barz
2024-02-02 12:30:49 +01:00
242 changed files with 19233 additions and 4540 deletions
+3 -3
View File
@@ -65,11 +65,11 @@ $(HUGO): $(BINGO_DIR)/hugo.mod
@echo "(re)installing $(GOBIN)/hugo-v0.115.2"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=hugo.mod -o=$(GOBIN)/hugo-v0.115.2 "github.com/gohugoio/hugo"
MOCKERY := $(GOBIN)/mockery-v2.22.1
MOCKERY := $(GOBIN)/mockery-v2.40.1
$(MOCKERY): $(BINGO_DIR)/mockery.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
@echo "(re)installing $(GOBIN)/mockery-v2.22.1"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=mockery.mod -o=$(GOBIN)/mockery-v2.22.1 "github.com/vektra/mockery/v2"
@echo "(re)installing $(GOBIN)/mockery-v2.40.1"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=mockery.mod -o=$(GOBIN)/mockery-v2.40.1 "github.com/vektra/mockery/v2"
MUTAGEN := $(GOBIN)/mutagen-v0.13.1
$(MUTAGEN): $(BINGO_DIR)/mutagen.mod
+2 -2
View File
@@ -1,5 +1,5 @@
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT
go 1.20
go 1.21.6
require github.com/vektra/mockery/v2 v2.22.1
require github.com/vektra/mockery/v2 v2.40.1
+12 -19
View File
@@ -39,8 +39,8 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/chigopher/pathlib v0.12.0 h1:1GM7fN/IwXXmOHbd1jkMqHD2wUhYqUvafgxTwmLT/q8=
github.com/chigopher/pathlib v0.12.0/go.mod h1:EJ5UtJ/sK8Nt6q3VWN+EwZLZ3g0afJiG8NegYiQQ/gQ=
github.com/chigopher/pathlib v0.19.1 h1:RoLlUJc0CqBGwq239cilyhxPNLXTK+HXoASGyGznx5A=
github.com/chigopher/pathlib v0.19.1/go.mod h1:tzC1dZLW8o33UQpWkNkhvPwL5n4yyFRFm/jL1YGWFvY=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
@@ -122,6 +122,8 @@ github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU=
github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/iancoleman/strcase v0.2.0 h1:05I4QRnGpI0m37iZQRuskXh+w77mr6Z41lwQzuHLwW0=
github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
@@ -153,10 +155,7 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU=
github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI=
github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
@@ -165,7 +164,6 @@ github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.29.0 h1:Zes4hju04hjbvkVkOhdl2HpZa+0PmVwigmo8XoORE5w=
github.com/rs/zerolog v1.29.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/spf13/afero v1.4.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I=
github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk=
github.com/spf13/afero v1.9.3/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y=
github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w=
@@ -179,21 +177,19 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An
github.com/spf13/viper v1.15.0 h1:js3yy885G8xwJa6iOISGFwd+qlUo5AvyXb7CiihdtiU=
github.com/spf13/viper v1.15.0/go.mod h1:fFcTBJxvhhzSJiZy8n+PeW6t8l+KeT/uTARa0jHOQLA=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8=
github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0=
github.com/vektra/mockery/v2 v2.22.1 h1:ryH5jFQ35Z7o1Adt65fYO5n4Y7eRybjNWM6opb+ZjRE=
github.com/vektra/mockery/v2 v2.22.1/go.mod h1:Zh3Kv1ckKs6FokhlVLcCu6UTyzfS3M8mpROz1lBNp+w=
github.com/vektra/mockery/v2 v2.40.1 h1:8D01rBqloDLDHKZGXkyUD9Yj5Z+oDXBqDZ+tRXYM/oA=
github.com/vektra/mockery/v2 v2.40.1/go.mod h1:dPzGtjT0/Uu4hqpF6QNHwz+GLago7lq1bxdj9wHbGKo=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
@@ -207,13 +203,10 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc=
golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@@ -247,8 +240,8 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs=
golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -337,8 +330,8 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
@@ -400,8 +393,8 @@ golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4f
golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4=
golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+1 -1
View File
@@ -24,7 +24,7 @@ GOVULNCHECK="${GOBIN}/govulncheck-v1.0.1"
HUGO="${GOBIN}/hugo-v0.115.2"
MOCKERY="${GOBIN}/mockery-v2.22.1"
MOCKERY="${GOBIN}/mockery-v2.40.1"
MUTAGEN="${GOBIN}/mutagen-v0.13.1"
+1 -1
View File
@@ -1,3 +1,3 @@
# The test runner source for UI tests
WEB_COMMITID=113e07f9a105e8fe2ec950392b9055a5f779c7d2
WEB_COMMITID=304fa011f59131657b5fc9698d0627b2b6d8c694
WEB_BRANCH=stable-8.0
+2 -4
View File
@@ -821,7 +821,6 @@ def localApiTestPipeline(ctx):
def localApiTests(suite, storage, extra_environment = {}):
environment = {
"TEST_WITH_GRAPH_API": "true",
"PATH_TO_OCIS": dirs["base"],
"TEST_SERVER_URL": "https://ocis-server:9200",
"OCIS_REVA_DATA_ROOT": "%s" % (dirs["ocisRevaDataRoot"] if storage == "owncloud" else ""),
@@ -1005,7 +1004,6 @@ def coreApiTests(ctx, part_number = 1, number_of_parts = 1, storage = "ocis", ac
"name": "oC10ApiTests-%s-storage-%s" % (storage, part_number),
"image": OC_CI_PHP % DEFAULT_PHP_VERSION,
"environment": {
"TEST_WITH_GRAPH_API": "true",
"PATH_TO_OCIS": "%s" % dirs["base"],
"TEST_SERVER_URL": "https://ocis-server:9200",
"OCIS_REVA_DATA_ROOT": "%s" % (dirs["ocisRevaDataRoot"] if storage == "owncloud" else ""),
@@ -1163,11 +1161,11 @@ def e2eTests(ctx):
test_suites = {
"suite1": {
"path": "tests/e2e/cucumber/features/*/*[!.oc10].feature",
"tikaNeeded": True,
"tikaNeeded": False,
},
"suite2": {
"path": "tests/e2e/cucumber/features/smoke/*[!app-provider]/*[!.oc10].feature",
"tikaNeeded": False,
"tikaNeeded": True,
},
}
+12
View File
@@ -107,3 +107,15 @@ $(BIN)/$(EXECUTABLE)-debug: $(SOURCES)
.PHONY: watch
watch: $(REFLEX)
$(REFLEX) -c reflex.conf
debug-linux-docker-amd64: release-dirs
GOOS=linux \
GOARCH=amd64 \
go build \
-gcflags="all=-N -l" \
-tags 'netgo $(TAGS)' \
-buildmode=exe \
-trimpath \
-ldflags '-extldflags "-static" $(DEBUG_LDFLAGS) $(DOCKER_LDFLAGS)' \
-o '$(DIST)/binaries/$(EXECUTABLE)-linux-amd64' \
./cmd/$(NAME)
+7
View File
@@ -6,6 +6,13 @@
"type": "php",
"request": "launch"
},
{
"name": "Debug remote :40000",
"type": "go",
"request": "attach",
"mode": "remote",
"port": 40000
},
{
"name": "oCIS server",
"type": "go",
@@ -1,7 +1,16 @@
Enhancement: Update web to v8.0.0-rc.2
Enhancement: Update web to v8.0.0-rc.3
Tags: web
We updated ownCloud Web to v8.0.0-rc.3. Please refer to the changelog (linked) for details on the web release.
## Summary
* Bugfix [owncloud/web#10318](https://github.com/owncloud/web/pull/10318): Scrollable account page
* Bugfix [owncloud/web#10321](https://github.com/owncloud/web/pull/10321): Private link error messages
* Bugfix [owncloud/web#10347](https://github.com/owncloud/web/pull/10347): Readonly user attributes have no effect on group memberships
* Bugfix [owncloud/web#10424](https://github.com/owncloud/web/pull/10424): Restore space
* Enhancement [owncloud/web#10356](https://github.com/owncloud/web/pull/10356): Preview app add reset button for images
We updated ownCloud Web to v8.0.0-rc.2. Please refer to the changelog (linked) for details on the web release.
## Summary
@@ -127,6 +136,10 @@ We updated ownCloud Web to v8.0.0-alpha.12. Please refer to the changelog (linke
* Enhancement [owncloud/web#10099](https://github.com/owncloud/web/pull/10099): Support mandatory filter while listing users
* Enhancement [owncloud/web#10102](https://github.com/owncloud/web/pull/10102): Registering quick actions as extension
https://github.com/owncloud/ocis/pull/8342
https://github.com/owncloud/web/releases/tag/v8.0.0-rc.3
https://github.com/owncloud/ocis/pull/8154
https://github.com/owncloud/web/releases/tag/v8.0.0-rc.2
https://github.com/owncloud/ocis/pull/8154
https://github.com/owncloud/web/releases/tag/v8.0.0-rc.2
https://github.com/owncloud/ocis/pull/8055
@@ -0,0 +1,8 @@
Enhancement: Modify the concurrency default
We have changed the default MaxConcurrency value from 100 to 5 to prevent too frequent gc runs on low memory systems.
We have also bumped reva to pull in the related changes from there.
https://github.com/owncloud/ocis/pull/8309
https://github.com/owncloud/ocis/issues/8257
https://github.com/cs3org/reva/pull/4485
@@ -0,0 +1,7 @@
Enhancement: Support login page background configuration
Introduce a new environment variable `IDP_LOGIN_BACKGROUND_URL`
that overrides the default background image of the IDP login page when present.
https://github.com/owncloud/ocis/issues/7674
https://github.com/owncloud/ocis/pull/7900
@@ -0,0 +1,5 @@
Bugfix: Fix concurrent shares config
We fixed setting the config for concurrent web requests, which did not work as expected before.
https://github.com/owncloud/ocis/pull/8317
@@ -0,0 +1,5 @@
Bugfix: Remove invalid environment variables
We have removed two spaces related environment variables (whether project spaces and the share jail are enabled) and hardcoded the only allowed options. Misusing those variables would have resulted in invalid config.
https://github.com/owncloud/ocis/pull/8303
+46
View File
@@ -134,6 +134,52 @@ bin/ocis --log-level=$LOG_LEVEL proxy &
4. Start the service you are interested in debug mode. When using make to build the binary there is already a `bin/ocis-debug` binary for you. When running an IDE tell it which service to start by providing the corresponding sub command, e.g. `bin\ocis-debug reva-frontend`.
### Debugging the ocis in a docker container
Remote debugging is the debug mode commonly used to work with a debugger and target running on a remote machine or a container for example a wopi stack `deployments/examples/ocis_wopi/docker-compose.yml`.
Below we describe the steps how to build the image, run the docker-compose and connect via remote debugger.
1. Build the image:
```bash
cd github.com/owncloud/ocis/ocis
make debug-docker
```
2. Change the tag label:
```bash
export OCIS_DOCKER_TAG=debug
```
3. Change the docker-compose `ocis` or `ocis-appprovider-collabora` or `ocis-appprovider-onlyoffice` depends on what do you want to debug:
For example `deployments/examples/ocis_wopi/docker-compose.yml`
```yaml
ocis:
image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
networks:
ocis-net:
entrypoint:
- /bin/sh
# Comment out command
# command: ["-c", "ocis init || true; ocis server"]
# Replace the command and expose the port
command: [ "-c", "ocis init || true; dlv --listen=:40000 --headless=true --api-version=2 --accept-multiclient exec /usr/bin/ocis server" ]
ports:
- 40000:40000
```
4. Run the docker-compose
5. Connect to remote `delve`
* For the VS Code add the configuration to the `.vscode/launch.json` [https://github.com/golang/vscode-go/wiki/debugging#remote-debugging](https://github.com/golang/vscode-go/wiki/debugging#remote-debugging)
```json
{
"name": "Debug remote :40000",
"type": "go",
"request": "attach",
"mode": "remote",
"port": 40000,
"host": "localhost", // optional
"trace": "verbose", // optional
"showLog": true // optional
},
```
### Gather error messages
We recommend you collect all related information in a single file or in a GitHub issue. Let us start with an error that pops up in the Web UI:
-7
View File
@@ -223,7 +223,6 @@ ocis/bin/ocis server
```bash
make test-acceptance-api \
TEST_SERVER_URL=https://localhost:9200 \
TEST_WITH_GRAPH_API=true \
```
#### Run Tests Transferred From ownCloud Core (prefix `coreApi`)
@@ -231,7 +230,6 @@ TEST_WITH_GRAPH_API=true \
```bash
make test-acceptance-from-core-api \
TEST_SERVER_URL=https://localhost:9200 \
TEST_WITH_GRAPH_API=true \
```
Useful environment variables:
@@ -289,7 +287,6 @@ If you want to work on a specific issue
```bash
make test-acceptance-from-core-api \
TEST_SERVER_URL=https://localhost:9200 \
TEST_WITH_GRAPH_API=true \
STORAGE_DRIVER=OCIS \
BEHAT_FEATURE='tests/acceptance/features/coreApiVersions/fileVersions.feature:147'
```
@@ -326,7 +323,6 @@ PROXY_ENABLE_BASIC_AUTH=true \
```bash
OCIS_WRAPPER_URL=http://localhost:5200 \
TEST_WITH_GRAPH_API=true \
TEST_SERVER_URL="https://localhost:9200" \
BEHAT_FEATURE=tests/acceptance/features/apiAsyncUpload/delayPostprocessing.feature \
make test-acceptance-api
@@ -374,7 +370,6 @@ ocis/bin/ocis server
Run the acceptance test with the following command:
```bash
TEST_WITH_GRAPH_API=true \
TEST_SERVER_URL="https://localhost:9200" \
EMAIL_HOST="localhost" \
EMAIL_PORT=9000 \
@@ -417,7 +412,6 @@ ocis/bin/ocis server
Run the acceptance test with the following command:
```bash
TEST_WITH_GRAPH_API=true \
TEST_SERVER_URL="https://localhost:9200" \
BEHAT_FEATURE="tests/acceptance/features/apiSearch/contentSearch.feature" \
make test-acceptance-api
@@ -539,7 +533,6 @@ For antivirus running with docker, use `ANTIVIRUS_CLAMAV_SOCKET= "tcp://host.doc
Run the acceptance test with the following command:
```bash
TEST_WITH_GRAPH_API=true \
TEST_SERVER_URL="https://localhost:9200" \
BEHAT_FEATURE="tests/acceptance/features/apiAntivirus/antivirus.feature" \
make test-acceptance-api
+17 -15
View File
@@ -3,17 +3,16 @@ module github.com/owncloud/ocis/v2
go 1.21
require (
github.com/CiscoM31/godata v1.0.9
github.com/KimMachineGun/automemlimit v0.4.0
github.com/CiscoM31/godata v1.0.10
github.com/KimMachineGun/automemlimit v0.5.0
github.com/Masterminds/semver v1.5.0
github.com/MicahParks/keyfunc v1.9.0
github.com/Nerzal/gocloak/v13 v13.8.0
github.com/Nerzal/gocloak/v13 v13.9.0
github.com/bbalet/stopwords v1.0.0
github.com/blevesearch/bleve/v2 v2.3.10
github.com/coreos/go-oidc v2.2.1+incompatible
github.com/coreos/go-oidc/v3 v3.9.0
github.com/cs3org/go-cs3apis v0.0.0-20231023073225-7748710e0781
github.com/cs3org/reva/v2 v2.18.1-0.20240126141248-c9e4a3bcd0da
github.com/cs3org/reva/v2 v2.18.1-0.20240129131717-cff0a2eeb959
github.com/dhowden/tag v0.0.0-20230630033851-978a0926ee25
github.com/disintegration/imaging v1.6.2
github.com/dutchcoders/go-clamd v0.0.0-20170520113014-b970184f4d9e
@@ -46,10 +45,10 @@ require (
github.com/golang/protobuf v1.5.3
github.com/google/go-cmp v0.6.0
github.com/google/go-tika v0.3.0
github.com/google/uuid v1.5.0
github.com/google/uuid v1.6.0
github.com/gookit/config/v2 v2.2.5
github.com/gorilla/mux v1.8.1
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1
github.com/jellydator/ttlcache/v2 v2.11.1
github.com/jellydator/ttlcache/v3 v3.1.1
github.com/jinzhu/now v1.1.5
@@ -66,10 +65,10 @@ require (
github.com/olekukonko/tablewriter v0.0.5
github.com/onsi/ginkgo v1.16.5
github.com/onsi/ginkgo/v2 v2.15.0
github.com/onsi/gomega v1.31.0
github.com/open-policy-agent/opa v0.60.0
github.com/onsi/gomega v1.31.1
github.com/open-policy-agent/opa v0.61.0
github.com/orcaman/concurrent-map v1.0.0
github.com/owncloud/libre-graph-api-go v1.0.5-0.20240115110609-b018a896364e
github.com/owncloud/libre-graph-api-go v1.0.5-0.20240130152355-ac663a9002a1
github.com/pkg/errors v0.9.1
github.com/pkg/xattr v0.4.9
github.com/prometheus/client_golang v1.18.0
@@ -102,8 +101,8 @@ require (
golang.org/x/sync v0.6.0
golang.org/x/term v0.16.0
golang.org/x/text v0.14.0
google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917
google.golang.org/grpc v1.60.1
google.golang.org/genproto/googleapis/api v0.0.0-20240125205218-1f4bbc51befe
google.golang.org/grpc v1.61.0
google.golang.org/protobuf v1.32.0
gopkg.in/square/go-jose.v2 v2.6.0
gopkg.in/yaml.v2 v2.4.0
@@ -161,6 +160,7 @@ require (
github.com/cilium/ebpf v0.9.1 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/containerd/cgroups/v3 v3.0.2 // indirect
github.com/coreos/go-oidc v2.2.1+incompatible // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/cornelk/hashmap v1.0.8 // indirect
@@ -214,6 +214,7 @@ require (
github.com/gofrs/flock v0.8.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/golang-jwt/jwt/v5 v5.0.0 // indirect
github.com/golang/geo v0.0.0-20210211234256-740aa86cb551 // indirect
github.com/golang/glog v1.1.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
@@ -280,10 +281,11 @@ require (
github.com/nats-io/nkeys v0.4.7 // indirect
github.com/nats-io/nuid v1.0.1 // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/opencontainers/runtime-spec v1.1.0-rc.1 // indirect
github.com/opencontainers/runtime-spec v1.1.0 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/pquerna/cachecontrol v0.1.0 // indirect
@@ -340,8 +342,8 @@ require (
golang.org/x/tools v0.16.1 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20231212172506-995d672761c0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 // indirect
google.golang.org/genproto v0.0.0-20240116215550-a9fa1716bcac // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe // indirect
gopkg.in/cenkalti/backoff.v1 v1.1.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
+34 -29
View File
@@ -795,12 +795,12 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8=
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/CiscoM31/godata v1.0.9 h1:7ovi2efjWb6RloX96AJqBB9eyIfBdarzj8kzg7glPC4=
github.com/CiscoM31/godata v1.0.9/go.mod h1:ZMiT6JuD3Rm83HEtiTx4JEChsd25YCrxchKGag/sdTc=
github.com/CiscoM31/godata v1.0.10 h1:DZdJ6M8QNh4HquvDDOqNLu6h77Wl86KGK7Qlbmb90sk=
github.com/CiscoM31/godata v1.0.10/go.mod h1:ZMiT6JuD3Rm83HEtiTx4JEChsd25YCrxchKGag/sdTc=
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c/go.mod h1:X0CRv0ky0k6m906ixxpzmDRLvX58TFUKS2eePweuyxk=
github.com/KimMachineGun/automemlimit v0.4.0 h1:qOjSDbAUENEL6fiKmRKuAVhPaLijpoEHFDTE+I+prp0=
github.com/KimMachineGun/automemlimit v0.4.0/go.mod h1:pJhTW/nWJMj6SnWSU2TEKSlCaM+1N5Mej+IfS/5/Ol0=
github.com/KimMachineGun/automemlimit v0.5.0 h1:BeOe+BbJc8L5chL3OwzVYjVzyvPALdd5wxVVOWuUZmQ=
github.com/KimMachineGun/automemlimit v0.5.0/go.mod h1:di3GCKiu9Y+1fs92erCbUvKzPkNyViN3mA0vti/ykEQ=
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=
@@ -812,8 +812,8 @@ github.com/MicahParks/keyfunc v1.9.0/go.mod h1:IdnCilugA0O/99dW+/MkvlyrsX8+L8+x9
github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY=
github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow=
github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
github.com/Nerzal/gocloak/v13 v13.8.0 h1:7s9cK8X3vy8OIic+pG4POE9vGy02tSHkMhvWXv0P2m8=
github.com/Nerzal/gocloak/v13 v13.8.0/go.mod h1:rRBtEdh5N0+JlZZEsrfZcB2sRMZWbgSxI2EIv9jpJp4=
github.com/Nerzal/gocloak/v13 v13.9.0 h1:YWsJsdM5b0yhM2Ba3MLydiOlujkBry4TtdzfIzSVZhw=
github.com/Nerzal/gocloak/v13 v13.9.0/go.mod h1:YYuDcXZ7K2zKECyVP7pPqjKxx2AzYSpKDj8d6GuyM10=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/OneOfOne/xxhash v1.2.8 h1:31czK/TI9sNkxIKfaUfGlU47BAxQ0ztGgd9vPyqimf8=
github.com/OneOfOne/xxhash v1.2.8/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q=
@@ -988,8 +988,9 @@ github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWH
github.com/cncf/xds/go v0.0.0-20220314180256-7f1daf1720fc/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20230105202645-06c439db220b/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20230310173818-32f1caf87195/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 h1:/inchEIKaYC1Akx+H+gqO04wryn5h75LSazbRlnya1k=
github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20231109132714-523115ebc101 h1:7To3pQ+pZo0i3dsWEbinPNFs5gPSBOsJtx3wTT94VBY=
github.com/cncf/xds/go v0.0.0-20231109132714-523115ebc101/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/containerd/cgroups/v3 v3.0.2 h1:f5WFqIVSgo5IZmtTT3qVBo6TzI1ON6sycSBKkymb9L0=
github.com/containerd/cgroups/v3 v3.0.2/go.mod h1:JUgITrzdFqp42uI2ryGA+ge0ap/nxzYgkGmIcetmErE=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
@@ -1018,8 +1019,8 @@ github.com/crewjam/saml v0.4.14 h1:g9FBNx62osKusnFzs3QTN5L9CVA/Egfgm+stJShzw/c=
github.com/crewjam/saml v0.4.14/go.mod h1:UVSZCf18jJkk6GpWNVqcyQJMD5HsRugBPf4I1nl2mME=
github.com/cs3org/go-cs3apis v0.0.0-20231023073225-7748710e0781 h1:BUdwkIlf8IS2FasrrPg8gGPHQPOrQ18MS1Oew2tmGtY=
github.com/cs3org/go-cs3apis v0.0.0-20231023073225-7748710e0781/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY=
github.com/cs3org/reva/v2 v2.18.1-0.20240126141248-c9e4a3bcd0da h1:VgWIr/lE6cv2f5IjjWgR0LOAK41gsUytBsSZo/4DRq4=
github.com/cs3org/reva/v2 v2.18.1-0.20240126141248-c9e4a3bcd0da/go.mod h1:GCN3g6uYE0Nvd31dGlhaGGyUviUfbG2NkecPRv5oSc4=
github.com/cs3org/reva/v2 v2.18.1-0.20240129131717-cff0a2eeb959 h1:8uiYRWlbrhQJk4pHawpJUTFx/Yy0G5yvMYam2TMKDYo=
github.com/cs3org/reva/v2 v2.18.1-0.20240129131717-cff0a2eeb959/go.mod h1:GCN3g6uYE0Nvd31dGlhaGGyUviUfbG2NkecPRv5oSc4=
github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4=
github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg=
github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
@@ -1281,6 +1282,8 @@ github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzq
github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg=
github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
github.com/golang-jwt/jwt/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJUE=
github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
github.com/golang/geo v0.0.0-20210211234256-740aa86cb551 h1:gtexQ/VGyN+VVFRXSFiguSNcXmS6rkKT+X7FdIrTtfo=
github.com/golang/geo v0.0.0-20210211234256-740aa86cb551/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI=
@@ -1395,8 +1398,8 @@ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+
github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU=
github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8=
github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8=
github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg=
@@ -1452,8 +1455,8 @@ github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3/go.mod h1:o//XUCC/F+yRGJoPO/VU0GSB0f8Nhgmxx0VIRUvaC0w=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 h1:Wqo399gCIufwto+VfwCSvsnfGpF/w5E9CNxSwbpD6No=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0/go.mod h1:qmOFXW2epJhM0qSnUUYpldc7gVz2KMQwJ/QYCDIa7XU=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 h1:/c3QmbOGMGTOumP2iT/rCwB7b0QDGLKzqOmktBjT+Is=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1/go.mod h1:5SN9VR2LTsRFsrEC6FHgRbTWrTHu6tqPeKxEQv15giM=
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI=
github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
github.com/hashicorp/consul/api v1.15.2 h1:3Q/pDqvJ7udgt/60QOOW/p/PeKioQN+ncYzzCdN2av0=
@@ -1775,12 +1778,12 @@ github.com/onsi/ginkgo/v2 v2.15.0/go.mod h1:HlxMHtYF57y6Dpf+mc5529KKmSq9h2FpCF+/
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/onsi/gomega v1.31.0 h1:54UJxxj6cPInHS3a35wm6BK/F9nHYueZ1NVujHDrnXE=
github.com/onsi/gomega v1.31.0/go.mod h1:DW9aCi7U6Yi40wNVAvT6kzFnEVEI5n3DloYBiKiT6zk=
github.com/open-policy-agent/opa v0.60.0 h1:ZPoPt4yeNs5UXCpd/P/btpSyR8CR0wfhVoh9BOwgJNs=
github.com/open-policy-agent/opa v0.60.0/go.mod h1:aD5IK6AiLNYBjNXn7E02++yC8l4Z+bRDvgM6Ss0bBzA=
github.com/opencontainers/runtime-spec v1.1.0-rc.1 h1:wHa9jroFfKGQqFHj0I1fMRKLl0pfj+ynAqBxo3v6u9w=
github.com/opencontainers/runtime-spec v1.1.0-rc.1/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
github.com/onsi/gomega v1.31.1 h1:KYppCUK+bUgAZwHOu7EXVBKyQA6ILvOESHkn/tgoqvo=
github.com/onsi/gomega v1.31.1/go.mod h1:y40C95dwAD1Nz36SsEnxvfFe8FFfNxzI5eJ0EYGyAy0=
github.com/open-policy-agent/opa v0.61.0 h1:nhncQ2CAYtQTV/SMBhDDPsCpCQsUW+zO/1j+T5V7oZg=
github.com/open-policy-agent/opa v0.61.0/go.mod h1:7OUuzJnsS9yHf8lw0ApfcbrnaRG1EkN3J2fuuqi4G/E=
github.com/opencontainers/runtime-spec v1.1.0 h1:HHUyrt9mwHUjtasSbXSMvs4cyFxh+Bll4AjJ9odEGpg=
github.com/opencontainers/runtime-spec v1.1.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs=
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
@@ -1789,8 +1792,8 @@ github.com/oracle/oci-go-sdk v24.3.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35uk
github.com/orcaman/concurrent-map v1.0.0 h1:I/2A2XPCb4IuQWcQhBhSwGfiuybl/J0ev9HDbW65HOY=
github.com/orcaman/concurrent-map v1.0.0/go.mod h1:Lu3tH6HLW3feq74c2GC+jIMS/K2CFcDWnWD9XkenwhI=
github.com/ovh/go-ovh v1.1.0/go.mod h1:AxitLZ5HBRPyUd+Zl60Ajaag+rNTdVXWIkzfrVuTXWA=
github.com/owncloud/libre-graph-api-go v1.0.5-0.20240115110609-b018a896364e h1:Y7MEJYsPe+UGlmU7oR9LaBIsQQYTwCq4a/p0JCia2cA=
github.com/owncloud/libre-graph-api-go v1.0.5-0.20240115110609-b018a896364e/go.mod h1:v2aAl5IwEI8t+GmcWvBd+bvJMYp9Vf1hekLuRf0UnEs=
github.com/owncloud/libre-graph-api-go v1.0.5-0.20240130152355-ac663a9002a1 h1:QLEERCsKv9VhkQaCP5zMEPdAqJLp/iuyogrg/eTfISg=
github.com/owncloud/libre-graph-api-go v1.0.5-0.20240130152355-ac663a9002a1/go.mod h1:v2aAl5IwEI8t+GmcWvBd+bvJMYp9Vf1hekLuRf0UnEs=
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw=
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
@@ -1798,6 +1801,8 @@ github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0Mw
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0=
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc=
github.com/phpdave11/gofpdf v1.4.2/go.mod h1:zpO6xFn9yxo3YLyMvW8HcKWVdbNqgIfOOp2dXMnm1mY=
@@ -2857,8 +2862,8 @@ google.golang.org/genproto v0.0.0-20230629202037-9506855d4529/go.mod h1:xZnkP7mR
google.golang.org/genproto v0.0.0-20230706204954-ccb25ca9f130/go.mod h1:O9kGHb51iE/nOGvQaDUuadVYqovW56s5emA88lQnj6Y=
google.golang.org/genproto v0.0.0-20230726155614-23370e0ffb3e/go.mod h1:0ggbjUrZYpy1q+ANUS30SEoGZ53cdfwtbuG7Ptgy108=
google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5/go.mod h1:oH/ZOT02u4kWEp7oYBGYFFkCdKS/uYR9Z7+0/xuuFp8=
google.golang.org/genproto v0.0.0-20231212172506-995d672761c0 h1:YJ5pD9rF8o9Qtta0Cmy9rdBwkSjrTCT6XTiUQVOtIos=
google.golang.org/genproto v0.0.0-20231212172506-995d672761c0/go.mod h1:l/k7rMz0vFTBPy+tFSGvXEd3z+BcoG1k7EHbqm+YBsY=
google.golang.org/genproto v0.0.0-20240116215550-a9fa1716bcac h1:ZL/Teoy/ZGnzyrqK/Optxxp2pmVh+fmJ97slxSRyzUg=
google.golang.org/genproto v0.0.0-20240116215550-a9fa1716bcac/go.mod h1:+Rvu7ElI+aLzyDQhpHMFMMltsD6m7nqpuWDd2CwJw3k=
google.golang.org/genproto/googleapis/api v0.0.0-20230525234020-1aefcd67740a/go.mod h1:ts19tUU+Z0ZShN1y3aPyq2+O3d5FUNNgT6FtOzmrNn8=
google.golang.org/genproto/googleapis/api v0.0.0-20230525234035-dd9d682886f9/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig=
google.golang.org/genproto/googleapis/api v0.0.0-20230526203410-71b5a4ffd15e/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig=
@@ -2867,8 +2872,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230629202037-9506855d4529/go.
google.golang.org/genproto/googleapis/api v0.0.0-20230706204954-ccb25ca9f130/go.mod h1:mPBs5jNgx2GuQGvFwUvVKqtn6HsUw9nP64BedgvqEsQ=
google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ=
google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5/go.mod h1:5DZzOUPCLYL3mNkQ0ms0F3EuUNZ7py1Bqeq6sxzI7/Q=
google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 h1:rcS6EyEaoCO52hQDupoSfrxI3R6C2Tq741is7X8OvnM=
google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917/go.mod h1:CmlNWB9lSezaYELKS5Ym1r44VrrbPUa7JTvw+6MbpJ0=
google.golang.org/genproto/googleapis/api v0.0.0-20240125205218-1f4bbc51befe h1:0poefMBYvYbs7g5UkjS6HcxBPaTRAmznle9jnxYoAI8=
google.golang.org/genproto/googleapis/api v0.0.0-20240125205218-1f4bbc51befe/go.mod h1:4jWUdICTdgc3Ibxmr8nAJiiLHwQBY0UI0XZcEMaFKaA=
google.golang.org/genproto/googleapis/bytestream v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:ylj+BE99M198VPbBh6A8d9n3w8fChvyLK3wwBOjXBFA=
google.golang.org/genproto/googleapis/bytestream v0.0.0-20230711160842-782d3b101e98/go.mod h1:3QoBVwTHkXbY1oRGzlhwhOykfcATQN43LJ6iT8Wy8kE=
google.golang.org/genproto/googleapis/bytestream v0.0.0-20230807174057-1744710a1577/go.mod h1:NjCQG/D8JandXxM57PZbAJL1DCNL6EypA0vPPwfsc7c=
@@ -2881,8 +2886,8 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20230706204954-ccb25ca9f130/go.
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230731190214-cbb8c96f2d6d/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230807174057-1744710a1577/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 h1:6G8oQ016D88m1xAKljMlBOOGWDZkes4kMhgGFlf8WcQ=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917/go.mod h1:xtjpI3tXFPP051KaWnhvxkiubL/6dJ18vLVf7q2pTOU=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe h1:bQnxqljG/wqi4NTXu2+DJ3n7APcEA882QZ1JvhQAq9o=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe/go.mod h1:PAREbraiVEVGVdTZsVWjSbbTtSyGbAgIIvni8a8CD5s=
google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
@@ -2930,8 +2935,8 @@ google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGO
google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s=
google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s=
google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo=
google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU=
google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM=
google.golang.org/grpc v1.61.0 h1:TOvOcuXn30kRao+gfcvsebNEa5iZIiLkisYEkf7R7o0=
google.golang.org/grpc v1.61.0/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
google.golang.org/grpc/examples v0.0.0-20211102180624-670c133e568e h1:m7aQHHqd0q89mRwhwS9Bx2rjyl/hsFAeta+uGrHsQaU=
google.golang.org/grpc/examples v0.0.0-20211102180624-670c133e568e/go.mod h1:gID3PKrg7pWKntu9Ss6zTLJ0ttC0X9IHgREOCZwbCVU=
+9
View File
@@ -0,0 +1,9 @@
with-expecter: true
filename: "{{.InterfaceName | snakecase }}.go"
dir: "{{.PackageName}}/mocks"
mockname: "{{.InterfaceName}}"
outpkg: "mocks"
packages:
github.com/owncloud/ocis/v2/ocis-pkg/oidc:
interfaces:
OIDCClient:
+2 -1
View File
@@ -26,7 +26,8 @@ docs-generate:
include ../.make/generate.mk
.PHONY: ci-go-generate
ci-go-generate: # CI runs ci-node-generate automatically before this target
ci-go-generate: $(MOCKERY) # CI runs ci-node-generate automatically before this target
$(MOCKERY)
.PHONY: ci-node-generate
ci-node-generate:
-2
View File
@@ -7,8 +7,6 @@ import (
)
// GoCloak represents the parts of gocloak.GoCloak that we use, mainly here for mockery.
//
//go:generate mockery --name=GoCloak
type GoCloak interface {
CreateUser(ctx context.Context, token, realm string, user gocloak.User) (string, error)
GetUsers(ctx context.Context, token, realm string, params gocloak.GetUsersParams) ([]*gocloak.User, error)
-58
View File
@@ -1,58 +0,0 @@
// Code generated by mockery v0.0.0-dev. DO NOT EDIT.
package mocks
import (
context "context"
mock "github.com/stretchr/testify/mock"
oauth2 "golang.org/x/oauth2"
oidc "github.com/coreos/go-oidc"
)
// OIDCProvider is an autogenerated mock type for the OIDCProvider type
type OIDCProvider struct {
mock.Mock
}
// UserInfo provides a mock function with given fields: ctx, ts
func (_m *OIDCProvider) UserInfo(ctx context.Context, ts oauth2.TokenSource) (*oidc.UserInfo, error) {
ret := _m.Called(ctx, ts)
var r0 *oidc.UserInfo
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, oauth2.TokenSource) (*oidc.UserInfo, error)); ok {
return rf(ctx, ts)
}
if rf, ok := ret.Get(0).(func(context.Context, oauth2.TokenSource) *oidc.UserInfo); ok {
r0 = rf(ctx, ts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*oidc.UserInfo)
}
}
if rf, ok := ret.Get(1).(func(context.Context, oauth2.TokenSource) error); ok {
r1 = rf(ctx, ts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
type mockConstructorTestingTNewOIDCProvider interface {
mock.TestingT
Cleanup(func())
}
// NewOIDCProvider creates a new instance of OIDCProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewOIDCProvider(t mockConstructorTestingTNewOIDCProvider) *OIDCProvider {
mock := &OIDCProvider{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
+225
View File
@@ -0,0 +1,225 @@
// Code generated by mockery v2.40.1. DO NOT EDIT.
package mocks
import (
context "context"
jwt "github.com/golang-jwt/jwt/v4"
mock "github.com/stretchr/testify/mock"
oauth2 "golang.org/x/oauth2"
oidc "github.com/owncloud/ocis/v2/ocis-pkg/oidc"
)
// OIDCClient is an autogenerated mock type for the OIDCClient type
type OIDCClient struct {
mock.Mock
}
type OIDCClient_Expecter struct {
mock *mock.Mock
}
func (_m *OIDCClient) EXPECT() *OIDCClient_Expecter {
return &OIDCClient_Expecter{mock: &_m.Mock}
}
// UserInfo provides a mock function with given fields: ctx, ts
func (_m *OIDCClient) UserInfo(ctx context.Context, ts oauth2.TokenSource) (*oidc.UserInfo, error) {
ret := _m.Called(ctx, ts)
if len(ret) == 0 {
panic("no return value specified for UserInfo")
}
var r0 *oidc.UserInfo
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, oauth2.TokenSource) (*oidc.UserInfo, error)); ok {
return rf(ctx, ts)
}
if rf, ok := ret.Get(0).(func(context.Context, oauth2.TokenSource) *oidc.UserInfo); ok {
r0 = rf(ctx, ts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*oidc.UserInfo)
}
}
if rf, ok := ret.Get(1).(func(context.Context, oauth2.TokenSource) error); ok {
r1 = rf(ctx, ts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// OIDCClient_UserInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UserInfo'
type OIDCClient_UserInfo_Call struct {
*mock.Call
}
// UserInfo is a helper method to define mock.On call
// - ctx context.Context
// - ts oauth2.TokenSource
func (_e *OIDCClient_Expecter) UserInfo(ctx interface{}, ts interface{}) *OIDCClient_UserInfo_Call {
return &OIDCClient_UserInfo_Call{Call: _e.mock.On("UserInfo", ctx, ts)}
}
func (_c *OIDCClient_UserInfo_Call) Run(run func(ctx context.Context, ts oauth2.TokenSource)) *OIDCClient_UserInfo_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(oauth2.TokenSource))
})
return _c
}
func (_c *OIDCClient_UserInfo_Call) Return(_a0 *oidc.UserInfo, _a1 error) *OIDCClient_UserInfo_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *OIDCClient_UserInfo_Call) RunAndReturn(run func(context.Context, oauth2.TokenSource) (*oidc.UserInfo, error)) *OIDCClient_UserInfo_Call {
_c.Call.Return(run)
return _c
}
// VerifyAccessToken provides a mock function with given fields: ctx, token
func (_m *OIDCClient) VerifyAccessToken(ctx context.Context, token string) (oidc.RegClaimsWithSID, jwt.MapClaims, error) {
ret := _m.Called(ctx, token)
if len(ret) == 0 {
panic("no return value specified for VerifyAccessToken")
}
var r0 oidc.RegClaimsWithSID
var r1 jwt.MapClaims
var r2 error
if rf, ok := ret.Get(0).(func(context.Context, string) (oidc.RegClaimsWithSID, jwt.MapClaims, error)); ok {
return rf(ctx, token)
}
if rf, ok := ret.Get(0).(func(context.Context, string) oidc.RegClaimsWithSID); ok {
r0 = rf(ctx, token)
} else {
r0 = ret.Get(0).(oidc.RegClaimsWithSID)
}
if rf, ok := ret.Get(1).(func(context.Context, string) jwt.MapClaims); ok {
r1 = rf(ctx, token)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(jwt.MapClaims)
}
}
if rf, ok := ret.Get(2).(func(context.Context, string) error); ok {
r2 = rf(ctx, token)
} else {
r2 = ret.Error(2)
}
return r0, r1, r2
}
// OIDCClient_VerifyAccessToken_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'VerifyAccessToken'
type OIDCClient_VerifyAccessToken_Call struct {
*mock.Call
}
// VerifyAccessToken is a helper method to define mock.On call
// - ctx context.Context
// - token string
func (_e *OIDCClient_Expecter) VerifyAccessToken(ctx interface{}, token interface{}) *OIDCClient_VerifyAccessToken_Call {
return &OIDCClient_VerifyAccessToken_Call{Call: _e.mock.On("VerifyAccessToken", ctx, token)}
}
func (_c *OIDCClient_VerifyAccessToken_Call) Run(run func(ctx context.Context, token string)) *OIDCClient_VerifyAccessToken_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string))
})
return _c
}
func (_c *OIDCClient_VerifyAccessToken_Call) Return(_a0 oidc.RegClaimsWithSID, _a1 jwt.MapClaims, _a2 error) *OIDCClient_VerifyAccessToken_Call {
_c.Call.Return(_a0, _a1, _a2)
return _c
}
func (_c *OIDCClient_VerifyAccessToken_Call) RunAndReturn(run func(context.Context, string) (oidc.RegClaimsWithSID, jwt.MapClaims, error)) *OIDCClient_VerifyAccessToken_Call {
_c.Call.Return(run)
return _c
}
// VerifyLogoutToken provides a mock function with given fields: ctx, token
func (_m *OIDCClient) VerifyLogoutToken(ctx context.Context, token string) (*oidc.LogoutToken, error) {
ret := _m.Called(ctx, token)
if len(ret) == 0 {
panic("no return value specified for VerifyLogoutToken")
}
var r0 *oidc.LogoutToken
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string) (*oidc.LogoutToken, error)); ok {
return rf(ctx, token)
}
if rf, ok := ret.Get(0).(func(context.Context, string) *oidc.LogoutToken); ok {
r0 = rf(ctx, token)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*oidc.LogoutToken)
}
}
if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
r1 = rf(ctx, token)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// OIDCClient_VerifyLogoutToken_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'VerifyLogoutToken'
type OIDCClient_VerifyLogoutToken_Call struct {
*mock.Call
}
// VerifyLogoutToken is a helper method to define mock.On call
// - ctx context.Context
// - token string
func (_e *OIDCClient_Expecter) VerifyLogoutToken(ctx interface{}, token interface{}) *OIDCClient_VerifyLogoutToken_Call {
return &OIDCClient_VerifyLogoutToken_Call{Call: _e.mock.On("VerifyLogoutToken", ctx, token)}
}
func (_c *OIDCClient_VerifyLogoutToken_Call) Run(run func(ctx context.Context, token string)) *OIDCClient_VerifyLogoutToken_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string))
})
return _c
}
func (_c *OIDCClient_VerifyLogoutToken_Call) Return(_a0 *oidc.LogoutToken, _a1 error) *OIDCClient_VerifyLogoutToken_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *OIDCClient_VerifyLogoutToken_Call) RunAndReturn(run func(context.Context, string) (*oidc.LogoutToken, error)) *OIDCClient_VerifyLogoutToken_Call {
_c.Call.Return(run)
return _c
}
// NewOIDCClient creates a new instance of OIDCClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewOIDCClient(t interface {
mock.TestingT
Cleanup(func())
}) *OIDCClient {
mock := &OIDCClient{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
+6
View File
@@ -31,6 +31,12 @@ dev-docker:
$(MAKE) --no-print-directory release-linux-docker-$(GOARCH)
docker build -f docker/Dockerfile.linux.$(GOARCH) -t owncloud/ocis:dev .
############ debug-docker ############
.PHONY: debug-docker
debug-docker:
$(MAKE) --no-print-directory debug-linux-docker-$(GOARCH)
docker build -f docker/Dockerfile.linux.debug.$(GOARCH) -t owncloud/ocis:debug .
############ generate ############
include ../.make/generate.mk
+41
View File
@@ -0,0 +1,41 @@
FROM amd64/alpine:3.19
ARG VERSION=""
ARG REVISION=""
RUN apk add --no-cache ca-certificates mailcap tree attr curl libc6-compat delve && \
echo 'hosts: files dns' >| /etc/nsswitch.conf
LABEL maintainer="ownCloud GmbH <devops@owncloud.com>" \
org.opencontainers.image.title="ownCloud Infinite Scale" \
org.opencontainers.image.vendor="ownCloud GmbH" \
org.opencontainers.image.authors="ownCloud GmbH" \
org.opencontainers.image.description="oCIS - ownCloud Infinite Scale is a modern file-sync and share platform" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.documentation="https://github.com/owncloud/ocis" \
org.opencontainers.image.url="https://hub.docker.com/r/owncloud/ocis" \
org.opencontainers.image.source="https://github.com/owncloud/ocis" \
org.opencontainers.image.version="${VERSION}" \
org.opencontainers.image.revision="${REVISION}"
RUN addgroup -g 1000 -S ocis-group && \
adduser -S --ingroup ocis-group --uid 1000 ocis-user --home /var/lib/ocis
RUN mkdir -p /var/lib/ocis && \
chown -R ocis-user:ocis-group /var/lib/ocis && \
chmod -R 751 /var/lib/ocis && \
mkdir -p /etc/ocis && \
chown -R ocis-user:ocis-group /etc/ocis && \
chmod -R 751 /etc/ocis
VOLUME [ "/var/lib/ocis", "/etc/ocis" ]
WORKDIR /var/lib/ocis
USER 1000
EXPOSE 9200/tcp
ENTRYPOINT ["/usr/bin/ocis"]
CMD ["server"]
COPY dist/binaries/ocis-linux-amd64 /usr/bin/ocis
+25
View File
@@ -0,0 +1,25 @@
with-expecter: true
filename: "{{.InterfaceName | snakecase }}.go"
dir: "{{.InterfaceDir}}/mocks"
mockname: "{{.InterfaceName}}"
outpkg: "mocks"
packages:
github.com/owncloud/ocis/v2/protogen/gen/ocis/services/eventhistory/v0:
interfaces:
EventHistoryService:
github.com/owncloud/ocis/v2/protogen/gen/ocis/services/policies/v0:
interfaces:
PoliciesProviderService:
github.com/owncloud/ocis/v2/protogen/gen/ocis/services/search/v0:
interfaces:
SearchProviderService:
github.com/owncloud/ocis/v2/protogen/gen/ocis/services/settings/v0:
interfaces:
ValueService:
github.com/owncloud/ocis/v2/protogen/gen/ocis/services/store/v0:
interfaces:
StoreService:
github.com/owncloud/ocis/v2/protogen/gen/ocis/services/thumbnails/v0:
interfaces:
ThumbnailService:
+13
View File
@@ -0,0 +1,13 @@
include ../.make/recursion.mk
############ tooling ############
ifneq (, $(shell command -v go 2> /dev/null)) # suppress `command not found warnings` for non go targets in CI
include ../.bingo/Variables.mk
endif
############ generate ############
include ../.make/generate.mk
.PHONY: ci-go-generate
ci-go-generate: $(MOCKERY) # CI runs ci-node-generate automatically before this target
$(MOCKERY)
@@ -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
}
@@ -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
}
@@ -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
}
@@ -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
}
@@ -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
}
@@ -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
}
+1 -2
View File
@@ -24,8 +24,7 @@ docs-generate: config-docs-generate
include ../../.make/generate.mk
.PHONY: ci-go-generate
ci-go-generate: $(MOCKERY) # CI runs ci-node-generate automatically before this target
$(MOCKERY) --dir ../../protogen/gen/ocis/services/eventhistory/v0 --case underscore --name EventHistoryService
ci-go-generate: # CI runs ci-node-generate automatically before this target
.PHONY: ci-node-generate
ci-node-generate:
@@ -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
}
-2
View File
@@ -27,8 +27,6 @@ type Config struct {
SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token" env:"FRONTEND_SKIP_USER_GROUPS_IN_TOKEN" desc:"Disables the loading of user's group memberships from the reva access token."`
EnableFavorites bool `yaml:"enable_favorites" env:"FRONTEND_ENABLE_FAVORITES" desc:"Enables the support for favorites in the clients."`
EnableProjectSpaces bool `yaml:"enable_project_spaces" env:"FRONTEND_ENABLE_PROJECT_SPACES" desc:"Changing this value is NOT supported. Indicates to clients that project spaces are supposed to be made available."`
EnableShareJail bool `yaml:"enable_share_jail" env:"FRONTEND_ENABLE_SHARE_JAIL" desc:"Changing this value is NOT supported. Indicates to clients that the share jail is supposed to be used."`
MaxQuota uint64 `yaml:"max_quota" env:"OCIS_SPACES_MAX_QUOTA;FRONTEND_MAX_QUOTA" desc:"Set the global max quota value in bytes. A value of 0 equals unlimited. The value is provided via capabilities."`
UploadMaxChunkSize int `yaml:"upload_max_chunk_size" env:"FRONTEND_UPLOAD_MAX_CHUNK_SIZE" desc:"Sets the max chunk sizes in bytes for uploads via the clients."`
UploadHTTPMethodOverride string `yaml:"upload_http_method_override" env:"FRONTEND_UPLOAD_HTTP_METHOD_OVERRIDE" desc:"Advise TUS to replace PATCH requests by POST requests."`
@@ -81,8 +81,6 @@ func DefaultConfig() *config.Config {
Reva: shared.DefaultRevaConfig(),
PublicURL: "https://localhost:9200",
EnableFavorites: false,
EnableProjectSpaces: true,
EnableShareJail: true,
UploadMaxChunkSize: 1e+7,
UploadHTTPMethodOverride: "",
DefaultUploadProtocol: "tus",
+3 -3
View File
@@ -286,9 +286,9 @@ func FrontendConfigFromStruct(cfg *config.Config, logger log.Logger) (map[string
},
"spaces": map[string]interface{}{
"version": "1.0.0",
"enabled": cfg.EnableProjectSpaces || cfg.EnableShareJail,
"projects": cfg.EnableProjectSpaces,
"share_jail": cfg.EnableShareJail,
"enabled": true,
"projects": true,
"share_jail": true,
"max_quota": cfg.MaxQuota,
},
"search": map[string]interface{}{
+26
View File
@@ -0,0 +1,26 @@
with-expecter: true
filename: "{{.InterfaceName | snakecase }}.go"
mockname: "{{.InterfaceName}}"
outpkg: "mocks"
packages:
github.com/owncloud/ocis/v2/services/graph/pkg/service/v0:
config:
dir: "mocks"
interfaces:
HTTPClient:
Permissions:
Publisher:
RoleService:
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"
+1 -8
View File
@@ -25,14 +25,7 @@ include ../../.make/generate.mk
.PHONY: ci-go-generate
ci-go-generate: $(MOCKERY) # CI runs ci-node-generate automatically before this target
$(MOCKERY) --dir pkg/service/v0 --case underscore --name HTTPClient
$(MOCKERY) --dir pkg/service/v0 --case underscore --name Publisher
$(MOCKERY) --dir pkg/service/v0 --case underscore --name Permissions
$(MOCKERY) --dir pkg/service/v0 --case underscore --name RoleService
$(MOCKERY) --dir pkg/identity --output pkg/identity/mocks --case underscore --name Backend
$(MOCKERY) --dir pkg/identity --output pkg/identity/mocks --case underscore --name EducationBackend
$(MOCKERY) --srcpkg github.com/go-ldap/ldap/v3 --case underscore --filename ldapclient.go --name Client
$(MOCKERY)
.PHONY: ci-node-generate
ci-node-generate:
-456
View File
@@ -1,456 +0,0 @@
// Code generated by mockery v2.22.1. DO NOT EDIT.
package mocks
import (
context "context"
gatewayv1beta1 "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1"
grpc "google.golang.org/grpc"
mock "github.com/stretchr/testify/mock"
providerv1beta1 "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
)
// GatewayClient is an autogenerated mock type for the GatewayClient type
type GatewayClient struct {
mock.Mock
}
// Authenticate provides a mock function with given fields: ctx, in, opts
func (_m *GatewayClient) Authenticate(ctx context.Context, in *gatewayv1beta1.AuthenticateRequest, opts ...grpc.CallOption) (*gatewayv1beta1.AuthenticateResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *gatewayv1beta1.AuthenticateResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *gatewayv1beta1.AuthenticateRequest, ...grpc.CallOption) (*gatewayv1beta1.AuthenticateResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *gatewayv1beta1.AuthenticateRequest, ...grpc.CallOption) *gatewayv1beta1.AuthenticateResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*gatewayv1beta1.AuthenticateResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *gatewayv1beta1.AuthenticateRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// CreateStorageSpace provides a mock function with given fields: ctx, in, opts
func (_m *GatewayClient) CreateStorageSpace(ctx context.Context, in *providerv1beta1.CreateStorageSpaceRequest, opts ...grpc.CallOption) (*providerv1beta1.CreateStorageSpaceResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *providerv1beta1.CreateStorageSpaceResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.CreateStorageSpaceRequest, ...grpc.CallOption) (*providerv1beta1.CreateStorageSpaceResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.CreateStorageSpaceRequest, ...grpc.CallOption) *providerv1beta1.CreateStorageSpaceResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*providerv1beta1.CreateStorageSpaceResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *providerv1beta1.CreateStorageSpaceRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// DeleteStorageSpace provides a mock function with given fields: ctx, in, opts
func (_m *GatewayClient) DeleteStorageSpace(ctx context.Context, in *providerv1beta1.DeleteStorageSpaceRequest, opts ...grpc.CallOption) (*providerv1beta1.DeleteStorageSpaceResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *providerv1beta1.DeleteStorageSpaceResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.DeleteStorageSpaceRequest, ...grpc.CallOption) (*providerv1beta1.DeleteStorageSpaceResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.DeleteStorageSpaceRequest, ...grpc.CallOption) *providerv1beta1.DeleteStorageSpaceResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*providerv1beta1.DeleteStorageSpaceResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *providerv1beta1.DeleteStorageSpaceRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetHome provides a mock function with given fields: ctx, in, opts
func (_m *GatewayClient) GetHome(ctx context.Context, in *providerv1beta1.GetHomeRequest, opts ...grpc.CallOption) (*providerv1beta1.GetHomeResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *providerv1beta1.GetHomeResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.GetHomeRequest, ...grpc.CallOption) (*providerv1beta1.GetHomeResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.GetHomeRequest, ...grpc.CallOption) *providerv1beta1.GetHomeResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*providerv1beta1.GetHomeResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *providerv1beta1.GetHomeRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetPath provides a mock function with given fields: ctx, in, opts
func (_m *GatewayClient) GetPath(ctx context.Context, in *providerv1beta1.GetPathRequest, opts ...grpc.CallOption) (*providerv1beta1.GetPathResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *providerv1beta1.GetPathResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.GetPathRequest, ...grpc.CallOption) (*providerv1beta1.GetPathResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.GetPathRequest, ...grpc.CallOption) *providerv1beta1.GetPathResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*providerv1beta1.GetPathResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *providerv1beta1.GetPathRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetQuota provides a mock function with given fields: ctx, in, opts
func (_m *GatewayClient) GetQuota(ctx context.Context, in *gatewayv1beta1.GetQuotaRequest, opts ...grpc.CallOption) (*providerv1beta1.GetQuotaResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *providerv1beta1.GetQuotaResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *gatewayv1beta1.GetQuotaRequest, ...grpc.CallOption) (*providerv1beta1.GetQuotaResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *gatewayv1beta1.GetQuotaRequest, ...grpc.CallOption) *providerv1beta1.GetQuotaResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*providerv1beta1.GetQuotaResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *gatewayv1beta1.GetQuotaRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// InitiateFileDownload provides a mock function with given fields: ctx, in, opts
func (_m *GatewayClient) InitiateFileDownload(ctx context.Context, in *providerv1beta1.InitiateFileDownloadRequest, opts ...grpc.CallOption) (*gatewayv1beta1.InitiateFileDownloadResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *gatewayv1beta1.InitiateFileDownloadResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.InitiateFileDownloadRequest, ...grpc.CallOption) (*gatewayv1beta1.InitiateFileDownloadResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.InitiateFileDownloadRequest, ...grpc.CallOption) *gatewayv1beta1.InitiateFileDownloadResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*gatewayv1beta1.InitiateFileDownloadResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *providerv1beta1.InitiateFileDownloadRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ListContainer provides a mock function with given fields: ctx, in, opts
func (_m *GatewayClient) ListContainer(ctx context.Context, in *providerv1beta1.ListContainerRequest, opts ...grpc.CallOption) (*providerv1beta1.ListContainerResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *providerv1beta1.ListContainerResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.ListContainerRequest, ...grpc.CallOption) (*providerv1beta1.ListContainerResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.ListContainerRequest, ...grpc.CallOption) *providerv1beta1.ListContainerResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*providerv1beta1.ListContainerResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *providerv1beta1.ListContainerRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ListStorageSpaces provides a mock function with given fields: ctx, in, opts
func (_m *GatewayClient) ListStorageSpaces(ctx context.Context, in *providerv1beta1.ListStorageSpacesRequest, opts ...grpc.CallOption) (*providerv1beta1.ListStorageSpacesResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *providerv1beta1.ListStorageSpacesResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.ListStorageSpacesRequest, ...grpc.CallOption) (*providerv1beta1.ListStorageSpacesResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.ListStorageSpacesRequest, ...grpc.CallOption) *providerv1beta1.ListStorageSpacesResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*providerv1beta1.ListStorageSpacesResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *providerv1beta1.ListStorageSpacesRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SetArbitraryMetadata provides a mock function with given fields: ctx, request, opts
func (_m *GatewayClient) SetArbitraryMetadata(ctx context.Context, request *providerv1beta1.SetArbitraryMetadataRequest, opts ...grpc.CallOption) (*providerv1beta1.SetArbitraryMetadataResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, request)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *providerv1beta1.SetArbitraryMetadataResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.SetArbitraryMetadataRequest, ...grpc.CallOption) (*providerv1beta1.SetArbitraryMetadataResponse, error)); ok {
return rf(ctx, request, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.SetArbitraryMetadataRequest, ...grpc.CallOption) *providerv1beta1.SetArbitraryMetadataResponse); ok {
r0 = rf(ctx, request, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*providerv1beta1.SetArbitraryMetadataResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *providerv1beta1.SetArbitraryMetadataRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, request, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Stat provides a mock function with given fields: ctx, in, opts
func (_m *GatewayClient) Stat(ctx context.Context, in *providerv1beta1.StatRequest, opts ...grpc.CallOption) (*providerv1beta1.StatResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *providerv1beta1.StatResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.StatRequest, ...grpc.CallOption) (*providerv1beta1.StatResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.StatRequest, ...grpc.CallOption) *providerv1beta1.StatResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*providerv1beta1.StatResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *providerv1beta1.StatRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// TouchFile provides a mock function with given fields: ctx, req
func (_m *GatewayClient) TouchFile(ctx context.Context, req *providerv1beta1.TouchFileRequest) (*providerv1beta1.TouchFileResponse, error) {
ret := _m.Called(ctx, req)
var r0 *providerv1beta1.TouchFileResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.TouchFileRequest) (*providerv1beta1.TouchFileResponse, error)); ok {
return rf(ctx, req)
}
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.TouchFileRequest) *providerv1beta1.TouchFileResponse); ok {
r0 = rf(ctx, req)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*providerv1beta1.TouchFileResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *providerv1beta1.TouchFileRequest) error); ok {
r1 = rf(ctx, req)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// UpdateStorageSpace provides a mock function with given fields: ctx, in, opts
func (_m *GatewayClient) UpdateStorageSpace(ctx context.Context, in *providerv1beta1.UpdateStorageSpaceRequest, opts ...grpc.CallOption) (*providerv1beta1.UpdateStorageSpaceResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 *providerv1beta1.UpdateStorageSpaceResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.UpdateStorageSpaceRequest, ...grpc.CallOption) (*providerv1beta1.UpdateStorageSpaceResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.UpdateStorageSpaceRequest, ...grpc.CallOption) *providerv1beta1.UpdateStorageSpaceResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*providerv1beta1.UpdateStorageSpaceResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *providerv1beta1.UpdateStorageSpaceRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
type mockConstructorTestingTNewGatewayClient interface {
mock.TestingT
Cleanup(func())
}
// NewGatewayClient creates a new instance of GatewayClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewGatewayClient(t mockConstructorTestingTNewGatewayClient) *GatewayClient {
mock := &GatewayClient{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
+44 -5
View File
@@ -1,4 +1,4 @@
// Code generated by mockery v2.22.1. DO NOT EDIT.
// Code generated by mockery v2.40.1. DO NOT EDIT.
package mocks
@@ -13,10 +13,22 @@ type HTTPClient struct {
mock.Mock
}
type HTTPClient_Expecter struct {
mock *mock.Mock
}
func (_m *HTTPClient) EXPECT() *HTTPClient_Expecter {
return &HTTPClient_Expecter{mock: &_m.Mock}
}
// Do provides a mock function with given fields: req
func (_m *HTTPClient) Do(req *http.Request) (*http.Response, error) {
ret := _m.Called(req)
if len(ret) == 0 {
panic("no return value specified for Do")
}
var r0 *http.Response
var r1 error
if rf, ok := ret.Get(0).(func(*http.Request) (*http.Response, error)); ok {
@@ -39,13 +51,40 @@ func (_m *HTTPClient) Do(req *http.Request) (*http.Response, error) {
return r0, r1
}
type mockConstructorTestingTNewHTTPClient interface {
mock.TestingT
Cleanup(func())
// HTTPClient_Do_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Do'
type HTTPClient_Do_Call struct {
*mock.Call
}
// Do is a helper method to define mock.On call
// - req *http.Request
func (_e *HTTPClient_Expecter) Do(req interface{}) *HTTPClient_Do_Call {
return &HTTPClient_Do_Call{Call: _e.mock.On("Do", req)}
}
func (_c *HTTPClient_Do_Call) Run(run func(req *http.Request)) *HTTPClient_Do_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*http.Request))
})
return _c
}
func (_c *HTTPClient_Do_Call) Return(_a0 *http.Response, _a1 error) *HTTPClient_Do_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *HTTPClient_Do_Call) RunAndReturn(run func(*http.Request) (*http.Response, error)) *HTTPClient_Do_Call {
_c.Call.Return(run)
return _c
}
// NewHTTPClient creates a new instance of HTTPClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewHTTPClient(t mockConstructorTestingTNewHTTPClient) *HTTPClient {
// The first argument is typically a *testing.T value.
func NewHTTPClient(t interface {
mock.TestingT
Cleanup(func())
}) *HTTPClient {
mock := &HTTPClient{}
mock.Mock.Test(t)
-478
View File
@@ -1,478 +0,0 @@
// Code generated by mockery v2.22.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
}
// Add provides a mock function with given fields: _a0
func (_m *Client) Add(_a0 *ldap.AddRequest) error {
ret := _m.Called(_a0)
var r0 error
if rf, ok := ret.Get(0).(func(*ldap.AddRequest) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// Bind provides a mock function with given fields: username, password
func (_m *Client) Bind(username string, password string) error {
ret := _m.Called(username, password)
var r0 error
if rf, ok := ret.Get(0).(func(string, string) error); ok {
r0 = rf(username, password)
} else {
r0 = ret.Error(0)
}
return r0
}
// Close provides a mock function with given fields:
func (_m *Client) Close() error {
ret := _m.Called()
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// Compare provides a mock function with given fields: dn, attribute, value
func (_m *Client) Compare(dn string, attribute string, value string) (bool, error) {
ret := _m.Called(dn, attribute, value)
var r0 bool
var r1 error
if rf, ok := ret.Get(0).(func(string, string, string) (bool, error)); ok {
return rf(dn, attribute, value)
}
if rf, ok := ret.Get(0).(func(string, string, string) bool); ok {
r0 = rf(dn, attribute, value)
} else {
r0 = ret.Get(0).(bool)
}
if rf, ok := ret.Get(1).(func(string, string, string) error); ok {
r1 = rf(dn, attribute, value)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Del provides a mock function with given fields: _a0
func (_m *Client) Del(_a0 *ldap.DelRequest) error {
ret := _m.Called(_a0)
var r0 error
if rf, ok := ret.Get(0).(func(*ldap.DelRequest) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// DirSync provides a mock function with given fields: searchRequest, flags, maxAttrCount, cookie
func (_m *Client) DirSync(searchRequest *ldap.SearchRequest, flags int64, maxAttrCount int64, cookie []byte) (*ldap.SearchResult, error) {
ret := _m.Called(searchRequest, flags, maxAttrCount, cookie)
var r0 *ldap.SearchResult
var r1 error
if rf, ok := ret.Get(0).(func(*ldap.SearchRequest, int64, int64, []byte) (*ldap.SearchResult, error)); ok {
return rf(searchRequest, flags, maxAttrCount, cookie)
}
if rf, ok := ret.Get(0).(func(*ldap.SearchRequest, int64, int64, []byte) *ldap.SearchResult); ok {
r0 = rf(searchRequest, flags, maxAttrCount, cookie)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*ldap.SearchResult)
}
}
if rf, ok := ret.Get(1).(func(*ldap.SearchRequest, int64, int64, []byte) error); ok {
r1 = rf(searchRequest, flags, maxAttrCount, cookie)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// 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)
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
}
// ExternalBind provides a mock function with given fields:
func (_m *Client) ExternalBind() error {
ret := _m.Called()
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// GetLastError provides a mock function with given fields:
func (_m *Client) GetLastError() error {
ret := _m.Called()
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// IsClosing provides a mock function with given fields:
func (_m *Client) IsClosing() bool {
ret := _m.Called()
var r0 bool
if rf, ok := ret.Get(0).(func() bool); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// Modify provides a mock function with given fields: _a0
func (_m *Client) Modify(_a0 *ldap.ModifyRequest) error {
ret := _m.Called(_a0)
var r0 error
if rf, ok := ret.Get(0).(func(*ldap.ModifyRequest) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// ModifyDN provides a mock function with given fields: _a0
func (_m *Client) ModifyDN(_a0 *ldap.ModifyDNRequest) error {
ret := _m.Called(_a0)
var r0 error
if rf, ok := ret.Get(0).(func(*ldap.ModifyDNRequest) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// ModifyWithResult provides a mock function with given fields: _a0
func (_m *Client) ModifyWithResult(_a0 *ldap.ModifyRequest) (*ldap.ModifyResult, error) {
ret := _m.Called(_a0)
var r0 *ldap.ModifyResult
var r1 error
if rf, ok := ret.Get(0).(func(*ldap.ModifyRequest) (*ldap.ModifyResult, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(*ldap.ModifyRequest) *ldap.ModifyResult); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*ldap.ModifyResult)
}
}
if rf, ok := ret.Get(1).(func(*ldap.ModifyRequest) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NTLMUnauthenticatedBind provides a mock function with given fields: domain, username
func (_m *Client) NTLMUnauthenticatedBind(domain string, username string) error {
ret := _m.Called(domain, username)
var r0 error
if rf, ok := ret.Get(0).(func(string, string) error); ok {
r0 = rf(domain, username)
} else {
r0 = ret.Error(0)
}
return r0
}
// PasswordModify provides a mock function with given fields: _a0
func (_m *Client) PasswordModify(_a0 *ldap.PasswordModifyRequest) (*ldap.PasswordModifyResult, error) {
ret := _m.Called(_a0)
var r0 *ldap.PasswordModifyResult
var r1 error
if rf, ok := ret.Get(0).(func(*ldap.PasswordModifyRequest) (*ldap.PasswordModifyResult, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(*ldap.PasswordModifyRequest) *ldap.PasswordModifyResult); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*ldap.PasswordModifyResult)
}
}
if rf, ok := ret.Get(1).(func(*ldap.PasswordModifyRequest) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Search provides a mock function with given fields: _a0
func (_m *Client) Search(_a0 *ldap.SearchRequest) (*ldap.SearchResult, error) {
ret := _m.Called(_a0)
var r0 *ldap.SearchResult
var r1 error
if rf, ok := ret.Get(0).(func(*ldap.SearchRequest) (*ldap.SearchResult, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(*ldap.SearchRequest) *ldap.SearchResult); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*ldap.SearchResult)
}
}
if rf, ok := ret.Get(1).(func(*ldap.SearchRequest) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// 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)
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
}
// SearchWithPaging provides a mock function with given fields: searchRequest, pagingSize
func (_m *Client) SearchWithPaging(searchRequest *ldap.SearchRequest, pagingSize uint32) (*ldap.SearchResult, error) {
ret := _m.Called(searchRequest, pagingSize)
var r0 *ldap.SearchResult
var r1 error
if rf, ok := ret.Get(0).(func(*ldap.SearchRequest, uint32) (*ldap.SearchResult, error)); ok {
return rf(searchRequest, pagingSize)
}
if rf, ok := ret.Get(0).(func(*ldap.SearchRequest, uint32) *ldap.SearchResult); ok {
r0 = rf(searchRequest, pagingSize)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*ldap.SearchResult)
}
}
if rf, ok := ret.Get(1).(func(*ldap.SearchRequest, uint32) error); ok {
r1 = rf(searchRequest, pagingSize)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SetTimeout provides a mock function with given fields: _a0
func (_m *Client) SetTimeout(_a0 time.Duration) {
_m.Called(_a0)
}
// SimpleBind provides a mock function with given fields: _a0
func (_m *Client) SimpleBind(_a0 *ldap.SimpleBindRequest) (*ldap.SimpleBindResult, error) {
ret := _m.Called(_a0)
var r0 *ldap.SimpleBindResult
var r1 error
if rf, ok := ret.Get(0).(func(*ldap.SimpleBindRequest) (*ldap.SimpleBindResult, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(*ldap.SimpleBindRequest) *ldap.SimpleBindResult); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*ldap.SimpleBindResult)
}
}
if rf, ok := ret.Get(1).(func(*ldap.SimpleBindRequest) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Start provides a mock function with given fields:
func (_m *Client) Start() {
_m.Called()
}
// StartTLS provides a mock function with given fields: _a0
func (_m *Client) StartTLS(_a0 *tls.Config) error {
ret := _m.Called(_a0)
var r0 error
if rf, ok := ret.Get(0).(func(*tls.Config) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// 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)
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
}
// TLSConnectionState provides a mock function with given fields:
func (_m *Client) TLSConnectionState() (tls.ConnectionState, bool) {
ret := _m.Called()
var r0 tls.ConnectionState
var r1 bool
if rf, ok := ret.Get(0).(func() (tls.ConnectionState, bool)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() tls.ConnectionState); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(tls.ConnectionState)
}
if rf, ok := ret.Get(1).(func() bool); ok {
r1 = rf()
} else {
r1 = ret.Get(1).(bool)
}
return r0, r1
}
// UnauthenticatedBind provides a mock function with given fields: username
func (_m *Client) UnauthenticatedBind(username string) error {
ret := _m.Called(username)
var r0 error
if rf, ok := ret.Get(0).(func(string) error); ok {
r0 = rf(username)
} else {
r0 = ret.Error(0)
}
return r0
}
// Unbind provides a mock function with given fields:
func (_m *Client) Unbind() error {
ret := _m.Called()
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
type mockConstructorTestingTNewClient interface {
mock.TestingT
Cleanup(func())
}
// NewClient creates a new instance of Client. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewClient(t mockConstructorTestingTNewClient) *Client {
mock := &Client{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
+135 -5
View File
@@ -1,4 +1,4 @@
// Code generated by mockery v2.22.1. DO NOT EDIT.
// Code generated by mockery v2.40.1. DO NOT EDIT.
package mocks
@@ -17,6 +17,14 @@ type Permissions struct {
mock.Mock
}
type Permissions_Expecter struct {
mock *mock.Mock
}
func (_m *Permissions) EXPECT() *Permissions_Expecter {
return &Permissions_Expecter{mock: &_m.Mock}
}
// GetPermissionByID provides a mock function with given fields: ctx, request, opts
func (_m *Permissions) GetPermissionByID(ctx context.Context, request *v0.GetPermissionByIDRequest, opts ...client.CallOption) (*v0.GetPermissionByIDResponse, error) {
_va := make([]interface{}, len(opts))
@@ -28,6 +36,10 @@ func (_m *Permissions) GetPermissionByID(ctx context.Context, request *v0.GetPer
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for GetPermissionByID")
}
var r0 *v0.GetPermissionByIDResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.GetPermissionByIDRequest, ...client.CallOption) (*v0.GetPermissionByIDResponse, error)); ok {
@@ -50,6 +62,43 @@ func (_m *Permissions) GetPermissionByID(ctx context.Context, request *v0.GetPer
return r0, r1
}
// Permissions_GetPermissionByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPermissionByID'
type Permissions_GetPermissionByID_Call struct {
*mock.Call
}
// GetPermissionByID is a helper method to define mock.On call
// - ctx context.Context
// - request *v0.GetPermissionByIDRequest
// - opts ...client.CallOption
func (_e *Permissions_Expecter) GetPermissionByID(ctx interface{}, request interface{}, opts ...interface{}) *Permissions_GetPermissionByID_Call {
return &Permissions_GetPermissionByID_Call{Call: _e.mock.On("GetPermissionByID",
append([]interface{}{ctx, request}, opts...)...)}
}
func (_c *Permissions_GetPermissionByID_Call) Run(run func(ctx context.Context, request *v0.GetPermissionByIDRequest, opts ...client.CallOption)) *Permissions_GetPermissionByID_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]client.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(client.CallOption)
}
}
run(args[0].(context.Context), args[1].(*v0.GetPermissionByIDRequest), variadicArgs...)
})
return _c
}
func (_c *Permissions_GetPermissionByID_Call) Return(_a0 *v0.GetPermissionByIDResponse, _a1 error) *Permissions_GetPermissionByID_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Permissions_GetPermissionByID_Call) RunAndReturn(run func(context.Context, *v0.GetPermissionByIDRequest, ...client.CallOption) (*v0.GetPermissionByIDResponse, error)) *Permissions_GetPermissionByID_Call {
_c.Call.Return(run)
return _c
}
// ListPermissions provides a mock function with given fields: ctx, req, opts
func (_m *Permissions) ListPermissions(ctx context.Context, req *v0.ListPermissionsRequest, opts ...client.CallOption) (*v0.ListPermissionsResponse, error) {
_va := make([]interface{}, len(opts))
@@ -61,6 +110,10 @@ func (_m *Permissions) ListPermissions(ctx context.Context, req *v0.ListPermissi
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for ListPermissions")
}
var r0 *v0.ListPermissionsResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.ListPermissionsRequest, ...client.CallOption) (*v0.ListPermissionsResponse, error)); ok {
@@ -83,6 +136,43 @@ func (_m *Permissions) ListPermissions(ctx context.Context, req *v0.ListPermissi
return r0, r1
}
// Permissions_ListPermissions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListPermissions'
type Permissions_ListPermissions_Call struct {
*mock.Call
}
// ListPermissions is a helper method to define mock.On call
// - ctx context.Context
// - req *v0.ListPermissionsRequest
// - opts ...client.CallOption
func (_e *Permissions_Expecter) ListPermissions(ctx interface{}, req interface{}, opts ...interface{}) *Permissions_ListPermissions_Call {
return &Permissions_ListPermissions_Call{Call: _e.mock.On("ListPermissions",
append([]interface{}{ctx, req}, opts...)...)}
}
func (_c *Permissions_ListPermissions_Call) Run(run func(ctx context.Context, req *v0.ListPermissionsRequest, opts ...client.CallOption)) *Permissions_ListPermissions_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]client.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(client.CallOption)
}
}
run(args[0].(context.Context), args[1].(*v0.ListPermissionsRequest), variadicArgs...)
})
return _c
}
func (_c *Permissions_ListPermissions_Call) Return(_a0 *v0.ListPermissionsResponse, _a1 error) *Permissions_ListPermissions_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Permissions_ListPermissions_Call) RunAndReturn(run func(context.Context, *v0.ListPermissionsRequest, ...client.CallOption) (*v0.ListPermissionsResponse, error)) *Permissions_ListPermissions_Call {
_c.Call.Return(run)
return _c
}
// ListPermissionsByResource provides a mock function with given fields: ctx, in, opts
func (_m *Permissions) ListPermissionsByResource(ctx context.Context, in *v0.ListPermissionsByResourceRequest, opts ...client.CallOption) (*v0.ListPermissionsByResourceResponse, error) {
_va := make([]interface{}, len(opts))
@@ -94,6 +184,10 @@ func (_m *Permissions) ListPermissionsByResource(ctx context.Context, in *v0.Lis
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for ListPermissionsByResource")
}
var r0 *v0.ListPermissionsByResourceResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.ListPermissionsByResourceRequest, ...client.CallOption) (*v0.ListPermissionsByResourceResponse, error)); ok {
@@ -116,13 +210,49 @@ func (_m *Permissions) ListPermissionsByResource(ctx context.Context, in *v0.Lis
return r0, r1
}
type mockConstructorTestingTNewPermissions interface {
mock.TestingT
Cleanup(func())
// Permissions_ListPermissionsByResource_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListPermissionsByResource'
type Permissions_ListPermissionsByResource_Call struct {
*mock.Call
}
// ListPermissionsByResource is a helper method to define mock.On call
// - ctx context.Context
// - in *v0.ListPermissionsByResourceRequest
// - opts ...client.CallOption
func (_e *Permissions_Expecter) ListPermissionsByResource(ctx interface{}, in interface{}, opts ...interface{}) *Permissions_ListPermissionsByResource_Call {
return &Permissions_ListPermissionsByResource_Call{Call: _e.mock.On("ListPermissionsByResource",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *Permissions_ListPermissionsByResource_Call) Run(run func(ctx context.Context, in *v0.ListPermissionsByResourceRequest, opts ...client.CallOption)) *Permissions_ListPermissionsByResource_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]client.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(client.CallOption)
}
}
run(args[0].(context.Context), args[1].(*v0.ListPermissionsByResourceRequest), variadicArgs...)
})
return _c
}
func (_c *Permissions_ListPermissionsByResource_Call) Return(_a0 *v0.ListPermissionsByResourceResponse, _a1 error) *Permissions_ListPermissionsByResource_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Permissions_ListPermissionsByResource_Call) RunAndReturn(run func(context.Context, *v0.ListPermissionsByResourceRequest, ...client.CallOption) (*v0.ListPermissionsByResourceResponse, error)) *Permissions_ListPermissionsByResource_Call {
_c.Call.Return(run)
return _c
}
// NewPermissions creates a new instance of Permissions. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewPermissions(t mockConstructorTestingTNewPermissions) *Permissions {
// The first argument is typically a *testing.T value.
func NewPermissions(t interface {
mock.TestingT
Cleanup(func())
}) *Permissions {
mock := &Permissions{}
mock.Mock.Test(t)
+53 -5
View File
@@ -1,4 +1,4 @@
// Code generated by mockery v2.22.1. DO NOT EDIT.
// Code generated by mockery v2.40.1. DO NOT EDIT.
package mocks
@@ -12,6 +12,14 @@ type Publisher struct {
mock.Mock
}
type Publisher_Expecter struct {
mock *mock.Mock
}
func (_m *Publisher) EXPECT() *Publisher_Expecter {
return &Publisher_Expecter{mock: &_m.Mock}
}
// Publish provides a mock function with given fields: _a0, _a1, _a2
func (_m *Publisher) Publish(_a0 string, _a1 interface{}, _a2 ...events.PublishOption) error {
_va := make([]interface{}, len(_a2))
@@ -23,6 +31,10 @@ func (_m *Publisher) Publish(_a0 string, _a1 interface{}, _a2 ...events.PublishO
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for Publish")
}
var r0 error
if rf, ok := ret.Get(0).(func(string, interface{}, ...events.PublishOption) error); ok {
r0 = rf(_a0, _a1, _a2...)
@@ -33,13 +45,49 @@ func (_m *Publisher) Publish(_a0 string, _a1 interface{}, _a2 ...events.PublishO
return r0
}
type mockConstructorTestingTNewPublisher interface {
mock.TestingT
Cleanup(func())
// Publisher_Publish_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Publish'
type Publisher_Publish_Call struct {
*mock.Call
}
// Publish is a helper method to define mock.On call
// - _a0 string
// - _a1 interface{}
// - _a2 ...events.PublishOption
func (_e *Publisher_Expecter) Publish(_a0 interface{}, _a1 interface{}, _a2 ...interface{}) *Publisher_Publish_Call {
return &Publisher_Publish_Call{Call: _e.mock.On("Publish",
append([]interface{}{_a0, _a1}, _a2...)...)}
}
func (_c *Publisher_Publish_Call) Run(run func(_a0 string, _a1 interface{}, _a2 ...events.PublishOption)) *Publisher_Publish_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]events.PublishOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(events.PublishOption)
}
}
run(args[0].(string), args[1].(interface{}), variadicArgs...)
})
return _c
}
func (_c *Publisher_Publish_Call) Return(_a0 error) *Publisher_Publish_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Publisher_Publish_Call) RunAndReturn(run func(string, interface{}, ...events.PublishOption) error) *Publisher_Publish_Call {
_c.Call.Return(run)
return _c
}
// NewPublisher creates a new instance of Publisher. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewPublisher(t mockConstructorTestingTNewPublisher) *Publisher {
// The first argument is typically a *testing.T value.
func NewPublisher(t interface {
mock.TestingT
Cleanup(func())
}) *Publisher {
mock := &Publisher{}
mock.Mock.Test(t)
+176 -5
View File
@@ -1,4 +1,4 @@
// Code generated by mockery v2.22.1. DO NOT EDIT.
// Code generated by mockery v2.40.1. DO NOT EDIT.
package mocks
@@ -19,6 +19,14 @@ type RoleService struct {
mock.Mock
}
type RoleService_Expecter struct {
mock *mock.Mock
}
func (_m *RoleService) EXPECT() *RoleService_Expecter {
return &RoleService_Expecter{mock: &_m.Mock}
}
// AssignRoleToUser provides a mock function with given fields: ctx, in, opts
func (_m *RoleService) AssignRoleToUser(ctx context.Context, in *v0.AssignRoleToUserRequest, opts ...client.CallOption) (*v0.AssignRoleToUserResponse, error) {
_va := make([]interface{}, len(opts))
@@ -30,6 +38,10 @@ func (_m *RoleService) AssignRoleToUser(ctx context.Context, in *v0.AssignRoleTo
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for AssignRoleToUser")
}
var r0 *v0.AssignRoleToUserResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.AssignRoleToUserRequest, ...client.CallOption) (*v0.AssignRoleToUserResponse, error)); ok {
@@ -52,6 +64,43 @@ func (_m *RoleService) AssignRoleToUser(ctx context.Context, in *v0.AssignRoleTo
return r0, r1
}
// RoleService_AssignRoleToUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AssignRoleToUser'
type RoleService_AssignRoleToUser_Call struct {
*mock.Call
}
// AssignRoleToUser is a helper method to define mock.On call
// - ctx context.Context
// - in *v0.AssignRoleToUserRequest
// - opts ...client.CallOption
func (_e *RoleService_Expecter) AssignRoleToUser(ctx interface{}, in interface{}, opts ...interface{}) *RoleService_AssignRoleToUser_Call {
return &RoleService_AssignRoleToUser_Call{Call: _e.mock.On("AssignRoleToUser",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *RoleService_AssignRoleToUser_Call) Run(run func(ctx context.Context, in *v0.AssignRoleToUserRequest, opts ...client.CallOption)) *RoleService_AssignRoleToUser_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]client.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(client.CallOption)
}
}
run(args[0].(context.Context), args[1].(*v0.AssignRoleToUserRequest), variadicArgs...)
})
return _c
}
func (_c *RoleService_AssignRoleToUser_Call) Return(_a0 *v0.AssignRoleToUserResponse, _a1 error) *RoleService_AssignRoleToUser_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *RoleService_AssignRoleToUser_Call) RunAndReturn(run func(context.Context, *v0.AssignRoleToUserRequest, ...client.CallOption) (*v0.AssignRoleToUserResponse, error)) *RoleService_AssignRoleToUser_Call {
_c.Call.Return(run)
return _c
}
// ListRoleAssignments provides a mock function with given fields: ctx, in, opts
func (_m *RoleService) ListRoleAssignments(ctx context.Context, in *v0.ListRoleAssignmentsRequest, opts ...client.CallOption) (*v0.ListRoleAssignmentsResponse, error) {
_va := make([]interface{}, len(opts))
@@ -63,6 +112,10 @@ func (_m *RoleService) ListRoleAssignments(ctx context.Context, in *v0.ListRoleA
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for ListRoleAssignments")
}
var r0 *v0.ListRoleAssignmentsResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.ListRoleAssignmentsRequest, ...client.CallOption) (*v0.ListRoleAssignmentsResponse, error)); ok {
@@ -85,6 +138,43 @@ func (_m *RoleService) ListRoleAssignments(ctx context.Context, in *v0.ListRoleA
return r0, r1
}
// RoleService_ListRoleAssignments_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListRoleAssignments'
type RoleService_ListRoleAssignments_Call struct {
*mock.Call
}
// ListRoleAssignments is a helper method to define mock.On call
// - ctx context.Context
// - in *v0.ListRoleAssignmentsRequest
// - opts ...client.CallOption
func (_e *RoleService_Expecter) ListRoleAssignments(ctx interface{}, in interface{}, opts ...interface{}) *RoleService_ListRoleAssignments_Call {
return &RoleService_ListRoleAssignments_Call{Call: _e.mock.On("ListRoleAssignments",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *RoleService_ListRoleAssignments_Call) Run(run func(ctx context.Context, in *v0.ListRoleAssignmentsRequest, opts ...client.CallOption)) *RoleService_ListRoleAssignments_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]client.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(client.CallOption)
}
}
run(args[0].(context.Context), args[1].(*v0.ListRoleAssignmentsRequest), variadicArgs...)
})
return _c
}
func (_c *RoleService_ListRoleAssignments_Call) Return(_a0 *v0.ListRoleAssignmentsResponse, _a1 error) *RoleService_ListRoleAssignments_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *RoleService_ListRoleAssignments_Call) RunAndReturn(run func(context.Context, *v0.ListRoleAssignmentsRequest, ...client.CallOption) (*v0.ListRoleAssignmentsResponse, error)) *RoleService_ListRoleAssignments_Call {
_c.Call.Return(run)
return _c
}
// ListRoles provides a mock function with given fields: ctx, in, opts
func (_m *RoleService) ListRoles(ctx context.Context, in *v0.ListBundlesRequest, opts ...client.CallOption) (*v0.ListBundlesResponse, error) {
_va := make([]interface{}, len(opts))
@@ -96,6 +186,10 @@ func (_m *RoleService) ListRoles(ctx context.Context, in *v0.ListBundlesRequest,
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for ListRoles")
}
var r0 *v0.ListBundlesResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.ListBundlesRequest, ...client.CallOption) (*v0.ListBundlesResponse, error)); ok {
@@ -118,6 +212,43 @@ func (_m *RoleService) ListRoles(ctx context.Context, in *v0.ListBundlesRequest,
return r0, r1
}
// RoleService_ListRoles_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListRoles'
type RoleService_ListRoles_Call struct {
*mock.Call
}
// ListRoles is a helper method to define mock.On call
// - ctx context.Context
// - in *v0.ListBundlesRequest
// - opts ...client.CallOption
func (_e *RoleService_Expecter) ListRoles(ctx interface{}, in interface{}, opts ...interface{}) *RoleService_ListRoles_Call {
return &RoleService_ListRoles_Call{Call: _e.mock.On("ListRoles",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *RoleService_ListRoles_Call) Run(run func(ctx context.Context, in *v0.ListBundlesRequest, opts ...client.CallOption)) *RoleService_ListRoles_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]client.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(client.CallOption)
}
}
run(args[0].(context.Context), args[1].(*v0.ListBundlesRequest), variadicArgs...)
})
return _c
}
func (_c *RoleService_ListRoles_Call) Return(_a0 *v0.ListBundlesResponse, _a1 error) *RoleService_ListRoles_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *RoleService_ListRoles_Call) RunAndReturn(run func(context.Context, *v0.ListBundlesRequest, ...client.CallOption) (*v0.ListBundlesResponse, error)) *RoleService_ListRoles_Call {
_c.Call.Return(run)
return _c
}
// RemoveRoleFromUser provides a mock function with given fields: ctx, in, opts
func (_m *RoleService) RemoveRoleFromUser(ctx context.Context, in *v0.RemoveRoleFromUserRequest, opts ...client.CallOption) (*emptypb.Empty, error) {
_va := make([]interface{}, len(opts))
@@ -129,6 +260,10 @@ func (_m *RoleService) RemoveRoleFromUser(ctx context.Context, in *v0.RemoveRole
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for RemoveRoleFromUser")
}
var r0 *emptypb.Empty
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.RemoveRoleFromUserRequest, ...client.CallOption) (*emptypb.Empty, error)); ok {
@@ -151,13 +286,49 @@ func (_m *RoleService) RemoveRoleFromUser(ctx context.Context, in *v0.RemoveRole
return r0, r1
}
type mockConstructorTestingTNewRoleService interface {
mock.TestingT
Cleanup(func())
// RoleService_RemoveRoleFromUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveRoleFromUser'
type RoleService_RemoveRoleFromUser_Call struct {
*mock.Call
}
// RemoveRoleFromUser is a helper method to define mock.On call
// - ctx context.Context
// - in *v0.RemoveRoleFromUserRequest
// - opts ...client.CallOption
func (_e *RoleService_Expecter) RemoveRoleFromUser(ctx interface{}, in interface{}, opts ...interface{}) *RoleService_RemoveRoleFromUser_Call {
return &RoleService_RemoveRoleFromUser_Call{Call: _e.mock.On("RemoveRoleFromUser",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *RoleService_RemoveRoleFromUser_Call) Run(run func(ctx context.Context, in *v0.RemoveRoleFromUserRequest, opts ...client.CallOption)) *RoleService_RemoveRoleFromUser_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]client.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(client.CallOption)
}
}
run(args[0].(context.Context), args[1].(*v0.RemoveRoleFromUserRequest), variadicArgs...)
})
return _c
}
func (_c *RoleService_RemoveRoleFromUser_Call) Return(_a0 *emptypb.Empty, _a1 error) *RoleService_RemoveRoleFromUser_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *RoleService_RemoveRoleFromUser_Call) RunAndReturn(run func(context.Context, *v0.RemoveRoleFromUserRequest, ...client.CallOption) (*emptypb.Empty, error)) *RoleService_RemoveRoleFromUser_Call {
_c.Call.Return(run)
return _c
}
// NewRoleService creates a new instance of RoleService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewRoleService(t mockConstructorTestingTNewRoleService) *RoleService {
// The first argument is typically a *testing.T value.
func NewRoleService(t interface {
mock.TestingT
Cleanup(func())
}) *RoleService {
mock := &RoleService{}
mock.Mock.Test(t)
-164
View File
@@ -1,164 +0,0 @@
// Code generated by mockery v0.0.0-dev. 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
}
// 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...)
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
}
// 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...)
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
}
// 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...)
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
}
// 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...)
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
}
// 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
}
@@ -7,7 +7,7 @@ import (
"github.com/go-ldap/ldap/v3"
libregraph "github.com/owncloud/libre-graph-api-go"
"github.com/owncloud/ocis/v2/services/graph/mocks"
"github.com/owncloud/ocis/v2/services/graph/pkg/identity/mocks"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
@@ -8,9 +8,9 @@ import (
"github.com/go-ldap/ldap/v3"
libregraph "github.com/owncloud/libre-graph-api-go"
"github.com/owncloud/ocis/v2/services/graph/mocks"
"github.com/owncloud/ocis/v2/services/graph/pkg/config"
"github.com/owncloud/ocis/v2/services/graph/pkg/errorcode"
"github.com/owncloud/ocis/v2/services/graph/pkg/identity/mocks"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
@@ -6,7 +6,7 @@ import (
"github.com/go-ldap/ldap/v3"
libregraph "github.com/owncloud/libre-graph-api-go"
"github.com/owncloud/ocis/v2/services/graph/mocks"
"github.com/owncloud/ocis/v2/services/graph/pkg/identity/mocks"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
@@ -8,7 +8,7 @@ import (
"github.com/CiscoM31/godata"
"github.com/go-ldap/ldap/v3"
"github.com/owncloud/ocis/v2/services/graph/mocks"
"github.com/owncloud/ocis/v2/services/graph/pkg/identity/mocks"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
+1 -1
View File
@@ -11,8 +11,8 @@ import (
"github.com/go-ldap/ldap/v3"
libregraph "github.com/owncloud/libre-graph-api-go"
"github.com/owncloud/ocis/v2/ocis-pkg/log"
"github.com/owncloud/ocis/v2/services/graph/mocks"
"github.com/owncloud/ocis/v2/services/graph/pkg/config"
"github.com/owncloud/ocis/v2/services/graph/pkg/identity/mocks"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
+448 -5
View File
@@ -1,4 +1,4 @@
// Code generated by mockery v2.22.1. DO NOT EDIT.
// Code generated by mockery v2.40.1. DO NOT EDIT.
package mocks
@@ -19,10 +19,22 @@ type Backend struct {
mock.Mock
}
type Backend_Expecter struct {
mock *mock.Mock
}
func (_m *Backend) EXPECT() *Backend_Expecter {
return &Backend_Expecter{mock: &_m.Mock}
}
// AddMembersToGroup provides a mock function with given fields: ctx, groupID, memberID
func (_m *Backend) AddMembersToGroup(ctx context.Context, groupID string, memberID []string) error {
ret := _m.Called(ctx, groupID, memberID)
if len(ret) == 0 {
panic("no return value specified for AddMembersToGroup")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, []string) error); ok {
r0 = rf(ctx, groupID, memberID)
@@ -33,10 +45,44 @@ func (_m *Backend) AddMembersToGroup(ctx context.Context, groupID string, member
return r0
}
// Backend_AddMembersToGroup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddMembersToGroup'
type Backend_AddMembersToGroup_Call struct {
*mock.Call
}
// AddMembersToGroup is a helper method to define mock.On call
// - ctx context.Context
// - groupID string
// - memberID []string
func (_e *Backend_Expecter) AddMembersToGroup(ctx interface{}, groupID interface{}, memberID interface{}) *Backend_AddMembersToGroup_Call {
return &Backend_AddMembersToGroup_Call{Call: _e.mock.On("AddMembersToGroup", ctx, groupID, memberID)}
}
func (_c *Backend_AddMembersToGroup_Call) Run(run func(ctx context.Context, groupID string, memberID []string)) *Backend_AddMembersToGroup_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].([]string))
})
return _c
}
func (_c *Backend_AddMembersToGroup_Call) Return(_a0 error) *Backend_AddMembersToGroup_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Backend_AddMembersToGroup_Call) RunAndReturn(run func(context.Context, string, []string) error) *Backend_AddMembersToGroup_Call {
_c.Call.Return(run)
return _c
}
// CreateGroup provides a mock function with given fields: ctx, group
func (_m *Backend) CreateGroup(ctx context.Context, group libregraph.Group) (*libregraph.Group, error) {
ret := _m.Called(ctx, group)
if len(ret) == 0 {
panic("no return value specified for CreateGroup")
}
var r0 *libregraph.Group
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, libregraph.Group) (*libregraph.Group, error)); ok {
@@ -59,10 +105,43 @@ func (_m *Backend) CreateGroup(ctx context.Context, group libregraph.Group) (*li
return r0, r1
}
// Backend_CreateGroup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateGroup'
type Backend_CreateGroup_Call struct {
*mock.Call
}
// CreateGroup is a helper method to define mock.On call
// - ctx context.Context
// - group libregraph.Group
func (_e *Backend_Expecter) CreateGroup(ctx interface{}, group interface{}) *Backend_CreateGroup_Call {
return &Backend_CreateGroup_Call{Call: _e.mock.On("CreateGroup", ctx, group)}
}
func (_c *Backend_CreateGroup_Call) Run(run func(ctx context.Context, group libregraph.Group)) *Backend_CreateGroup_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(libregraph.Group))
})
return _c
}
func (_c *Backend_CreateGroup_Call) Return(_a0 *libregraph.Group, _a1 error) *Backend_CreateGroup_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Backend_CreateGroup_Call) RunAndReturn(run func(context.Context, libregraph.Group) (*libregraph.Group, error)) *Backend_CreateGroup_Call {
_c.Call.Return(run)
return _c
}
// CreateUser provides a mock function with given fields: ctx, user
func (_m *Backend) CreateUser(ctx context.Context, user libregraph.User) (*libregraph.User, error) {
ret := _m.Called(ctx, user)
if len(ret) == 0 {
panic("no return value specified for CreateUser")
}
var r0 *libregraph.User
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, libregraph.User) (*libregraph.User, error)); ok {
@@ -85,10 +164,43 @@ func (_m *Backend) CreateUser(ctx context.Context, user libregraph.User) (*libre
return r0, r1
}
// Backend_CreateUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateUser'
type Backend_CreateUser_Call struct {
*mock.Call
}
// CreateUser is a helper method to define mock.On call
// - ctx context.Context
// - user libregraph.User
func (_e *Backend_Expecter) CreateUser(ctx interface{}, user interface{}) *Backend_CreateUser_Call {
return &Backend_CreateUser_Call{Call: _e.mock.On("CreateUser", ctx, user)}
}
func (_c *Backend_CreateUser_Call) Run(run func(ctx context.Context, user libregraph.User)) *Backend_CreateUser_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(libregraph.User))
})
return _c
}
func (_c *Backend_CreateUser_Call) Return(_a0 *libregraph.User, _a1 error) *Backend_CreateUser_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Backend_CreateUser_Call) RunAndReturn(run func(context.Context, libregraph.User) (*libregraph.User, error)) *Backend_CreateUser_Call {
_c.Call.Return(run)
return _c
}
// DeleteGroup provides a mock function with given fields: ctx, id
func (_m *Backend) DeleteGroup(ctx context.Context, id string) error {
ret := _m.Called(ctx, id)
if len(ret) == 0 {
panic("no return value specified for DeleteGroup")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string) error); ok {
r0 = rf(ctx, id)
@@ -99,10 +211,43 @@ func (_m *Backend) DeleteGroup(ctx context.Context, id string) error {
return r0
}
// Backend_DeleteGroup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteGroup'
type Backend_DeleteGroup_Call struct {
*mock.Call
}
// DeleteGroup is a helper method to define mock.On call
// - ctx context.Context
// - id string
func (_e *Backend_Expecter) DeleteGroup(ctx interface{}, id interface{}) *Backend_DeleteGroup_Call {
return &Backend_DeleteGroup_Call{Call: _e.mock.On("DeleteGroup", ctx, id)}
}
func (_c *Backend_DeleteGroup_Call) Run(run func(ctx context.Context, id string)) *Backend_DeleteGroup_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string))
})
return _c
}
func (_c *Backend_DeleteGroup_Call) Return(_a0 error) *Backend_DeleteGroup_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Backend_DeleteGroup_Call) RunAndReturn(run func(context.Context, string) error) *Backend_DeleteGroup_Call {
_c.Call.Return(run)
return _c
}
// DeleteUser provides a mock function with given fields: ctx, nameOrID
func (_m *Backend) DeleteUser(ctx context.Context, nameOrID string) error {
ret := _m.Called(ctx, nameOrID)
if len(ret) == 0 {
panic("no return value specified for DeleteUser")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string) error); ok {
r0 = rf(ctx, nameOrID)
@@ -113,10 +258,43 @@ func (_m *Backend) DeleteUser(ctx context.Context, nameOrID string) error {
return r0
}
// Backend_DeleteUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteUser'
type Backend_DeleteUser_Call struct {
*mock.Call
}
// DeleteUser is a helper method to define mock.On call
// - ctx context.Context
// - nameOrID string
func (_e *Backend_Expecter) DeleteUser(ctx interface{}, nameOrID interface{}) *Backend_DeleteUser_Call {
return &Backend_DeleteUser_Call{Call: _e.mock.On("DeleteUser", ctx, nameOrID)}
}
func (_c *Backend_DeleteUser_Call) Run(run func(ctx context.Context, nameOrID string)) *Backend_DeleteUser_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string))
})
return _c
}
func (_c *Backend_DeleteUser_Call) Return(_a0 error) *Backend_DeleteUser_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Backend_DeleteUser_Call) RunAndReturn(run func(context.Context, string) error) *Backend_DeleteUser_Call {
_c.Call.Return(run)
return _c
}
// GetGroup provides a mock function with given fields: ctx, nameOrID, queryParam
func (_m *Backend) GetGroup(ctx context.Context, nameOrID string, queryParam url.Values) (*libregraph.Group, error) {
ret := _m.Called(ctx, nameOrID, queryParam)
if len(ret) == 0 {
panic("no return value specified for GetGroup")
}
var r0 *libregraph.Group
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, url.Values) (*libregraph.Group, error)); ok {
@@ -139,10 +317,44 @@ func (_m *Backend) GetGroup(ctx context.Context, nameOrID string, queryParam url
return r0, r1
}
// Backend_GetGroup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetGroup'
type Backend_GetGroup_Call struct {
*mock.Call
}
// GetGroup is a helper method to define mock.On call
// - ctx context.Context
// - nameOrID string
// - queryParam url.Values
func (_e *Backend_Expecter) GetGroup(ctx interface{}, nameOrID interface{}, queryParam interface{}) *Backend_GetGroup_Call {
return &Backend_GetGroup_Call{Call: _e.mock.On("GetGroup", ctx, nameOrID, queryParam)}
}
func (_c *Backend_GetGroup_Call) Run(run func(ctx context.Context, nameOrID string, queryParam url.Values)) *Backend_GetGroup_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(url.Values))
})
return _c
}
func (_c *Backend_GetGroup_Call) Return(_a0 *libregraph.Group, _a1 error) *Backend_GetGroup_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Backend_GetGroup_Call) RunAndReturn(run func(context.Context, string, url.Values) (*libregraph.Group, error)) *Backend_GetGroup_Call {
_c.Call.Return(run)
return _c
}
// GetGroupMembers provides a mock function with given fields: ctx, id, oreq
func (_m *Backend) GetGroupMembers(ctx context.Context, id string, oreq *godata.GoDataRequest) ([]*libregraph.User, error) {
ret := _m.Called(ctx, id, oreq)
if len(ret) == 0 {
panic("no return value specified for GetGroupMembers")
}
var r0 []*libregraph.User
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, *godata.GoDataRequest) ([]*libregraph.User, error)); ok {
@@ -165,10 +377,44 @@ func (_m *Backend) GetGroupMembers(ctx context.Context, id string, oreq *godata.
return r0, r1
}
// Backend_GetGroupMembers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetGroupMembers'
type Backend_GetGroupMembers_Call struct {
*mock.Call
}
// GetGroupMembers is a helper method to define mock.On call
// - ctx context.Context
// - id string
// - oreq *godata.GoDataRequest
func (_e *Backend_Expecter) GetGroupMembers(ctx interface{}, id interface{}, oreq interface{}) *Backend_GetGroupMembers_Call {
return &Backend_GetGroupMembers_Call{Call: _e.mock.On("GetGroupMembers", ctx, id, oreq)}
}
func (_c *Backend_GetGroupMembers_Call) Run(run func(ctx context.Context, id string, oreq *godata.GoDataRequest)) *Backend_GetGroupMembers_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(*godata.GoDataRequest))
})
return _c
}
func (_c *Backend_GetGroupMembers_Call) Return(_a0 []*libregraph.User, _a1 error) *Backend_GetGroupMembers_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Backend_GetGroupMembers_Call) RunAndReturn(run func(context.Context, string, *godata.GoDataRequest) ([]*libregraph.User, error)) *Backend_GetGroupMembers_Call {
_c.Call.Return(run)
return _c
}
// GetGroups provides a mock function with given fields: ctx, oreq
func (_m *Backend) GetGroups(ctx context.Context, oreq *godata.GoDataRequest) ([]*libregraph.Group, error) {
ret := _m.Called(ctx, oreq)
if len(ret) == 0 {
panic("no return value specified for GetGroups")
}
var r0 []*libregraph.Group
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *godata.GoDataRequest) ([]*libregraph.Group, error)); ok {
@@ -191,10 +437,43 @@ func (_m *Backend) GetGroups(ctx context.Context, oreq *godata.GoDataRequest) ([
return r0, r1
}
// Backend_GetGroups_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetGroups'
type Backend_GetGroups_Call struct {
*mock.Call
}
// GetGroups is a helper method to define mock.On call
// - ctx context.Context
// - oreq *godata.GoDataRequest
func (_e *Backend_Expecter) GetGroups(ctx interface{}, oreq interface{}) *Backend_GetGroups_Call {
return &Backend_GetGroups_Call{Call: _e.mock.On("GetGroups", ctx, oreq)}
}
func (_c *Backend_GetGroups_Call) Run(run func(ctx context.Context, oreq *godata.GoDataRequest)) *Backend_GetGroups_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*godata.GoDataRequest))
})
return _c
}
func (_c *Backend_GetGroups_Call) Return(_a0 []*libregraph.Group, _a1 error) *Backend_GetGroups_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Backend_GetGroups_Call) RunAndReturn(run func(context.Context, *godata.GoDataRequest) ([]*libregraph.Group, error)) *Backend_GetGroups_Call {
_c.Call.Return(run)
return _c
}
// GetUser provides a mock function with given fields: ctx, nameOrID, oreq
func (_m *Backend) GetUser(ctx context.Context, nameOrID string, oreq *godata.GoDataRequest) (*libregraph.User, error) {
ret := _m.Called(ctx, nameOrID, oreq)
if len(ret) == 0 {
panic("no return value specified for GetUser")
}
var r0 *libregraph.User
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, *godata.GoDataRequest) (*libregraph.User, error)); ok {
@@ -217,10 +496,44 @@ func (_m *Backend) GetUser(ctx context.Context, nameOrID string, oreq *godata.Go
return r0, r1
}
// Backend_GetUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetUser'
type Backend_GetUser_Call struct {
*mock.Call
}
// GetUser is a helper method to define mock.On call
// - ctx context.Context
// - nameOrID string
// - oreq *godata.GoDataRequest
func (_e *Backend_Expecter) GetUser(ctx interface{}, nameOrID interface{}, oreq interface{}) *Backend_GetUser_Call {
return &Backend_GetUser_Call{Call: _e.mock.On("GetUser", ctx, nameOrID, oreq)}
}
func (_c *Backend_GetUser_Call) Run(run func(ctx context.Context, nameOrID string, oreq *godata.GoDataRequest)) *Backend_GetUser_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(*godata.GoDataRequest))
})
return _c
}
func (_c *Backend_GetUser_Call) Return(_a0 *libregraph.User, _a1 error) *Backend_GetUser_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Backend_GetUser_Call) RunAndReturn(run func(context.Context, string, *godata.GoDataRequest) (*libregraph.User, error)) *Backend_GetUser_Call {
_c.Call.Return(run)
return _c
}
// GetUsers provides a mock function with given fields: ctx, oreq
func (_m *Backend) GetUsers(ctx context.Context, oreq *godata.GoDataRequest) ([]*libregraph.User, error) {
ret := _m.Called(ctx, oreq)
if len(ret) == 0 {
panic("no return value specified for GetUsers")
}
var r0 []*libregraph.User
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *godata.GoDataRequest) ([]*libregraph.User, error)); ok {
@@ -243,10 +556,43 @@ func (_m *Backend) GetUsers(ctx context.Context, oreq *godata.GoDataRequest) ([]
return r0, r1
}
// Backend_GetUsers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetUsers'
type Backend_GetUsers_Call struct {
*mock.Call
}
// GetUsers is a helper method to define mock.On call
// - ctx context.Context
// - oreq *godata.GoDataRequest
func (_e *Backend_Expecter) GetUsers(ctx interface{}, oreq interface{}) *Backend_GetUsers_Call {
return &Backend_GetUsers_Call{Call: _e.mock.On("GetUsers", ctx, oreq)}
}
func (_c *Backend_GetUsers_Call) Run(run func(ctx context.Context, oreq *godata.GoDataRequest)) *Backend_GetUsers_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*godata.GoDataRequest))
})
return _c
}
func (_c *Backend_GetUsers_Call) Return(_a0 []*libregraph.User, _a1 error) *Backend_GetUsers_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Backend_GetUsers_Call) RunAndReturn(run func(context.Context, *godata.GoDataRequest) ([]*libregraph.User, error)) *Backend_GetUsers_Call {
_c.Call.Return(run)
return _c
}
// RemoveMemberFromGroup provides a mock function with given fields: ctx, groupID, memberID
func (_m *Backend) RemoveMemberFromGroup(ctx context.Context, groupID string, memberID string) error {
ret := _m.Called(ctx, groupID, memberID)
if len(ret) == 0 {
panic("no return value specified for RemoveMemberFromGroup")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, string) error); ok {
r0 = rf(ctx, groupID, memberID)
@@ -257,10 +603,44 @@ func (_m *Backend) RemoveMemberFromGroup(ctx context.Context, groupID string, me
return r0
}
// Backend_RemoveMemberFromGroup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveMemberFromGroup'
type Backend_RemoveMemberFromGroup_Call struct {
*mock.Call
}
// RemoveMemberFromGroup is a helper method to define mock.On call
// - ctx context.Context
// - groupID string
// - memberID string
func (_e *Backend_Expecter) RemoveMemberFromGroup(ctx interface{}, groupID interface{}, memberID interface{}) *Backend_RemoveMemberFromGroup_Call {
return &Backend_RemoveMemberFromGroup_Call{Call: _e.mock.On("RemoveMemberFromGroup", ctx, groupID, memberID)}
}
func (_c *Backend_RemoveMemberFromGroup_Call) Run(run func(ctx context.Context, groupID string, memberID string)) *Backend_RemoveMemberFromGroup_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string))
})
return _c
}
func (_c *Backend_RemoveMemberFromGroup_Call) Return(_a0 error) *Backend_RemoveMemberFromGroup_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Backend_RemoveMemberFromGroup_Call) RunAndReturn(run func(context.Context, string, string) error) *Backend_RemoveMemberFromGroup_Call {
_c.Call.Return(run)
return _c
}
// UpdateGroupName provides a mock function with given fields: ctx, groupID, groupName
func (_m *Backend) UpdateGroupName(ctx context.Context, groupID string, groupName string) error {
ret := _m.Called(ctx, groupID, groupName)
if len(ret) == 0 {
panic("no return value specified for UpdateGroupName")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, string) error); ok {
r0 = rf(ctx, groupID, groupName)
@@ -271,10 +651,44 @@ func (_m *Backend) UpdateGroupName(ctx context.Context, groupID string, groupNam
return r0
}
// Backend_UpdateGroupName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateGroupName'
type Backend_UpdateGroupName_Call struct {
*mock.Call
}
// UpdateGroupName is a helper method to define mock.On call
// - ctx context.Context
// - groupID string
// - groupName string
func (_e *Backend_Expecter) UpdateGroupName(ctx interface{}, groupID interface{}, groupName interface{}) *Backend_UpdateGroupName_Call {
return &Backend_UpdateGroupName_Call{Call: _e.mock.On("UpdateGroupName", ctx, groupID, groupName)}
}
func (_c *Backend_UpdateGroupName_Call) Run(run func(ctx context.Context, groupID string, groupName string)) *Backend_UpdateGroupName_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string))
})
return _c
}
func (_c *Backend_UpdateGroupName_Call) Return(_a0 error) *Backend_UpdateGroupName_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Backend_UpdateGroupName_Call) RunAndReturn(run func(context.Context, string, string) error) *Backend_UpdateGroupName_Call {
_c.Call.Return(run)
return _c
}
// UpdateUser provides a mock function with given fields: ctx, nameOrID, user
func (_m *Backend) UpdateUser(ctx context.Context, nameOrID string, user libregraph.User) (*libregraph.User, error) {
ret := _m.Called(ctx, nameOrID, user)
if len(ret) == 0 {
panic("no return value specified for UpdateUser")
}
var r0 *libregraph.User
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, libregraph.User) (*libregraph.User, error)); ok {
@@ -297,13 +711,42 @@ func (_m *Backend) UpdateUser(ctx context.Context, nameOrID string, user libregr
return r0, r1
}
type mockConstructorTestingTNewBackend interface {
mock.TestingT
Cleanup(func())
// Backend_UpdateUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUser'
type Backend_UpdateUser_Call struct {
*mock.Call
}
// UpdateUser is a helper method to define mock.On call
// - ctx context.Context
// - nameOrID string
// - user libregraph.User
func (_e *Backend_Expecter) UpdateUser(ctx interface{}, nameOrID interface{}, user interface{}) *Backend_UpdateUser_Call {
return &Backend_UpdateUser_Call{Call: _e.mock.On("UpdateUser", ctx, nameOrID, user)}
}
func (_c *Backend_UpdateUser_Call) Run(run func(ctx context.Context, nameOrID string, user libregraph.User)) *Backend_UpdateUser_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(libregraph.User))
})
return _c
}
func (_c *Backend_UpdateUser_Call) Return(_a0 *libregraph.User, _a1 error) *Backend_UpdateUser_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Backend_UpdateUser_Call) RunAndReturn(run func(context.Context, string, libregraph.User) (*libregraph.User, error)) *Backend_UpdateUser_Call {
_c.Call.Return(run)
return _c
}
// NewBackend creates a new instance of Backend. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewBackend(t mockConstructorTestingTNewBackend) *Backend {
// The first argument is typically a *testing.T value.
func NewBackend(t interface {
mock.TestingT
Cleanup(func())
}) *Backend {
mock := &Backend{}
mock.Mock.Test(t)
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -1010,8 +1010,8 @@ func cs3ResourceToDriveItem(logger *log.Logger, res *storageprovider.ResourceInf
parentRef.SetDriveType(res.GetSpace().GetSpaceType())
parentRef.SetDriveId(storagespace.FormatStorageID(res.GetParentId().GetStorageId(), res.GetParentId().GetSpaceId()))
parentRef.SetId(storagespace.FormatResourceID(*res.GetParentId()))
parentRef.SetName(res.GetName())
parentRef.SetPath(res.GetPath())
parentRef.SetName(path.Base(path.Dir(res.GetPath())))
parentRef.SetPath(path.Dir(res.GetPath()))
driveItem.ParentReference = parentRef
}
if res.GetType() == storageprovider.ResourceType_RESOURCE_TYPE_FILE && res.GetMimeType() != "" {
-2
View File
@@ -31,8 +31,6 @@ import (
"github.com/owncloud/ocis/v2/services/graph/pkg/identity"
)
//go:generate make -C ../../.. generate
// Publisher is the interface for events publisher
type Publisher interface {
Publish(string, interface{}, ...mevents.PublishOption) error
@@ -24,6 +24,7 @@ import (
"github.com/owncloud/ocis/v2/services/graph/pkg/config"
"github.com/owncloud/ocis/v2/services/graph/pkg/config/defaults"
"github.com/owncloud/ocis/v2/services/graph/pkg/identity"
identitymocks "github.com/owncloud/ocis/v2/services/graph/pkg/identity/mocks"
service "github.com/owncloud/ocis/v2/services/graph/pkg/service/v0"
"github.com/stretchr/testify/mock"
"google.golang.org/grpc"
@@ -34,7 +35,7 @@ var _ = Describe("Users changing their own password", func() {
svc service.Service
gatewayClient *cs3mocks.GatewayAPIClient
gatewaySelector pool.Selectable[gateway.GatewayAPIClient]
ldapClient *mocks.Client
ldapClient *identitymocks.Client
ldapConfig config.LDAP
identityBackend identity.Backend
eventsPublisher mocks.Publisher
@@ -135,8 +136,8 @@ var _ = Describe("Users changing their own password", func() {
)
})
func mockedLDAPClient() *mocks.Client {
lm := &mocks.Client{}
func mockedLDAPClient() *identitymocks.Client {
lm := &identitymocks.Client{}
userEntry := ldap.NewEntry("uid=test", map[string][]string{
"uid": {"test"},
+109 -88
View File
@@ -4,17 +4,16 @@ import (
"context"
"net/http"
"reflect"
"slices"
cs3User "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
collaboration "github.com/cs3org/go-cs3apis/cs3/sharing/collaboration/v1beta1"
storageprovider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
"github.com/cs3org/reva/v2/pkg/utils"
"github.com/go-chi/render"
libregraph "github.com/owncloud/libre-graph-api-go"
"golang.org/x/sync/errgroup"
"github.com/cs3org/reva/v2/pkg/storagespace"
"github.com/cs3org/reva/v2/pkg/utils"
"github.com/owncloud/ocis/v2/services/graph/pkg/errorcode"
"github.com/owncloud/ocis/v2/services/graph/pkg/unifiedrole"
@@ -48,6 +47,16 @@ func (g Graph) listSharedWithMe(ctx context.Context) ([]libregraph.DriveItem, er
return nil, *errCode
}
return g.cs3ReceivedSharesToDriveItems(ctx, listReceivedSharesResponse.GetShares())
}
func (g Graph) cs3ReceivedSharesToDriveItems(ctx context.Context, receivedShares []*collaboration.ReceivedShare) ([]libregraph.DriveItem, error) {
gatewayClient, err := g.gatewaySelector.Next()
if err != nil {
g.logger.Error().Err(err).Msg("could not select next gateway client")
return nil, err
}
// doStat is a helper function that stat a resource.
doStat := func(resourceId *storageprovider.ResourceId) (*storageprovider.StatResponse, error) {
shareStat, err := gatewayClient.Stat(ctx, &storageprovider.StatRequest{
@@ -67,28 +76,87 @@ func (g Graph) listSharedWithMe(ctx context.Context) ([]libregraph.DriveItem, er
return shareStat, nil
}
ch := make(chan libregraph.DriveItem)
group := new(errgroup.Group)
receivedShares := listReceivedSharesResponse.GetShares()
driveItems := make([]libregraph.DriveItem, len(receivedShares))
// Set max concurrency
group.SetLimit(10)
for i, receivedShare := range receivedShares {
i, receivedShare := i, receivedShare
receivedSharesByResourceID := make(map[string][]*collaboration.ReceivedShare, len(receivedShares))
for _, receivedShare := range receivedShares {
rIDStr := storagespace.FormatResourceID(*receivedShare.GetShare().GetResourceId())
receivedSharesByResourceID[rIDStr] = append(receivedSharesByResourceID[rIDStr], receivedShare)
}
for _, receivedSharesForResource := range receivedSharesByResourceID {
receivedShares := receivedSharesForResource
group.Go(func() error {
shareStat, err := doStat(receivedShare.GetShare().GetResourceId())
var err error // redeclare
resourceID := receivedShares[0].GetShare().GetResourceId()
shareStat, err := doStat(receivedShares[0].GetShare().GetResourceId())
if shareStat == nil || err != nil {
return err
}
permission, err := g.cs3ReceivedShareToLibreGraphPermissions(ctx, receivedShare, shareStat.GetInfo())
if err != nil {
return err
driveItem := libregraph.NewDriveItem()
// The id of the driveItem will be the composed of the StorageID and the SpaceID of the sharestorage
// appended with the ResourceID of the shared resource
// '<sharestorageid>$<sharespaceid>!<resource's storageid>:<resource's spaceid>:<resource's opaque id>'
driveItem.SetId(storagespace.FormatResourceID(storageprovider.ResourceId{
StorageId: utils.ShareStorageProviderID,
OpaqueId: resourceID.GetStorageId() + ":" + resourceID.GetSpaceId() + ":" + resourceID.GetOpaqueId(),
SpaceId: utils.ShareStorageSpaceID,
}))
permissions := make([]libregraph.Permission, 0, len(receivedShares))
for _, receivedShare := range receivedShares {
permission, err := g.cs3ReceivedShareToLibreGraphPermissions(ctx, receivedShare)
if err != nil {
return err
}
// If at least one of the shares was accepted, we consider the driveItem's synchronized
// flag enabled.
// Also we use the Mountpoint name of the first accepted mountpoint as the name of
// of the driveItem
if receivedShare.GetState() == collaboration.ShareState_SHARE_STATE_ACCEPTED {
driveItem.SetClientSynchronize(true)
if name := receivedShare.GetMountPoint().GetPath(); name != "" && driveItem.GetName() == "" {
driveItem.SetName(receivedShare.GetMountPoint().GetPath())
}
}
// if at least one share is marked as hidden, consider the whole driveItem to be hidden
if receivedShare.GetHidden() {
driveItem.SetUIHidden(true)
}
if userID := receivedShare.GetShare().GetCreator(); userID != nil {
identity, err := g.cs3UserIdToIdentity(ctx, userID)
if err != nil {
g.logger.Warn().Err(err).Str("userid", userID.String()).Msg("could not get creator of the share")
}
permission.SetInvitation(
libregraph.SharingInvitation{
InvitedBy: &libregraph.IdentitySet{
User: &identity,
},
},
)
}
permissions = append(permissions, *permission)
}
shared := libregraph.NewShared()
{
if cTime := receivedShare.GetShare().GetCtime(); cTime != nil {
shared.SetSharedDateTime(cs3TimestampToTime(cTime))
if !driveItem.HasUIHidden() {
driveItem.SetUIHidden(false)
}
if !driveItem.HasClientSynchronize() {
driveItem.SetClientSynchronize(false)
if name := shareStat.GetInfo().GetName(); name != "" {
driveItem.SetName(name)
}
}
@@ -128,43 +196,18 @@ func (g Graph) listSharedWithMe(ctx context.Context) ([]libregraph.DriveItem, er
}
driveItem := libregraph.NewDriveItem()
// handle share state related stuff
switch receivedShare.GetState() {
case collaboration.ShareState_SHARE_STATE_ACCEPTED:
driveItem.SetId(storagespace.FormatResourceID(storageprovider.ResourceId{
StorageId: utils.ShareStorageProviderID,
OpaqueId: receivedShare.GetShare().GetId().GetOpaqueId(),
SpaceId: utils.ShareStorageSpaceID,
}))
if name := receivedShare.GetMountPoint().GetPath(); name != "" {
driveItem.SetName(receivedShare.GetMountPoint().GetPath())
}
if etag := shareStat.GetInfo().GetEtag(); etag != "" {
driveItem.SetETag(etag)
}
// parentReference of the out driveItem should be the drive containing the mountpoint
// i.e. the share jail
driveItem.ParentReference = libregraph.NewItemReference()
driveItem.ParentReference.SetDriveType("virtual")
driveItem.ParentReference.SetDriveId(storagespace.FormatStorageID(utils.ShareStorageProviderID, utils.ShareStorageSpaceID))
driveItem.ParentReference.SetId(storagespace.FormatResourceID(storageprovider.ResourceId{
StorageId: utils.ShareStorageProviderID,
OpaqueId: utils.ShareStorageSpaceID,
SpaceId: utils.ShareStorageSpaceID,
}))
case collaboration.ShareState_SHARE_STATE_PENDING:
fallthrough
case collaboration.ShareState_SHARE_STATE_REJECTED:
if name := shareStat.GetInfo().GetName(); name != "" {
driveItem.SetName(name)
}
// the parentReference of the outer driveItem should be the drive
// containing the mountpoint i.e. the share jail
driveItem.ParentReference = libregraph.NewItemReference()
driveItem.ParentReference.SetDriveType("virtual")
driveItem.ParentReference.SetDriveId(storagespace.FormatStorageID(utils.ShareStorageProviderID, utils.ShareStorageSpaceID))
driveItem.ParentReference.SetId(storagespace.FormatResourceID(storageprovider.ResourceId{
StorageId: utils.ShareStorageProviderID,
OpaqueId: utils.ShareStorageSpaceID,
SpaceId: utils.ShareStorageSpaceID,
}))
if etag := shareStat.GetInfo().GetEtag(); etag != "" {
driveItem.SetETag(etag)
}
// connect the dots
@@ -183,7 +226,7 @@ func (g Graph) listSharedWithMe(ctx context.Context) ([]libregraph.DriveItem, er
remoteItem.SetSize(s)
}
if userID := shareStat.GetInfo().GetOwner(); userID != nil {
if userID := shareStat.GetInfo().GetOwner(); userID != nil && userID.Type != cs3User.UserType_USER_TYPE_SPACE_OWNER {
identity, err := g.cs3UserIdToIdentity(ctx, userID)
if err != nil {
// TODO: define a proper error behavior here. We don't
@@ -198,25 +241,6 @@ func (g Graph) listSharedWithMe(ctx context.Context) ([]libregraph.DriveItem, er
remoteItem.SetCreatedBy(libregraph.IdentitySet{User: &identity})
driveItem.SetCreatedBy(libregraph.IdentitySet{User: &identity})
}
if userID := receivedShare.GetShare().GetOwner(); userID != nil {
identity, err := g.cs3UserIdToIdentity(ctx, userID)
if err != nil {
g.logger.Warn().Err(err).Str("userid", userID.String()).Msg("could not get owner of the share")
}
shared.SetOwner(libregraph.IdentitySet{User: &identity})
}
if userID := receivedShare.GetShare().GetCreator(); userID != nil {
identity, err := g.cs3UserIdToIdentity(ctx, userID)
if err != nil {
g.logger.Warn().Err(err).Str("userid", userID.String()).Msg("could not get creator of the share")
}
shared.SetSharedBy(libregraph.IdentitySet{User: &identity})
}
switch info := shareStat.GetInfo(); {
case info.GetType() == storageprovider.ResourceType_RESOURCE_TYPE_CONTAINER:
folder := libregraph.NewFolder()
@@ -234,13 +258,7 @@ func (g Graph) listSharedWithMe(ctx context.Context) ([]libregraph.DriveItem, er
driveItem.File = file
}
if !reflect.ValueOf(*shared).IsZero() {
remoteItem.Shared = shared
}
if !reflect.ValueOf(*permission).IsZero() {
permissions := []libregraph.Permission{*permission}
if len(permissions) > 0 {
remoteItem.Permissions = permissions
}
@@ -249,22 +267,27 @@ func (g Graph) listSharedWithMe(ctx context.Context) ([]libregraph.DriveItem, er
}
}
driveItems[i] = *driveItem
ch <- *driveItem
return nil
})
}
// wait for concurrent requests to finish
err = group.Wait()
go func() {
err = group.Wait()
close(ch)
}()
// filter out empty drive items
return slices.Clip(slices.DeleteFunc(driveItems, func(item libregraph.DriveItem) bool {
return reflect.ValueOf(item).IsZero()
})), err
driveItems := make([]libregraph.DriveItem, 0, len(receivedSharesByResourceID))
for di := range ch {
driveItems = append(driveItems, di)
}
return driveItems, err
}
func (g Graph) cs3ReceivedShareToLibreGraphPermissions(ctx context.Context, receivedShare *collaboration.ReceivedShare, shareStatInfo *storageprovider.ResourceInfo) (*libregraph.Permission, error) {
func (g Graph) cs3ReceivedShareToLibreGraphPermissions(ctx context.Context, receivedShare *collaboration.ReceivedShare) (*libregraph.Permission, error) {
permission := libregraph.NewPermission()
if id := receivedShare.GetShare().GetId().GetOpaqueId(); id != "" {
permission.SetId(id)
@@ -274,7 +297,7 @@ func (g Graph) cs3ReceivedShareToLibreGraphPermissions(ctx context.Context, rece
permission.SetExpirationDateTime(cs3TimestampToTime(expiration))
}
if permissionSet := shareStatInfo.GetPermissionSet(); permissionSet != nil {
if permissionSet := receivedShare.GetShare().GetPermissions().GetPermissions(); permissionSet != nil {
role := unifiedrole.CS3ResourcePermissionsToUnifiedRole(
*permissionSet,
unifiedrole.UnifiedRoleConditionGrantee,
@@ -321,8 +344,6 @@ func (g Graph) cs3ReceivedShareToLibreGraphPermissions(ctx context.Context, rece
},
})
}
permission.SetUiHidden(receivedShare.GetHidden())
permission.SetClientSynchronize(receivedShare.GetState() == collaboration.ShareState_SHARE_STATE_ACCEPTED)
return permission, nil
}
@@ -2,11 +2,13 @@ package svc_test
import (
"context"
"encoding/json"
"net/http"
"net/http/httptest"
"time"
gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1"
groupv1beta1 "github.com/cs3org/go-cs3apis/cs3/identity/group/v1beta1"
userv1beta1 "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
collaborationv1beta1 "github.com/cs3org/go-cs3apis/cs3/sharing/collaboration/v1beta1"
providerv1beta1 "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
@@ -23,6 +25,7 @@ import (
"github.com/tidwall/gjson"
"google.golang.org/grpc"
libregraph "github.com/owncloud/libre-graph-api-go"
"github.com/owncloud/ocis/v2/ocis-pkg/shared"
"github.com/owncloud/ocis/v2/services/graph/pkg/config"
"github.com/owncloud/ocis/v2/services/graph/pkg/config/defaults"
@@ -130,11 +133,32 @@ var _ = Describe("SharedWithMe", func() {
Return(getUserResponseShareCreator, nil)
gatewayClient.On("GetUser", mock.Anything, mock.Anything).Return(getUserResponseDefault, nil)
gatewayClient.On("GetGroup", mock.Anything, mock.Anything).
Return(
&groupv1beta1.GetGroupResponse{
Status: status.NewOK(ctx),
Group: &groupv1beta1.Group{
Id: &groupv1beta1.GroupId{
OpaqueId: "group-id",
},
DisplayName: "Group",
},
}, nil)
listReceivedSharesResponse = &collaborationv1beta1.ListReceivedSharesResponse{
Status: status.NewOK(ctx),
Shares: []*collaborationv1beta1.ReceivedShare{
{
Share: &collaborationv1beta1.Share{ResourceId: toResourceID("1$2!3")},
Share: &collaborationv1beta1.Share{
ResourceId: toResourceID("1$2!3"),
Id: &collaborationv1beta1.ShareId{
OpaqueId: "sh:are:id",
},
Permissions: &collaborationv1beta1.SharePermissions{
Permissions: roleconversions.NewViewerRole(true).CS3ResourcePermissions(),
},
Creator: getUserResponseShareCreator.User.Id,
},
MountPoint: &providerv1beta1.Reference{
ResourceId: &providerv1beta1.ResourceId{
StorageId: utils.ShareStorageProviderID,
@@ -209,9 +233,6 @@ var _ = Describe("SharedWithMe", func() {
share.Id = &collaborationv1beta1.ShareId{OpaqueId: "1:2:3"}
share.Ctime = &typesv1beta1.Timestamp{Seconds: 4001}
share.Mtime = &typesv1beta1.Timestamp{Seconds: 4002}
share.Creator = &userv1beta1.UserId{
OpaqueId: "share-creator-id",
}
resourceInfo := statResponse.Info
resourceInfo.Name = "some folder"
@@ -337,72 +358,24 @@ var _ = Describe("SharedWithMe", func() {
httptest.NewRequest(http.MethodGet, "/graph/v1beta1/me/drive/sharedWithMe", nil),
)
jsonData := gjson.Get(tape.Body.String(), "value.0.remoteItem.permissions.0")
driveitemJSON := gjson.Get(tape.Body.String(), "value.0")
Expect(driveitemJSON.Get("@UI\\.Hidden").Exists()).To(BeTrue())
Expect(driveitemJSON.Get("@UI\\.Hidden").Bool()).To(BeFalse())
Expect(driveitemJSON.Get("@client\\.synchronize").Exists()).To(BeTrue())
Expect(driveitemJSON.Get("@client\\.synchronize").Bool()).To(BeTrue())
Expect(jsonData.Get("roles.0").String()).To(Equal(unifiedrole.UnifiedRoleViewerID))
Expect(jsonData.Get("@ui\\.hidden").Exists()).To(BeTrue())
Expect(jsonData.Get("@ui\\.hidden").Bool()).To(BeFalse())
Expect(jsonData.Get("@client\\.synchronize").Exists()).To(BeTrue())
Expect(jsonData.Get("@client\\.synchronize").Bool()).To(BeTrue())
})
It("populates the driveItem.remoteItem.shared properties", func() {
share := listReceivedSharesResponse.Shares[0].Share
share.Ctime = &typesv1beta1.Timestamp{Seconds: 4000}
svc.ListSharedWithMe(
tape,
httptest.NewRequest(http.MethodGet, "/graph/v1beta1/me/drive/sharedWithMe", nil),
)
jsonData := gjson.Get(tape.Body.String(), "value.0.remoteItem.shared")
Expect(jsonData.Get("sharedDateTime").String()).To(Equal(utils.TSToTime(share.Ctime).Format(time.RFC3339Nano)))
})
It("populates the driveItem.remoteItem.shared.owner properties", func() {
shareOwner := getUserResponseDefault.User
share := listReceivedSharesResponse.Shares[0].Share
share.Owner = shareOwner.Id
svc.ListSharedWithMe(
tape,
httptest.NewRequest(http.MethodGet, "/graph/v1beta1/me/drive/sharedWithMe", nil),
)
jsonData := gjson.Get(tape.Body.String(), "value.0.remoteItem.shared.owner")
Expect(jsonData.Get("user.displayName").String()).To(Equal(shareOwner.DisplayName))
Expect(jsonData.Get("user.id").String()).To(Equal(shareOwner.Id.OpaqueId))
})
It("populates the driveItem.remoteItem.shared.sharedBy properties", func() {
shareCreator := getUserResponseDefault.User
share := listReceivedSharesResponse.Shares[0].Share
share.Creator = shareCreator.Id
svc.ListSharedWithMe(
tape,
httptest.NewRequest(http.MethodGet, "/graph/v1beta1/me/drive/sharedWithMe", nil),
)
jsonData := gjson.Get(tape.Body.String(), "value.0.remoteItem.shared.sharedBy")
Expect(jsonData.Get("user.displayName").String()).To(Equal(shareCreator.DisplayName))
Expect(jsonData.Get("user.id").String()).To(Equal(shareCreator.Id.OpaqueId))
permissionsJSON := driveitemJSON.Get("remoteItem.permissions.0")
Expect(permissionsJSON.Get("id").String()).To(Equal(listReceivedSharesResponse.Shares[0].Share.Id.OpaqueId))
Expect(permissionsJSON.Get("roles.0").String()).To(Equal(unifiedrole.UnifiedRoleViewerID))
Expect(permissionsJSON.Get("invitation.invitedBy.user.id").String()).To(Equal(getUserResponseShareCreator.User.Id.OpaqueId))
})
It("returns shares created on project space", func() {
shareCreator := getUserResponseDefault.User
ownerID := &userv1beta1.UserId{
OpaqueId: "project-space-id",
Type: userv1beta1.UserType_USER_TYPE_SPACE_OWNER,
}
share := listReceivedSharesResponse.Shares[0].Share
share.Creator = shareCreator.Id
share.Owner = ownerID
resourceInfo := statResponse.Info
resourceInfo.Owner = ownerID
@@ -414,14 +387,45 @@ var _ = Describe("SharedWithMe", func() {
jsonData := gjson.Get(tape.Body.String(), "value.0.createdBy")
Expect(jsonData.Get("user.displayName").String()).To(Equal(""))
Expect(jsonData.Get("user.id").String()).To(Equal(ownerID.OpaqueId))
Expect(jsonData.String()).To(Equal(""))
jsonData = gjson.Get(tape.Body.String(), "value.0.remoteItem.shared")
Expect(jsonData.Get("sharedBy.user.displayName").String()).To(Equal(shareCreator.DisplayName))
Expect(jsonData.Get("sharedBy.user.id").String()).To(Equal(shareCreator.Id.OpaqueId))
Expect(jsonData.Get("owner.user.displayName").String()).To(Equal(""))
Expect(jsonData.Get("owner.user.id").String()).To(Equal(ownerID.OpaqueId))
jsonData = gjson.Get(tape.Body.String(), "value.0.remoteItem.permissions.0.invitation.invitedBy.user")
Expect(jsonData.Get("displayName").String()).To(Equal(getUserResponseShareCreator.User.DisplayName))
Expect(jsonData.Get("id").String()).To(Equal(getUserResponseShareCreator.User.Id.OpaqueId))
})
It("returns a single drive item when multiple shares exist for the same resource", func() {
anotherShare := &collaborationv1beta1.ReceivedShare{
Share: &collaborationv1beta1.Share{
ResourceId: toResourceID("1$2!3"),
Id: &collaborationv1beta1.ShareId{
OpaqueId: "sh:are:id2",
},
Permissions: &collaborationv1beta1.SharePermissions{
Permissions: roleconversions.NewViewerRole(true).CS3ResourcePermissions(),
},
Creator: getUserResponseShareCreator.User.Id,
Grantee: &providerv1beta1.Grantee{
Type: providerv1beta1.GranteeType_GRANTEE_TYPE_GROUP,
Id: &providerv1beta1.Grantee_GroupId{
GroupId: &groupv1beta1.GroupId{
OpaqueId: "group-id",
},
},
},
},
}
listReceivedSharesResponse.Shares = append(listReceivedSharesResponse.Shares, anotherShare)
svc.ListSharedWithMe(
tape,
httptest.NewRequest(http.MethodGet, "/graph/v1beta1/me/drive/sharedWithMe", nil),
)
driveItems := libregraph.CollectionOfDriveItems{}
err := json.Unmarshal(tape.Body.Bytes(), &driveItems)
Expect(err).To(BeNil())
Expect(len(driveItems.Value)).To(Equal(1))
ri := driveItems.GetValue()[0].GetRemoteItem()
Expect(len(ri.GetPermissions())).To(Equal(2))
})
})
})
+3 -2
View File
@@ -28,6 +28,7 @@ import (
"github.com/owncloud/ocis/v2/ocis-pkg/shared"
settingsmsg "github.com/owncloud/ocis/v2/protogen/gen/ocis/messages/settings/v0"
settings "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/settings/v0"
settingsmocks "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/settings/v0/mocks"
"github.com/owncloud/ocis/v2/services/graph/mocks"
"github.com/owncloud/ocis/v2/services/graph/pkg/config"
"github.com/owncloud/ocis/v2/services/graph/pkg/config/defaults"
@@ -48,7 +49,7 @@ var _ = Describe("Users", func() {
gatewaySelector pool.Selectable[gateway.GatewayAPIClient]
eventsPublisher mocks.Publisher
roleService *mocks.RoleService
valueService *mocks.ValueService
valueService *settingsmocks.ValueService
permissionService *mocks.Permissions
identityBackend *identitymocks.Backend
@@ -76,7 +77,7 @@ var _ = Describe("Users", func() {
identityBackend = &identitymocks.Backend{}
roleService = &mocks.RoleService{}
valueService = &mocks.ValueService{}
valueService = &settingsmocks.ValueService{}
permissionService = &mocks.Permissions{}
rr = httptest.NewRecorder()
+2 -1
View File
@@ -54,7 +54,8 @@ type Ldap struct {
// Asset defines the available asset configuration.
type Asset struct {
Path string `yaml:"asset" env:"IDP_ASSET_PATH" desc:"Serve IDP assets from a path on the filesystem instead of the builtin assets."`
Path string `yaml:"asset" env:"IDP_ASSET_PATH" desc:"Serve IDP assets from a path on the filesystem instead of the builtin assets."`
LoginBackgroundUrl string `yaml:"login-background-url" env:"IDP_LOGIN_BACKGROUND_URL" desc:"Configure an alternative URL to the background image for the login page."`
}
type Client struct {
+4 -1
View File
@@ -276,7 +276,7 @@ func (idp IDP) ServeHTTP(w http.ResponseWriter, r *http.Request) {
idp.mux.ServeHTTP(w, r)
}
// Index renders the static html with the
// Index renders the static html with templated variables.
func (idp IDP) Index() http.HandlerFunc {
f, err := idp.assets.Open("/identifier/index.html")
if err != nil {
@@ -295,6 +295,9 @@ func (idp IDP) Index() http.HandlerFunc {
pp := "/signin/v1"
indexHTML := bytes.Replace(template, []byte("__PATH_PREFIX__"), []byte(pp), 1)
background := idp.config.Asset.LoginBackgroundUrl
indexHTML = bytes.Replace(template, []byte("__BG_IMG_URL__"), []byte(background), 1)
nonce := rndm.GenerateRandomString(32)
indexHTML = bytes.Replace(indexHTML, []byte("__CSP_NONCE__"), []byte(nonce), 1)
+1 -1
View File
@@ -12,6 +12,6 @@
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<main id="root" class="oc-login-bg" data-path-prefix="__PATH_PREFIX__" passwort-reset-link="__PASSWORD_RESET_LINK__"></main>
<main id="root" data-path-prefix="__PATH_PREFIX__" passwort-reset-link="__PASSWORD_RESET_LINK__" data-bg-img="__BG_IMG_URL__"></main>
</body>
</html>
+16 -6
View File
@@ -1,4 +1,5 @@
import React, { ReactElement, Suspense, lazy } from 'react';
import PropTypes from 'prop-types';
import { MuiThemeProvider } from '@material-ui/core/styles';
import { defaultTheme as theme } from 'kpop/es/theme';
@@ -13,14 +14,23 @@ const LazyMain = lazy(() => import(/* webpackChunkName: "identifier-main" */ './
console.info(`Kopano Identifier build version: ${version.build}`); // eslint-disable-line no-console
const App = (): ReactElement => {
const App = ({ bgImg }): ReactElement => {
return (
<MuiThemeProvider theme={theme}>
<Suspense fallback={<Spinner/>}>
<LazyMain />
</Suspense>
</MuiThemeProvider>
<div
className='oc-login-bg'
style={{ backgroundImage: bgImg ? `url(${bgImg})` : undefined }}
>
<MuiThemeProvider theme={theme}>
<Suspense fallback={<Spinner/>}>
<LazyMain/>
</Suspense>
</MuiThemeProvider>
</div>
);
}
App.propTypes = {
bgImg: PropTypes.string
};
export default App;
+2
View File
@@ -24,6 +24,8 @@ strong {
background-repeat: no-repeat;
background-position: center;
z-index: 0;
display: flex;
width: 100%;
}
#loader {
+7 -2
View File
@@ -9,11 +9,16 @@ import store from './store';
import './app.css';
const root = document.getElementById('root')
// if a custom background image has been configured, make use of it
const bgImg = root.getAttribute('data-bg-img')
ReactDOM.render(
<React.StrictMode>
<Provider store={store as any}>
<App/>
<App bgImg={bgImg}/>
</Provider>
</React.StrictMode>,
document.getElementById('root')
root
);
+10
View File
@@ -0,0 +1,10 @@
with-expecter: true
filename: "{{.InterfaceName | snakecase }}.go"
mockname: "{{.InterfaceName}}"
outpkg: "mocks"
packages:
github.com/owncloud/ocis/v2/ocis-pkg/keycloak:
config:
dir: "pkg/backends/keycloak/mocks"
interfaces:
Client:
+1 -2
View File
@@ -25,8 +25,7 @@ include ../../.make/generate.mk
.PHONY: ci-go-generate
ci-go-generate: $(MOCKERY) # CI runs ci-node-generate automatically before this target
$(MOCKERY) --output pkg/mocks --case underscore --name Client --srcpkg "github.com/owncloud/ocis/v2/ocis-pkg/keycloak"
$(MOCKERY)
.PHONY: ci-node-generate
ci-node-generate:
@@ -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"
)
@@ -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
@@ -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
}
-122
View File
@@ -1,122 +0,0 @@
// Code generated by mockery v2.22.1. DO NOT EDIT.
package mocks
import (
context "context"
libregraph "github.com/owncloud/libre-graph-api-go"
keycloak "github.com/owncloud/ocis/v2/ocis-pkg/keycloak"
mock "github.com/stretchr/testify/mock"
)
// Client is an autogenerated mock type for the Client type
type Client struct {
mock.Mock
}
// CreateUser provides a mock function with given fields: ctx, realm, user, userActions
func (_m *Client) CreateUser(ctx context.Context, realm string, user *libregraph.User, userActions []keycloak.UserAction) (string, error) {
ret := _m.Called(ctx, realm, user, userActions)
var r0 string
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, *libregraph.User, []keycloak.UserAction) (string, error)); ok {
return rf(ctx, realm, user, userActions)
}
if rf, ok := ret.Get(0).(func(context.Context, string, *libregraph.User, []keycloak.UserAction) string); ok {
r0 = rf(ctx, realm, user, userActions)
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func(context.Context, string, *libregraph.User, []keycloak.UserAction) error); ok {
r1 = rf(ctx, realm, user, userActions)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetPIIReport provides a mock function with given fields: ctx, realm, username
func (_m *Client) GetPIIReport(ctx context.Context, realm string, username string) (*keycloak.PIIReport, error) {
ret := _m.Called(ctx, realm, username)
var r0 *keycloak.PIIReport
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, string) (*keycloak.PIIReport, error)); ok {
return rf(ctx, realm, username)
}
if rf, ok := ret.Get(0).(func(context.Context, string, string) *keycloak.PIIReport); ok {
r0 = rf(ctx, realm, username)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*keycloak.PIIReport)
}
}
if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok {
r1 = rf(ctx, realm, username)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetUserByUsername provides a mock function with given fields: ctx, realm, username
func (_m *Client) GetUserByUsername(ctx context.Context, realm string, username string) (*libregraph.User, error) {
ret := _m.Called(ctx, realm, username)
var r0 *libregraph.User
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, string) (*libregraph.User, error)); ok {
return rf(ctx, realm, username)
}
if rf, ok := ret.Get(0).(func(context.Context, string, string) *libregraph.User); ok {
r0 = rf(ctx, realm, username)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*libregraph.User)
}
}
if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok {
r1 = rf(ctx, realm, username)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SendActionsMail provides a mock function with given fields: ctx, realm, userID, userActions
func (_m *Client) SendActionsMail(ctx context.Context, realm string, userID string, userActions []keycloak.UserAction) error {
ret := _m.Called(ctx, realm, userID, userActions)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, string, []keycloak.UserAction) error); ok {
r0 = rf(ctx, realm, userID, userActions)
} else {
r0 = ret.Error(0)
}
return r0
}
type mockConstructorTestingTNewClient interface {
mock.TestingT
Cleanup(func())
}
// NewClient creates a new instance of Client. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewClient(t mockConstructorTestingTNewClient) *Client {
mock := &Client{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
@@ -11,7 +11,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: EMAIL\n"
"POT-Creation-Date: 2024-01-09 00:38+0000\n"
"POT-Creation-Date: 2024-01-30 00:34+0000\n"
"PO-Revision-Date: 2023-04-19 11:11+0000\n"
"Last-Translator: Arnau Morancho, 2023\n"
"Language-Team: Catalan (https://app.transifex.com/owncloud-org/teams/6149/ca/)\n"
@@ -11,7 +11,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: EMAIL\n"
"POT-Creation-Date: 2024-01-09 00:38+0000\n"
"POT-Creation-Date: 2024-01-30 00:34+0000\n"
"PO-Revision-Date: 2023-04-19 11:11+0000\n"
"Last-Translator: Andi Chandler <andi@gowling.com>, 2023\n"
"Language-Team: English (United Kingdom) (https://app.transifex.com/owncloud-org/teams/6149/en_GB/)\n"
@@ -11,7 +11,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: EMAIL\n"
"POT-Creation-Date: 2024-01-09 00:38+0000\n"
"POT-Creation-Date: 2024-01-30 00:34+0000\n"
"PO-Revision-Date: 2023-04-19 11:11+0000\n"
"Last-Translator: Juan Carlos Garrote, 2023\n"
"Language-Team: Spanish (https://app.transifex.com/owncloud-org/teams/6149/es/)\n"
@@ -11,7 +11,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: EMAIL\n"
"POT-Creation-Date: 2024-01-09 00:38+0000\n"
"POT-Creation-Date: 2024-01-30 00:34+0000\n"
"PO-Revision-Date: 2023-04-19 11:11+0000\n"
"Last-Translator: Hugo Blackwood, 2023\n"
"Language-Team: Korean (https://app.transifex.com/owncloud-org/teams/6149/ko/)\n"
@@ -11,7 +11,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: EMAIL\n"
"POT-Creation-Date: 2024-01-09 00:38+0000\n"
"POT-Creation-Date: 2024-01-30 00:34+0000\n"
"PO-Revision-Date: 2023-04-19 11:11+0000\n"
"Last-Translator: Flávio Veras <flaviove@gmail.com>, 2023\n"
"Language-Team: Portuguese (Brazil) (https://app.transifex.com/owncloud-org/teams/6149/pt_BR/)\n"
@@ -11,7 +11,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: EMAIL\n"
"POT-Creation-Date: 2024-01-09 00:38+0000\n"
"POT-Creation-Date: 2024-01-30 00:34+0000\n"
"PO-Revision-Date: 2023-04-19 11:11+0000\n"
"Last-Translator: Roman Perekhod, 2023\n"
"Language-Team: Russian (https://app.transifex.com/owncloud-org/teams/6149/ru/)\n"
@@ -4,16 +4,16 @@
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Translators:
# Besnik Bleta <besnik@programeshqip.org>, 2023
# Besnik Bleta <besnik@programeshqip.org>, 2024
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: EMAIL\n"
"POT-Creation-Date: 2024-01-09 00:38+0000\n"
"POT-Creation-Date: 2024-02-02 01:09+0000\n"
"PO-Revision-Date: 2023-04-19 11:11+0000\n"
"Last-Translator: Besnik Bleta <besnik@programeshqip.org>, 2023\n"
"Last-Translator: Besnik Bleta <besnik@programeshqip.org>, 2024\n"
"Language-Team: Albanian (https://app.transifex.com/owncloud-org/teams/6149/sq/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -53,7 +53,7 @@ msgstr "Tungjatjeta {SpaceGrantee},"
#. MembershipExpired email template, Subject field (resolves directly)
#: pkg/email/templates.go:68
msgid "Membership of '{SpaceName}' expired at {ExpiredAt}"
msgstr "Anëtarësia në '{SpaceName}' skadoi më {ExpiredAt}"
msgstr "Anëtarësia në {SpaceName} skadoi më {ExpiredAt}"
#. ShareExpired email template, Subject field (resolves directly)
#: pkg/email/templates.go:26
@@ -67,7 +67,7 @@ msgid ""
"\n"
"Even though this membership has expired you still might have access through other shares and/or space memberships"
msgstr ""
"Anëtarësia juaj në pjesën {SpaceName} ka skaduar më {ExpiredAt}\n"
"Anëtarësia juaj në hapësirën {SpaceName} ka skaduar më {ExpiredAt}\n"
"\n"
"Edhe pse kjo anëtarësi ka skaduar, mundet që ende të keni hyrje në të përmes ndarjesh dhe/ose anëtarësish hapësirash të tjera"
@@ -78,7 +78,7 @@ msgid ""
"\n"
"Even though this share has been revoked you still might have access through other shares and/or space memberships."
msgstr ""
"Ndarja juaj te {ShareFolder} ka skaduar më {ExpiredAt}\n"
"Pjesa juaj te {ShareFolder} ka skaduar më {ExpiredAt}\n"
"\n"
"Edhe pse kjo pjesë është shfuqizuar, mundet që ende të keni hyrje në të përmes ndarjesh dhe/ose anëtarësish hapësirash të tjera."
+15
View File
@@ -0,0 +1,15 @@
with-expecter: true
filename: "{{.InterfaceName | snakecase }}.go"
mockname: "{{.InterfaceName}}"
outpkg: "mocks"
packages:
github.com/owncloud/ocis/v2/services/proxy/pkg/user/backend:
config:
dir: "pkg/user/backend/mocks"
interfaces:
UserBackend:
github.com/owncloud/ocis/v2/services/proxy/pkg/userroles:
config:
dir: "pkg/userroles/mocks"
interfaces:
UserRoleAssigner:
+1 -1
View File
@@ -25,7 +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 ../../protogen/gen/ocis/services/policies/v0 --case underscore --name PoliciesProviderService
$(MOCKERY)
.PHONY: ci-node-generate
ci-node-generate:
@@ -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
}
+21 -1
View File
@@ -7,9 +7,9 @@ import (
"strings"
"time"
"github.com/golang-jwt/jwt/v4"
"github.com/owncloud/ocis/v2/ocis-pkg/log"
"github.com/owncloud/ocis/v2/ocis-pkg/oidc"
"github.com/pkg/errors"
"github.com/shamaton/msgpack/v2"
store "go-micro.dev/v4/store"
@@ -35,6 +35,7 @@ func NewOIDCAuthenticator(opts ...Option) *OIDCAuthenticator {
oidcClient: options.OIDCClient,
AccessTokenVerifyMethod: options.AccessTokenVerifyMethod,
skipUserInfo: options.SkipUserInfo,
TimeFunc: time.Now,
}
}
@@ -48,6 +49,7 @@ type OIDCAuthenticator struct {
oidcClient oidc.OIDCClient
AccessTokenVerifyMethod string
skipUserInfo bool
TimeFunc func() time.Time
}
func (m *OIDCAuthenticator) getClaims(token string, req *http.Request) (map[string]interface{}, error) {
@@ -65,6 +67,9 @@ func (m *OIDCAuthenticator) getClaims(token string, req *http.Request) (map[stri
if len(record) > 0 {
if err = msgpack.UnmarshalAsMap(record[0].Value, &claims); err == nil {
m.Logger.Debug().Interface("claims", claims).Msg("cache hit for userinfo")
if ok := verifyExpiresAt(claims, m.TimeFunc()); !ok {
return nil, jwt.ErrTokenExpired
}
return claims, nil
}
m.Logger.Error().Err(err).Msg("could not unmarshal userinfo")
@@ -93,6 +98,8 @@ func (m *OIDCAuthenticator) getClaims(token string, req *http.Request) (map[stri
}
expiration := m.extractExpiration(aClaims)
// always set an exp claim
claims["exp"] = expiration.Unix()
go func() {
if d, err := msgpack.MarshalAsMap(claims); err != nil {
m.Logger.Error().Err(err).Msg("failed to marshal claims for userinfo cache")
@@ -136,6 +143,19 @@ func (m OIDCAuthenticator) extractExpiration(aClaims oidc.RegClaimsWithSID) time
return defaultExpiration
}
func verifyExpiresAt(claims map[string]interface{}, cmp time.Time) bool {
var expiry time.Time
switch v := claims["exp"].(type) {
case nil:
return false
case int64:
expiry = time.Unix(v, 0)
case uint32:
expiry = time.Unix(int64(v), 0)
}
return cmp.Before(expiry)
}
func (m OIDCAuthenticator) shouldServe(req *http.Request) bool {
if m.OIDCIss == "" {
return false
@@ -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())
})
})
})
+1 -1
View File
@@ -39,7 +39,7 @@ type Options struct {
SettingsRoleService settingssvc.RoleService
// PoliciesProviderService for policy evaluation
PoliciesProviderService policiessvc.PoliciesProviderService
// OIDCProviderFunc to lazily initialize an oidc provider, must be set for the oidc_auth middleware
// OIDCClient to fetch user info and verify tokens, must be set for the oidc_auth middleware
OIDCClient oidc.OIDCClient
// OIDCIss is the oidcAuth-issuer
OIDCIss string
@@ -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) {
@@ -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)
@@ -1,113 +0,0 @@
// Code generated by mockery v2.14.0. DO NOT EDIT.
package mocks
import (
context "context"
userv1beta1 "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
mock "github.com/stretchr/testify/mock"
)
// UserBackend is an autogenerated mock type for the UserBackend type
type UserBackend struct {
mock.Mock
}
// Authenticate provides a mock function with given fields: ctx, username, password
func (_m *UserBackend) Authenticate(ctx context.Context, username string, password string) (*userv1beta1.User, string, error) {
ret := _m.Called(ctx, username, password)
var r0 *userv1beta1.User
if rf, ok := ret.Get(0).(func(context.Context, string, string) *userv1beta1.User); ok {
r0 = rf(ctx, username, password)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*userv1beta1.User)
}
}
var r1 string
if rf, ok := ret.Get(1).(func(context.Context, string, string) string); ok {
r1 = rf(ctx, username, password)
} else {
r1 = ret.Get(1).(string)
}
var r2 error
if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok {
r2 = rf(ctx, username, password)
} else {
r2 = ret.Error(2)
}
return r0, r1, r2
}
// CreateUserFromClaims provides a mock function with given fields: ctx, claims
func (_m *UserBackend) CreateUserFromClaims(ctx context.Context, claims map[string]interface{}) (*userv1beta1.User, error) {
ret := _m.Called(ctx, claims)
var r0 *userv1beta1.User
if rf, ok := ret.Get(0).(func(context.Context, map[string]interface{}) *userv1beta1.User); ok {
r0 = rf(ctx, claims)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*userv1beta1.User)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, map[string]interface{}) error); ok {
r1 = rf(ctx, claims)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetUserByClaims provides a mock function with given fields: ctx, claim, value
func (_m *UserBackend) GetUserByClaims(ctx context.Context, claim string, value string) (*userv1beta1.User, string, error) {
ret := _m.Called(ctx, claim, value)
var r0 *userv1beta1.User
if rf, ok := ret.Get(0).(func(context.Context, string, string) *userv1beta1.User); ok {
r0 = rf(ctx, claim, value)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*userv1beta1.User)
}
}
var r1 string
if rf, ok := ret.Get(1).(func(context.Context, string, string) string); ok {
r1 = rf(ctx, claim, value)
} else {
r1 = ret.Get(1).(string)
}
var r2 error
if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok {
r2 = rf(ctx, claim, value)
} else {
r2 = ret.Error(2)
}
return r0, r1, r2
}
type mockConstructorTestingTNewUserBackend interface {
mock.TestingT
Cleanup(func())
}
// NewUserBackend creates a new instance of UserBackend. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewUserBackend(t mockConstructorTestingTNewUserBackend) *UserBackend {
mock := &UserBackend{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
@@ -0,0 +1,230 @@
// Code generated by mockery v2.40.1. DO NOT EDIT.
package mocks
import (
context "context"
userv1beta1 "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
mock "github.com/stretchr/testify/mock"
)
// UserBackend is an autogenerated mock type for the UserBackend type
type UserBackend struct {
mock.Mock
}
type UserBackend_Expecter struct {
mock *mock.Mock
}
func (_m *UserBackend) EXPECT() *UserBackend_Expecter {
return &UserBackend_Expecter{mock: &_m.Mock}
}
// Authenticate provides a mock function with given fields: ctx, username, password
func (_m *UserBackend) Authenticate(ctx context.Context, username string, password string) (*userv1beta1.User, string, error) {
ret := _m.Called(ctx, username, password)
if len(ret) == 0 {
panic("no return value specified for Authenticate")
}
var r0 *userv1beta1.User
var r1 string
var r2 error
if rf, ok := ret.Get(0).(func(context.Context, string, string) (*userv1beta1.User, string, error)); ok {
return rf(ctx, username, password)
}
if rf, ok := ret.Get(0).(func(context.Context, string, string) *userv1beta1.User); ok {
r0 = rf(ctx, username, password)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*userv1beta1.User)
}
}
if rf, ok := ret.Get(1).(func(context.Context, string, string) string); ok {
r1 = rf(ctx, username, password)
} else {
r1 = ret.Get(1).(string)
}
if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok {
r2 = rf(ctx, username, password)
} else {
r2 = ret.Error(2)
}
return r0, r1, r2
}
// UserBackend_Authenticate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Authenticate'
type UserBackend_Authenticate_Call struct {
*mock.Call
}
// Authenticate is a helper method to define mock.On call
// - ctx context.Context
// - username string
// - password string
func (_e *UserBackend_Expecter) Authenticate(ctx interface{}, username interface{}, password interface{}) *UserBackend_Authenticate_Call {
return &UserBackend_Authenticate_Call{Call: _e.mock.On("Authenticate", ctx, username, password)}
}
func (_c *UserBackend_Authenticate_Call) Run(run func(ctx context.Context, username string, password string)) *UserBackend_Authenticate_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string))
})
return _c
}
func (_c *UserBackend_Authenticate_Call) Return(_a0 *userv1beta1.User, _a1 string, _a2 error) *UserBackend_Authenticate_Call {
_c.Call.Return(_a0, _a1, _a2)
return _c
}
func (_c *UserBackend_Authenticate_Call) RunAndReturn(run func(context.Context, string, string) (*userv1beta1.User, string, error)) *UserBackend_Authenticate_Call {
_c.Call.Return(run)
return _c
}
// CreateUserFromClaims provides a mock function with given fields: ctx, claims
func (_m *UserBackend) CreateUserFromClaims(ctx context.Context, claims map[string]interface{}) (*userv1beta1.User, error) {
ret := _m.Called(ctx, claims)
if len(ret) == 0 {
panic("no return value specified for CreateUserFromClaims")
}
var r0 *userv1beta1.User
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, map[string]interface{}) (*userv1beta1.User, error)); ok {
return rf(ctx, claims)
}
if rf, ok := ret.Get(0).(func(context.Context, map[string]interface{}) *userv1beta1.User); ok {
r0 = rf(ctx, claims)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*userv1beta1.User)
}
}
if rf, ok := ret.Get(1).(func(context.Context, map[string]interface{}) error); ok {
r1 = rf(ctx, claims)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// UserBackend_CreateUserFromClaims_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateUserFromClaims'
type UserBackend_CreateUserFromClaims_Call struct {
*mock.Call
}
// CreateUserFromClaims is a helper method to define mock.On call
// - ctx context.Context
// - claims map[string]interface{}
func (_e *UserBackend_Expecter) CreateUserFromClaims(ctx interface{}, claims interface{}) *UserBackend_CreateUserFromClaims_Call {
return &UserBackend_CreateUserFromClaims_Call{Call: _e.mock.On("CreateUserFromClaims", ctx, claims)}
}
func (_c *UserBackend_CreateUserFromClaims_Call) Run(run func(ctx context.Context, claims map[string]interface{})) *UserBackend_CreateUserFromClaims_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(map[string]interface{}))
})
return _c
}
func (_c *UserBackend_CreateUserFromClaims_Call) Return(_a0 *userv1beta1.User, _a1 error) *UserBackend_CreateUserFromClaims_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *UserBackend_CreateUserFromClaims_Call) RunAndReturn(run func(context.Context, map[string]interface{}) (*userv1beta1.User, error)) *UserBackend_CreateUserFromClaims_Call {
_c.Call.Return(run)
return _c
}
// GetUserByClaims provides a mock function with given fields: ctx, claim, value
func (_m *UserBackend) GetUserByClaims(ctx context.Context, claim string, value string) (*userv1beta1.User, string, error) {
ret := _m.Called(ctx, claim, value)
if len(ret) == 0 {
panic("no return value specified for GetUserByClaims")
}
var r0 *userv1beta1.User
var r1 string
var r2 error
if rf, ok := ret.Get(0).(func(context.Context, string, string) (*userv1beta1.User, string, error)); ok {
return rf(ctx, claim, value)
}
if rf, ok := ret.Get(0).(func(context.Context, string, string) *userv1beta1.User); ok {
r0 = rf(ctx, claim, value)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*userv1beta1.User)
}
}
if rf, ok := ret.Get(1).(func(context.Context, string, string) string); ok {
r1 = rf(ctx, claim, value)
} else {
r1 = ret.Get(1).(string)
}
if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok {
r2 = rf(ctx, claim, value)
} else {
r2 = ret.Error(2)
}
return r0, r1, r2
}
// UserBackend_GetUserByClaims_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetUserByClaims'
type UserBackend_GetUserByClaims_Call struct {
*mock.Call
}
// GetUserByClaims is a helper method to define mock.On call
// - ctx context.Context
// - claim string
// - value string
func (_e *UserBackend_Expecter) GetUserByClaims(ctx interface{}, claim interface{}, value interface{}) *UserBackend_GetUserByClaims_Call {
return &UserBackend_GetUserByClaims_Call{Call: _e.mock.On("GetUserByClaims", ctx, claim, value)}
}
func (_c *UserBackend_GetUserByClaims_Call) Run(run func(ctx context.Context, claim string, value string)) *UserBackend_GetUserByClaims_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string))
})
return _c
}
func (_c *UserBackend_GetUserByClaims_Call) Return(_a0 *userv1beta1.User, _a1 string, _a2 error) *UserBackend_GetUserByClaims_Call {
_c.Call.Return(_a0, _a1, _a2)
return _c
}
func (_c *UserBackend_GetUserByClaims_Call) RunAndReturn(run func(context.Context, string, string) (*userv1beta1.User, string, error)) *UserBackend_GetUserByClaims_Call {
_c.Call.Return(run)
return _c
}
// NewUserBackend creates a new instance of UserBackend. 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 NewUserBackend(t interface {
mock.TestingT
Cleanup(func())
}) *UserBackend {
mock := &UserBackend{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
@@ -1,77 +0,0 @@
// Code generated by mockery v2.14.0. DO NOT EDIT.
package mocks
import (
context "context"
mock "github.com/stretchr/testify/mock"
userv1beta1 "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
)
// UserRoleAssigner is an autogenerated mock type for the UserRoleAssigner type
type UserRoleAssigner struct {
mock.Mock
}
// ApplyUserRole provides a mock function with given fields: ctx, user
func (_m *UserRoleAssigner) ApplyUserRole(ctx context.Context, user *userv1beta1.User) (*userv1beta1.User, error) {
ret := _m.Called(ctx, user)
var r0 *userv1beta1.User
if rf, ok := ret.Get(0).(func(context.Context, *userv1beta1.User) *userv1beta1.User); ok {
r0 = rf(ctx, user)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*userv1beta1.User)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *userv1beta1.User) error); ok {
r1 = rf(ctx, user)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// UpdateUserRoleAssignment provides a mock function with given fields: ctx, user, claims
func (_m *UserRoleAssigner) UpdateUserRoleAssignment(ctx context.Context, user *userv1beta1.User, claims map[string]interface{}) (*userv1beta1.User, error) {
ret := _m.Called(ctx, user, claims)
var r0 *userv1beta1.User
if rf, ok := ret.Get(0).(func(context.Context, *userv1beta1.User, map[string]interface{}) *userv1beta1.User); ok {
r0 = rf(ctx, user, claims)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*userv1beta1.User)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *userv1beta1.User, map[string]interface{}) error); ok {
r1 = rf(ctx, user, claims)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
type mockConstructorTestingTNewUserRoleAssigner interface {
mock.TestingT
Cleanup(func())
}
// NewUserRoleAssigner creates a new instance of UserRoleAssigner. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewUserRoleAssigner(t mockConstructorTestingTNewUserRoleAssigner) *UserRoleAssigner {
mock := &UserRoleAssigner{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
@@ -0,0 +1,157 @@
// Code generated by mockery v2.40.1. DO NOT EDIT.
package mocks
import (
context "context"
mock "github.com/stretchr/testify/mock"
userv1beta1 "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
)
// UserRoleAssigner is an autogenerated mock type for the UserRoleAssigner type
type UserRoleAssigner struct {
mock.Mock
}
type UserRoleAssigner_Expecter struct {
mock *mock.Mock
}
func (_m *UserRoleAssigner) EXPECT() *UserRoleAssigner_Expecter {
return &UserRoleAssigner_Expecter{mock: &_m.Mock}
}
// ApplyUserRole provides a mock function with given fields: ctx, user
func (_m *UserRoleAssigner) ApplyUserRole(ctx context.Context, user *userv1beta1.User) (*userv1beta1.User, error) {
ret := _m.Called(ctx, user)
if len(ret) == 0 {
panic("no return value specified for ApplyUserRole")
}
var r0 *userv1beta1.User
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *userv1beta1.User) (*userv1beta1.User, error)); ok {
return rf(ctx, user)
}
if rf, ok := ret.Get(0).(func(context.Context, *userv1beta1.User) *userv1beta1.User); ok {
r0 = rf(ctx, user)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*userv1beta1.User)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *userv1beta1.User) error); ok {
r1 = rf(ctx, user)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// UserRoleAssigner_ApplyUserRole_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ApplyUserRole'
type UserRoleAssigner_ApplyUserRole_Call struct {
*mock.Call
}
// ApplyUserRole is a helper method to define mock.On call
// - ctx context.Context
// - user *userv1beta1.User
func (_e *UserRoleAssigner_Expecter) ApplyUserRole(ctx interface{}, user interface{}) *UserRoleAssigner_ApplyUserRole_Call {
return &UserRoleAssigner_ApplyUserRole_Call{Call: _e.mock.On("ApplyUserRole", ctx, user)}
}
func (_c *UserRoleAssigner_ApplyUserRole_Call) Run(run func(ctx context.Context, user *userv1beta1.User)) *UserRoleAssigner_ApplyUserRole_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*userv1beta1.User))
})
return _c
}
func (_c *UserRoleAssigner_ApplyUserRole_Call) Return(_a0 *userv1beta1.User, _a1 error) *UserRoleAssigner_ApplyUserRole_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *UserRoleAssigner_ApplyUserRole_Call) RunAndReturn(run func(context.Context, *userv1beta1.User) (*userv1beta1.User, error)) *UserRoleAssigner_ApplyUserRole_Call {
_c.Call.Return(run)
return _c
}
// UpdateUserRoleAssignment provides a mock function with given fields: ctx, user, claims
func (_m *UserRoleAssigner) UpdateUserRoleAssignment(ctx context.Context, user *userv1beta1.User, claims map[string]interface{}) (*userv1beta1.User, error) {
ret := _m.Called(ctx, user, claims)
if len(ret) == 0 {
panic("no return value specified for UpdateUserRoleAssignment")
}
var r0 *userv1beta1.User
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *userv1beta1.User, map[string]interface{}) (*userv1beta1.User, error)); ok {
return rf(ctx, user, claims)
}
if rf, ok := ret.Get(0).(func(context.Context, *userv1beta1.User, map[string]interface{}) *userv1beta1.User); ok {
r0 = rf(ctx, user, claims)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*userv1beta1.User)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *userv1beta1.User, map[string]interface{}) error); ok {
r1 = rf(ctx, user, claims)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// UserRoleAssigner_UpdateUserRoleAssignment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUserRoleAssignment'
type UserRoleAssigner_UpdateUserRoleAssignment_Call struct {
*mock.Call
}
// UpdateUserRoleAssignment is a helper method to define mock.On call
// - ctx context.Context
// - user *userv1beta1.User
// - claims map[string]interface{}
func (_e *UserRoleAssigner_Expecter) UpdateUserRoleAssignment(ctx interface{}, user interface{}, claims interface{}) *UserRoleAssigner_UpdateUserRoleAssignment_Call {
return &UserRoleAssigner_UpdateUserRoleAssignment_Call{Call: _e.mock.On("UpdateUserRoleAssignment", ctx, user, claims)}
}
func (_c *UserRoleAssigner_UpdateUserRoleAssignment_Call) Run(run func(ctx context.Context, user *userv1beta1.User, claims map[string]interface{})) *UserRoleAssigner_UpdateUserRoleAssignment_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*userv1beta1.User), args[2].(map[string]interface{}))
})
return _c
}
func (_c *UserRoleAssigner_UpdateUserRoleAssignment_Call) Return(_a0 *userv1beta1.User, _a1 error) *UserRoleAssigner_UpdateUserRoleAssignment_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *UserRoleAssigner_UpdateUserRoleAssignment_Call) RunAndReturn(run func(context.Context, *userv1beta1.User, map[string]interface{}) (*userv1beta1.User, error)) *UserRoleAssigner_UpdateUserRoleAssignment_Call {
_c.Call.Return(run)
return _c
}
// NewUserRoleAssigner creates a new instance of UserRoleAssigner. 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 NewUserRoleAssigner(t interface {
mock.TestingT
Cleanup(func())
}) *UserRoleAssigner {
mock := &UserRoleAssigner{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
@@ -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 {
+16
View File
@@ -0,0 +1,16 @@
with-expecter: true
filename: "{{.InterfaceName | snakecase }}.go"
dir: "pkg/{{.PackageName}}/mocks"
mockname: "{{.InterfaceName}}"
outpkg: "mocks"
packages:
github.com/owncloud/ocis/v2/services/search/pkg/engine:
interfaces:
Engine:
github.com/owncloud/ocis/v2/services/search/pkg/content:
interfaces:
Extractor:
Retriever:
github.com/owncloud/ocis/v2/services/search/pkg/search:
interfaces:
Searcher:
+1 -4
View File
@@ -25,10 +25,7 @@ include ../../.make/generate.mk
.PHONY: ci-go-generate
ci-go-generate: $(PIGEON) $(MOCKERY) # CI runs ci-node-generate automatically before this target
$(MOCKERY) --dir pkg/engine --output pkg/engine/mocks --case underscore --name Engine
$(MOCKERY) --dir pkg/content --output pkg/content/mocks --case underscore --name Extractor
$(MOCKERY) --dir pkg/content --output pkg/content/mocks --case underscore --name Retriever
$(MOCKERY) --dir pkg/search --output pkg/search/mocks --case underscore --name Searcher
$(MOCKERY)
$(PIGEON) -optimize-grammar -optimize-parser -o pkg/query/kql/dictionary_gen.go pkg/query/kql/dictionary.peg
.PHONY: ci-node-generate
-2
View File
@@ -9,8 +9,6 @@ import (
)
// Extractor is responsible to extract content and meta information from documents.
//
//go:generate mockery --name=Extractor
type Extractor interface {
Extract(ctx context.Context, ri *provider.ResourceInfo) (Document, error)
}
+45 -5
View File
@@ -1,4 +1,4 @@
// Code generated by mockery v2.22.1. DO NOT EDIT.
// Code generated by mockery v2.40.1. DO NOT EDIT.
package mocks
@@ -17,10 +17,22 @@ type Extractor struct {
mock.Mock
}
type Extractor_Expecter struct {
mock *mock.Mock
}
func (_m *Extractor) EXPECT() *Extractor_Expecter {
return &Extractor_Expecter{mock: &_m.Mock}
}
// Extract provides a mock function with given fields: ctx, ri
func (_m *Extractor) Extract(ctx context.Context, ri *providerv1beta1.ResourceInfo) (content.Document, error) {
ret := _m.Called(ctx, ri)
if len(ret) == 0 {
panic("no return value specified for Extract")
}
var r0 content.Document
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.ResourceInfo) (content.Document, error)); ok {
@@ -41,13 +53,41 @@ func (_m *Extractor) Extract(ctx context.Context, ri *providerv1beta1.ResourceIn
return r0, r1
}
type mockConstructorTestingTNewExtractor interface {
mock.TestingT
Cleanup(func())
// Extractor_Extract_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Extract'
type Extractor_Extract_Call struct {
*mock.Call
}
// Extract is a helper method to define mock.On call
// - ctx context.Context
// - ri *providerv1beta1.ResourceInfo
func (_e *Extractor_Expecter) Extract(ctx interface{}, ri interface{}) *Extractor_Extract_Call {
return &Extractor_Extract_Call{Call: _e.mock.On("Extract", ctx, ri)}
}
func (_c *Extractor_Extract_Call) Run(run func(ctx context.Context, ri *providerv1beta1.ResourceInfo)) *Extractor_Extract_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*providerv1beta1.ResourceInfo))
})
return _c
}
func (_c *Extractor_Extract_Call) Return(_a0 content.Document, _a1 error) *Extractor_Extract_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Extractor_Extract_Call) RunAndReturn(run func(context.Context, *providerv1beta1.ResourceInfo) (content.Document, error)) *Extractor_Extract_Call {
_c.Call.Return(run)
return _c
}
// NewExtractor creates a new instance of Extractor. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewExtractor(t mockConstructorTestingTNewExtractor) *Extractor {
// The first argument is typically a *testing.T value.
func NewExtractor(t interface {
mock.TestingT
Cleanup(func())
}) *Extractor {
mock := &Extractor{}
mock.Mock.Test(t)
+45 -5
View File
@@ -1,4 +1,4 @@
// Code generated by mockery v2.22.1. DO NOT EDIT.
// Code generated by mockery v2.40.1. DO NOT EDIT.
package mocks
@@ -16,10 +16,22 @@ type Retriever struct {
mock.Mock
}
type Retriever_Expecter struct {
mock *mock.Mock
}
func (_m *Retriever) EXPECT() *Retriever_Expecter {
return &Retriever_Expecter{mock: &_m.Mock}
}
// Retrieve provides a mock function with given fields: ctx, rID
func (_m *Retriever) Retrieve(ctx context.Context, rID *providerv1beta1.ResourceId) (io.ReadCloser, error) {
ret := _m.Called(ctx, rID)
if len(ret) == 0 {
panic("no return value specified for Retrieve")
}
var r0 io.ReadCloser
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.ResourceId) (io.ReadCloser, error)); ok {
@@ -42,13 +54,41 @@ func (_m *Retriever) Retrieve(ctx context.Context, rID *providerv1beta1.Resource
return r0, r1
}
type mockConstructorTestingTNewRetriever interface {
mock.TestingT
Cleanup(func())
// Retriever_Retrieve_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Retrieve'
type Retriever_Retrieve_Call struct {
*mock.Call
}
// Retrieve is a helper method to define mock.On call
// - ctx context.Context
// - rID *providerv1beta1.ResourceId
func (_e *Retriever_Expecter) Retrieve(ctx interface{}, rID interface{}) *Retriever_Retrieve_Call {
return &Retriever_Retrieve_Call{Call: _e.mock.On("Retrieve", ctx, rID)}
}
func (_c *Retriever_Retrieve_Call) Run(run func(ctx context.Context, rID *providerv1beta1.ResourceId)) *Retriever_Retrieve_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*providerv1beta1.ResourceId))
})
return _c
}
func (_c *Retriever_Retrieve_Call) Return(_a0 io.ReadCloser, _a1 error) *Retriever_Retrieve_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Retriever_Retrieve_Call) RunAndReturn(run func(context.Context, *providerv1beta1.ResourceId) (io.ReadCloser, error)) *Retriever_Retrieve_Call {
_c.Call.Return(run)
return _c
}
// NewRetriever creates a new instance of Retriever. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewRetriever(t mockConstructorTestingTNewRetriever) *Retriever {
// The first argument is typically a *testing.T value.
func NewRetriever(t interface {
mock.TestingT
Cleanup(func())
}) *Retriever {
mock := &Retriever{}
mock.Mock.Test(t)
-2
View File
@@ -10,8 +10,6 @@ import (
// Retriever is the interface that wraps the basic Retrieve method. 🐕
// It requests and then returns a resource from the underlying storage.
//
//go:generate mockery --name=Retriever
type Retriever interface {
Retrieve(ctx context.Context, rID *provider.ResourceId) (io.ReadCloser, error)
}
-2
View File
@@ -14,8 +14,6 @@ import (
var queryEscape = regexp.MustCompile(`([` + regexp.QuoteMeta(`+=&|><!(){}[]^\"~*?:\/`) + `\-\s])`)
//go:generate mockery --name=Engine
// Engine is the interface to the search engine
type Engine interface {
Search(ctx context.Context, req *searchService.SearchIndexRequest) (*searchService.SearchIndexResponse, error)
+239 -5
View File
@@ -1,4 +1,4 @@
// Code generated by mockery v2.22.1. DO NOT EDIT.
// Code generated by mockery v2.40.1. DO NOT EDIT.
package mocks
@@ -16,10 +16,22 @@ type Engine struct {
mock.Mock
}
type Engine_Expecter struct {
mock *mock.Mock
}
func (_m *Engine) EXPECT() *Engine_Expecter {
return &Engine_Expecter{mock: &_m.Mock}
}
// Delete provides a mock function with given fields: id
func (_m *Engine) Delete(id string) error {
ret := _m.Called(id)
if len(ret) == 0 {
panic("no return value specified for Delete")
}
var r0 error
if rf, ok := ret.Get(0).(func(string) error); ok {
r0 = rf(id)
@@ -30,10 +42,42 @@ func (_m *Engine) Delete(id string) error {
return r0
}
// Engine_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete'
type Engine_Delete_Call struct {
*mock.Call
}
// Delete is a helper method to define mock.On call
// - id string
func (_e *Engine_Expecter) Delete(id interface{}) *Engine_Delete_Call {
return &Engine_Delete_Call{Call: _e.mock.On("Delete", id)}
}
func (_c *Engine_Delete_Call) Run(run func(id string)) *Engine_Delete_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string))
})
return _c
}
func (_c *Engine_Delete_Call) Return(_a0 error) *Engine_Delete_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Engine_Delete_Call) RunAndReturn(run func(string) error) *Engine_Delete_Call {
_c.Call.Return(run)
return _c
}
// DocCount provides a mock function with given fields:
func (_m *Engine) DocCount() (uint64, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for DocCount")
}
var r0 uint64
var r1 error
if rf, ok := ret.Get(0).(func() (uint64, error)); ok {
@@ -54,10 +98,41 @@ func (_m *Engine) DocCount() (uint64, error) {
return r0, r1
}
// Engine_DocCount_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DocCount'
type Engine_DocCount_Call struct {
*mock.Call
}
// DocCount is a helper method to define mock.On call
func (_e *Engine_Expecter) DocCount() *Engine_DocCount_Call {
return &Engine_DocCount_Call{Call: _e.mock.On("DocCount")}
}
func (_c *Engine_DocCount_Call) Run(run func()) *Engine_DocCount_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *Engine_DocCount_Call) Return(_a0 uint64, _a1 error) *Engine_DocCount_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Engine_DocCount_Call) RunAndReturn(run func() (uint64, error)) *Engine_DocCount_Call {
_c.Call.Return(run)
return _c
}
// Move provides a mock function with given fields: id, parentid, target
func (_m *Engine) Move(id string, parentid string, target string) error {
ret := _m.Called(id, parentid, target)
if len(ret) == 0 {
panic("no return value specified for Move")
}
var r0 error
if rf, ok := ret.Get(0).(func(string, string, string) error); ok {
r0 = rf(id, parentid, target)
@@ -68,10 +143,44 @@ func (_m *Engine) Move(id string, parentid string, target string) error {
return r0
}
// Engine_Move_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Move'
type Engine_Move_Call struct {
*mock.Call
}
// Move is a helper method to define mock.On call
// - id string
// - parentid string
// - target string
func (_e *Engine_Expecter) Move(id interface{}, parentid interface{}, target interface{}) *Engine_Move_Call {
return &Engine_Move_Call{Call: _e.mock.On("Move", id, parentid, target)}
}
func (_c *Engine_Move_Call) Run(run func(id string, parentid string, target string)) *Engine_Move_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string), args[1].(string), args[2].(string))
})
return _c
}
func (_c *Engine_Move_Call) Return(_a0 error) *Engine_Move_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Engine_Move_Call) RunAndReturn(run func(string, string, string) error) *Engine_Move_Call {
_c.Call.Return(run)
return _c
}
// Purge provides a mock function with given fields: id
func (_m *Engine) Purge(id string) error {
ret := _m.Called(id)
if len(ret) == 0 {
panic("no return value specified for Purge")
}
var r0 error
if rf, ok := ret.Get(0).(func(string) error); ok {
r0 = rf(id)
@@ -82,10 +191,42 @@ func (_m *Engine) Purge(id string) error {
return r0
}
// Engine_Purge_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Purge'
type Engine_Purge_Call struct {
*mock.Call
}
// Purge is a helper method to define mock.On call
// - id string
func (_e *Engine_Expecter) Purge(id interface{}) *Engine_Purge_Call {
return &Engine_Purge_Call{Call: _e.mock.On("Purge", id)}
}
func (_c *Engine_Purge_Call) Run(run func(id string)) *Engine_Purge_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string))
})
return _c
}
func (_c *Engine_Purge_Call) Return(_a0 error) *Engine_Purge_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Engine_Purge_Call) RunAndReturn(run func(string) error) *Engine_Purge_Call {
_c.Call.Return(run)
return _c
}
// Restore provides a mock function with given fields: id
func (_m *Engine) Restore(id string) error {
ret := _m.Called(id)
if len(ret) == 0 {
panic("no return value specified for Restore")
}
var r0 error
if rf, ok := ret.Get(0).(func(string) error); ok {
r0 = rf(id)
@@ -96,10 +237,42 @@ func (_m *Engine) Restore(id string) error {
return r0
}
// Engine_Restore_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Restore'
type Engine_Restore_Call struct {
*mock.Call
}
// Restore is a helper method to define mock.On call
// - id string
func (_e *Engine_Expecter) Restore(id interface{}) *Engine_Restore_Call {
return &Engine_Restore_Call{Call: _e.mock.On("Restore", id)}
}
func (_c *Engine_Restore_Call) Run(run func(id string)) *Engine_Restore_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string))
})
return _c
}
func (_c *Engine_Restore_Call) Return(_a0 error) *Engine_Restore_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Engine_Restore_Call) RunAndReturn(run func(string) error) *Engine_Restore_Call {
_c.Call.Return(run)
return _c
}
// Search provides a mock function with given fields: ctx, req
func (_m *Engine) Search(ctx context.Context, req *v0.SearchIndexRequest) (*v0.SearchIndexResponse, error) {
ret := _m.Called(ctx, req)
if len(ret) == 0 {
panic("no return value specified for Search")
}
var r0 *v0.SearchIndexResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *v0.SearchIndexRequest) (*v0.SearchIndexResponse, error)); ok {
@@ -122,10 +295,43 @@ func (_m *Engine) Search(ctx context.Context, req *v0.SearchIndexRequest) (*v0.S
return r0, r1
}
// Engine_Search_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Search'
type Engine_Search_Call struct {
*mock.Call
}
// Search is a helper method to define mock.On call
// - ctx context.Context
// - req *v0.SearchIndexRequest
func (_e *Engine_Expecter) Search(ctx interface{}, req interface{}) *Engine_Search_Call {
return &Engine_Search_Call{Call: _e.mock.On("Search", ctx, req)}
}
func (_c *Engine_Search_Call) Run(run func(ctx context.Context, req *v0.SearchIndexRequest)) *Engine_Search_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*v0.SearchIndexRequest))
})
return _c
}
func (_c *Engine_Search_Call) Return(_a0 *v0.SearchIndexResponse, _a1 error) *Engine_Search_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Engine_Search_Call) RunAndReturn(run func(context.Context, *v0.SearchIndexRequest) (*v0.SearchIndexResponse, error)) *Engine_Search_Call {
_c.Call.Return(run)
return _c
}
// Upsert provides a mock function with given fields: id, r
func (_m *Engine) Upsert(id string, r engine.Resource) error {
ret := _m.Called(id, r)
if len(ret) == 0 {
panic("no return value specified for Upsert")
}
var r0 error
if rf, ok := ret.Get(0).(func(string, engine.Resource) error); ok {
r0 = rf(id, r)
@@ -136,13 +342,41 @@ func (_m *Engine) Upsert(id string, r engine.Resource) error {
return r0
}
type mockConstructorTestingTNewEngine interface {
mock.TestingT
Cleanup(func())
// Engine_Upsert_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Upsert'
type Engine_Upsert_Call struct {
*mock.Call
}
// Upsert is a helper method to define mock.On call
// - id string
// - r engine.Resource
func (_e *Engine_Expecter) Upsert(id interface{}, r interface{}) *Engine_Upsert_Call {
return &Engine_Upsert_Call{Call: _e.mock.On("Upsert", id, r)}
}
func (_c *Engine_Upsert_Call) Run(run func(id string, r engine.Resource)) *Engine_Upsert_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string), args[1].(engine.Resource))
})
return _c
}
func (_c *Engine_Upsert_Call) Return(_a0 error) *Engine_Upsert_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Engine_Upsert_Call) RunAndReturn(run func(string, engine.Resource) error) *Engine_Upsert_Call {
_c.Call.Return(run)
return _c
}
// NewEngine creates a new instance of Engine. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewEngine(t mockConstructorTestingTNewEngine) *Engine {
// The first argument is typically a *testing.T value.
func NewEngine(t interface {
mock.TestingT
Cleanup(func())
}) *Engine {
mock := &Engine{}
mock.Mock.Test(t)

Some files were not shown because too many files have changed in this diff Show More