diff --git a/.mockery.yaml b/.mockery.yaml index 2bf08c7..a38a10f 100644 --- a/.mockery.yaml +++ b/.mockery.yaml @@ -1,6 +1,7 @@ -outpkg: "{{.PackageName}}_mock" -dir: "mocks/{{.PackagePath}}_mock" - +dir: mocks/{{.SrcPackagePath}}_mock +pkgname: '{{.SrcPackageName}}_mock' +filename: mocks.go +template: testify packages: github.com/int128/kubelogin: config: @@ -8,4 +9,4 @@ packages: recursive: true io: interfaces: - Closer: + Closer: {} diff --git a/Makefile b/Makefile index e58bb8c..d60052d 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ integration-test: generate: go tool github.com/google/wire/cmd/wire ./pkg/di rm -fr mocks/ - go tool github.com/vektra/mockery/v2 + go tool mockery .PHONY: lint lint: diff --git a/go.mod b/go.mod index 48dc358..3a06352 100644 --- a/go.mod +++ b/go.mod @@ -54,6 +54,7 @@ require ( github.com/bombsimon/wsl/v4 v4.7.0 // indirect github.com/breml/bidichk v0.3.3 // indirect github.com/breml/errchkjson v0.4.1 // indirect + github.com/brunoga/deep v1.2.4 // indirect github.com/butuzov/ireturn v0.4.0 // indirect github.com/butuzov/mirror v1.3.0 // indirect github.com/catenacyber/perfsprint v0.9.1 // indirect @@ -79,6 +80,7 @@ require ( github.com/dlclark/regexp2 v1.11.5 // indirect github.com/ettle/strcase v0.2.0 // indirect github.com/fatih/color v1.18.0 // indirect + github.com/fatih/structs v1.1.0 // indirect github.com/fatih/structtag v1.2.0 // indirect github.com/firefart/nonamedreturns v1.0.6 // indirect github.com/fsnotify/fsnotify v1.8.0 // indirect @@ -124,19 +126,25 @@ require ( github.com/hashicorp/go-version v1.7.0 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/hexops/gotextdiff v1.0.3 // indirect - github.com/huandu/xstrings v1.4.0 // indirect - github.com/iancoleman/strcase v0.3.0 // indirect + github.com/huandu/xstrings v1.5.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/int128/listener v1.2.0 // indirect + github.com/jedib0t/go-pretty/v6 v6.6.7 // indirect github.com/jgautheron/goconst v1.8.1 // indirect github.com/jingyugao/rowserrcheck v1.1.1 // indirect - github.com/jinzhu/copier v0.4.0 // indirect github.com/jjti/go-spancheck v0.6.4 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/julz/importas v0.2.0 // indirect github.com/karamaru-alpha/copyloopvar v1.2.1 // indirect github.com/kisielk/errcheck v1.9.0 // indirect github.com/kkHAIKE/contextcheck v1.1.6 // indirect + github.com/knadh/koanf/maps v0.1.1 // indirect + github.com/knadh/koanf/parsers/yaml v0.1.0 // indirect + github.com/knadh/koanf/providers/env v1.0.0 // indirect + github.com/knadh/koanf/providers/file v1.1.2 // indirect + github.com/knadh/koanf/providers/posflag v0.1.0 // indirect + github.com/knadh/koanf/providers/structs v0.1.0 // indirect + github.com/knadh/koanf/v2 v2.1.2 // indirect github.com/kulti/thelper v0.6.3 // indirect github.com/kunwardeep/paralleltest v1.0.14 // indirect github.com/lasiar/canonicalheader v1.1.2 // indirect @@ -158,8 +166,9 @@ require ( github.com/mattn/go-runewidth v0.0.16 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/mgechev/revive v1.9.0 // indirect + github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect - github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/moricho/tparallel v0.3.2 // indirect @@ -216,8 +225,11 @@ require ( github.com/ultraware/whitespace v0.2.0 // indirect github.com/uudashr/gocognit v1.2.0 // indirect github.com/uudashr/iface v1.3.1 // indirect - github.com/vektra/mockery/v2 v2.53.3 // indirect + github.com/vektra/mockery/v3 v3.2.5 // indirect github.com/x448/float16 v0.8.4 // indirect + github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect + github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect + github.com/xeipuuv/gojsonschema v1.2.0 // indirect github.com/xen0n/gosmopolitan v1.3.0 // indirect github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect github.com/yagipy/maintidx v1.0.0 // indirect @@ -256,5 +268,5 @@ require ( tool ( github.com/golangci/golangci-lint/v2/cmd/golangci-lint github.com/google/wire/cmd/wire - github.com/vektra/mockery/v2 + github.com/vektra/mockery/v3 ) diff --git a/go.sum b/go.sum index 887ff41..7d21c09 100644 --- a/go.sum +++ b/go.sum @@ -102,6 +102,8 @@ github.com/breml/bidichk v0.3.3 h1:WSM67ztRusf1sMoqH6/c4OBCUlRVTKq+CbSeo0R17sE= github.com/breml/bidichk v0.3.3/go.mod h1:ISbsut8OnjB367j5NseXEGGgO/th206dVa427kR8YTE= github.com/breml/errchkjson v0.4.1 h1:keFSS8D7A2T0haP9kzZTi7o26r7kE3vymjZNeNDRDwg= github.com/breml/errchkjson v0.4.1/go.mod h1:a23OvR6Qvcl7DG/Z4o0el6BRAjKnaReoPQFciAl9U3s= +github.com/brunoga/deep v1.2.4 h1:Aj9E9oUbE+ccbyh35VC/NHlzzjfIVU69BXu2mt2LmL8= +github.com/brunoga/deep v1.2.4/go.mod h1:GDV6dnXqn80ezsLSZ5Wlv1PdKAWAO4L5PnKYtv2dgaI= github.com/butuzov/ireturn v0.4.0 h1:+s76bF/PfeKEdbG8b54aCocxXmi0wvYdOVsWxVO7n8E= github.com/butuzov/ireturn v0.4.0/go.mod h1:ghI0FrCmap8pDWZwfPisFD1vEc56VKH4NpQUxDHta70= github.com/butuzov/mirror v1.3.0 h1:HdWCXzmwlQHdVhwvsfBb2Au0r3HyINry3bDWLYXiKoc= @@ -176,6 +178,8 @@ github.com/ettle/strcase v0.2.0 h1:fGNiVF21fHXpX1niBgk0aROov1LagYsOwV/xqKDKR/Q= github.com/ettle/strcase v0.2.0/go.mod h1:DajmHElDSaX76ITe3/VHVyMin4LWSJN5Z909Wp+ED1A= github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= +github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= +github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4= github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= github.com/firefart/nonamedreturns v1.0.6 h1:vmiBcKV/3EqKY3ZiPxCINmpS431OcE1S47AQUwhrg8E= @@ -376,10 +380,8 @@ github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= -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.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= -github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= +github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI= +github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= @@ -389,12 +391,12 @@ github.com/int128/oauth2cli v1.15.1 h1:bi/Xuf6GHbPb7+EPAovN5Kg/QREvF2z8Q1XcAMLDl github.com/int128/oauth2cli v1.15.1/go.mod h1:CLt6GONO1LnEQzP0o1FbWYuie84CmVuXgY0sO0gLRMc= github.com/int128/oauth2dev v1.0.1 h1:TWokv4obxKuRZXvcXFMOYcaAcdZ/rcZYcbjkJNu+6Ek= github.com/int128/oauth2dev v1.0.1/go.mod h1:caoxoXz7nlt2nc7/o3GKgGCyuruOAmsViPSRmrUmV9o= +github.com/jedib0t/go-pretty/v6 v6.6.7 h1:m+LbHpm0aIAPLzLbMfn8dc3Ht8MW7lsSO4MPItz/Uuo= +github.com/jedib0t/go-pretty/v6 v6.6.7/go.mod h1:YwC5CE4fJ1HFUDeivSV1r//AmANFHyqczZk+U6BDALU= github.com/jgautheron/goconst v1.8.1 h1:PPqCYp3K/xlOj5JmIe6O1Mj6r1DbkdbLtR3AJuZo414= github.com/jgautheron/goconst v1.8.1/go.mod h1:A0oxgBCHy55NQn6sYpO7UdnA9p+h7cPtoOZUmvNIako= github.com/jingyugao/rowserrcheck v1.1.1 h1:zibz55j/MJtLsjP1OF4bSdgXxwL1b+Vn7Tjzq7gFzUs= github.com/jingyugao/rowserrcheck v1.1.1/go.mod h1:4yvlZSDb3IyDTUZJUmpZfm2Hwok+Dtp+nu2qOq+er9c= -github.com/jinzhu/copier v0.4.0 h1:w3ciUoD19shMCRargcpm0cm91ytaBhDvuRpz1ODO/U8= -github.com/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= github.com/jjti/go-spancheck v0.6.4 h1:Tl7gQpYf4/TMU7AT84MN83/6PutY21Nb9fuQjFTpRRc= github.com/jjti/go-spancheck v0.6.4/go.mod h1:yAEYdKJ2lRkDA8g7X+oKUHXOWVAXSBJRv04OhF+QUjk= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= @@ -419,6 +421,20 @@ github.com/kisielk/errcheck v1.9.0/go.mod h1:kQxWMMVZgIkDq7U8xtG/n2juOjbLgZtedi0 github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkHAIKE/contextcheck v1.1.6 h1:7HIyRcnyzxL9Lz06NGhiKvenXq7Zw6Q0UQu/ttjfJCE= github.com/kkHAIKE/contextcheck v1.1.6/go.mod h1:3dDbMRNBFaq8HFXWC1JyvDSPm43CmE6IuHam8Wr0rkg= +github.com/knadh/koanf/maps v0.1.1 h1:G5TjmUh2D7G2YWf5SQQqSiHRJEjaicvU0KpypqB3NIs= +github.com/knadh/koanf/maps v0.1.1/go.mod h1:npD/QZY3V6ghQDdcQzl1W4ICNVTkohC8E73eI2xW4yI= +github.com/knadh/koanf/parsers/yaml v0.1.0 h1:ZZ8/iGfRLvKSaMEECEBPM1HQslrZADk8fP1XFUxVI5w= +github.com/knadh/koanf/parsers/yaml v0.1.0/go.mod h1:cvbUDC7AL23pImuQP0oRw/hPuccrNBS2bps8asS0CwY= +github.com/knadh/koanf/providers/env v1.0.0 h1:ufePaI9BnWH+ajuxGGiJ8pdTG0uLEUWC7/HDDPGLah0= +github.com/knadh/koanf/providers/env v1.0.0/go.mod h1:mzFyRZueYhb37oPmC1HAv/oGEEuyvJDA98r3XAa8Gak= +github.com/knadh/koanf/providers/file v1.1.2 h1:aCC36YGOgV5lTtAFz2qkgtWdeQsgfxUkxDOe+2nQY3w= +github.com/knadh/koanf/providers/file v1.1.2/go.mod h1:/faSBcv2mxPVjFrXck95qeoyoZ5myJ6uxN8OOVNJJCI= +github.com/knadh/koanf/providers/posflag v0.1.0 h1:mKJlLrKPcAP7Ootf4pBZWJ6J+4wHYujwipe7Ie3qW6U= +github.com/knadh/koanf/providers/posflag v0.1.0/go.mod h1:SYg03v/t8ISBNrMBRMlojH8OsKowbkXV7giIbBVgbz0= +github.com/knadh/koanf/providers/structs v0.1.0 h1:wJRteCNn1qvLtE5h8KQBvLJovidSdntfdyIbbCzEyE0= +github.com/knadh/koanf/providers/structs v0.1.0/go.mod h1:sw2YZ3txUcqA3Z27gPlmmBzWn1h8Nt9O6EP/91MkcWE= +github.com/knadh/koanf/v2 v2.1.2 h1:I2rtLRqXRy1p01m/utEtpZSSA6dcJbgGVuE27kW2PzQ= +github.com/knadh/koanf/v2 v2.1.2/go.mod h1:Gphfaen0q1Fc1HTgJgSTC4oRX9R2R5ErYMZJy8fLJBo= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= @@ -479,10 +495,12 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0j github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mgechev/revive v1.9.0 h1:8LaA62XIKrb8lM6VsBSQ92slt/o92z5+hTw3CmrvSrM= github.com/mgechev/revive v1.9.0/go.mod h1:LAPq3+MgOf7GcL5PlWIkHb0PT7XH4NuC2LdWymhb9Mo= +github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= +github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= -github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= +github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -670,10 +688,16 @@ github.com/uudashr/gocognit v1.2.0 h1:3BU9aMr1xbhPlvJLSydKwdLN3tEUUrzPSSM8S4hDYR github.com/uudashr/gocognit v1.2.0/go.mod h1:k/DdKPI6XBZO1q7HgoV2juESI2/Ofj9AcHPZhBBdrTU= github.com/uudashr/iface v1.3.1 h1:bA51vmVx1UIhiIsQFSNq6GZ6VPTk3WNMZgRiCe9R29U= github.com/uudashr/iface v1.3.1/go.mod h1:4QvspiRd3JLPAEXBQ9AiZpLbJlrWWgRChOKDJEuQTdg= -github.com/vektra/mockery/v2 v2.53.3 h1:yBU8XrzntcZdcNRRv+At0anXgSaFtgkyVUNm3f4an3U= -github.com/vektra/mockery/v2 v2.53.3/go.mod h1:hIFFb3CvzPdDJJiU7J4zLRblUMv7OuezWsHPmswriwo= +github.com/vektra/mockery/v3 v3.2.5 h1:l65hiOW/zR7Z9XJtCS4EpOP3jhGExS2MV8INWwgcuaQ= +github.com/vektra/mockery/v3 v3.2.5/go.mod h1:UQwIbP5U84gbN/nkMyYVSW+tp7BFhaSym907rfS1HL4= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= +github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= +github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= github.com/xen0n/gosmopolitan v1.3.0 h1:zAZI1zefvo7gcpbCOrPSHJZJYA9ZgLfJqtKzZ5pHqQM= github.com/xen0n/gosmopolitan v1.3.0/go.mod h1:rckfr5T6o4lBtM1ga7mLGKZmLxswUoH1zxHgNXOsEt4= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no= diff --git a/mocks/github.com/int128/kubelogin/integration_test/oidcserver/service_mock/mock_Provider.go b/mocks/github.com/int128/kubelogin/integration_test/oidcserver/service_mock/mock_Provider.go deleted file mode 100644 index 559d163..0000000 --- a/mocks/github.com/int128/kubelogin/integration_test/oidcserver/service_mock/mock_Provider.go +++ /dev/null @@ -1,361 +0,0 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. - -package service_mock - -import ( - service "github.com/int128/kubelogin/integration_test/oidcserver/service" - mock "github.com/stretchr/testify/mock" -) - -// MockProvider is an autogenerated mock type for the Provider type -type MockProvider struct { - mock.Mock -} - -type MockProvider_Expecter struct { - mock *mock.Mock -} - -func (_m *MockProvider) EXPECT() *MockProvider_Expecter { - return &MockProvider_Expecter{mock: &_m.Mock} -} - -// AuthenticateCode provides a mock function with given fields: req -func (_m *MockProvider) AuthenticateCode(req service.AuthenticationRequest) (string, error) { - ret := _m.Called(req) - - if len(ret) == 0 { - panic("no return value specified for AuthenticateCode") - } - - var r0 string - var r1 error - if rf, ok := ret.Get(0).(func(service.AuthenticationRequest) (string, error)); ok { - return rf(req) - } - if rf, ok := ret.Get(0).(func(service.AuthenticationRequest) string); ok { - r0 = rf(req) - } else { - r0 = ret.Get(0).(string) - } - - if rf, ok := ret.Get(1).(func(service.AuthenticationRequest) error); ok { - r1 = rf(req) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockProvider_AuthenticateCode_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AuthenticateCode' -type MockProvider_AuthenticateCode_Call struct { - *mock.Call -} - -// AuthenticateCode is a helper method to define mock.On call -// - req service.AuthenticationRequest -func (_e *MockProvider_Expecter) AuthenticateCode(req interface{}) *MockProvider_AuthenticateCode_Call { - return &MockProvider_AuthenticateCode_Call{Call: _e.mock.On("AuthenticateCode", req)} -} - -func (_c *MockProvider_AuthenticateCode_Call) Run(run func(req service.AuthenticationRequest)) *MockProvider_AuthenticateCode_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(service.AuthenticationRequest)) - }) - return _c -} - -func (_c *MockProvider_AuthenticateCode_Call) Return(code string, err error) *MockProvider_AuthenticateCode_Call { - _c.Call.Return(code, err) - return _c -} - -func (_c *MockProvider_AuthenticateCode_Call) RunAndReturn(run func(service.AuthenticationRequest) (string, error)) *MockProvider_AuthenticateCode_Call { - _c.Call.Return(run) - return _c -} - -// AuthenticatePassword provides a mock function with given fields: username, password, scope -func (_m *MockProvider) AuthenticatePassword(username string, password string, scope string) (*service.TokenResponse, error) { - ret := _m.Called(username, password, scope) - - if len(ret) == 0 { - panic("no return value specified for AuthenticatePassword") - } - - var r0 *service.TokenResponse - var r1 error - if rf, ok := ret.Get(0).(func(string, string, string) (*service.TokenResponse, error)); ok { - return rf(username, password, scope) - } - if rf, ok := ret.Get(0).(func(string, string, string) *service.TokenResponse); ok { - r0 = rf(username, password, scope) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*service.TokenResponse) - } - } - - if rf, ok := ret.Get(1).(func(string, string, string) error); ok { - r1 = rf(username, password, scope) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockProvider_AuthenticatePassword_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AuthenticatePassword' -type MockProvider_AuthenticatePassword_Call struct { - *mock.Call -} - -// AuthenticatePassword is a helper method to define mock.On call -// - username string -// - password string -// - scope string -func (_e *MockProvider_Expecter) AuthenticatePassword(username interface{}, password interface{}, scope interface{}) *MockProvider_AuthenticatePassword_Call { - return &MockProvider_AuthenticatePassword_Call{Call: _e.mock.On("AuthenticatePassword", username, password, scope)} -} - -func (_c *MockProvider_AuthenticatePassword_Call) Run(run func(username string, password string, scope string)) *MockProvider_AuthenticatePassword_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(string), args[1].(string), args[2].(string)) - }) - return _c -} - -func (_c *MockProvider_AuthenticatePassword_Call) Return(_a0 *service.TokenResponse, _a1 error) *MockProvider_AuthenticatePassword_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockProvider_AuthenticatePassword_Call) RunAndReturn(run func(string, string, string) (*service.TokenResponse, error)) *MockProvider_AuthenticatePassword_Call { - _c.Call.Return(run) - return _c -} - -// Discovery provides a mock function with no fields -func (_m *MockProvider) Discovery() *service.DiscoveryResponse { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for Discovery") - } - - var r0 *service.DiscoveryResponse - if rf, ok := ret.Get(0).(func() *service.DiscoveryResponse); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*service.DiscoveryResponse) - } - } - - return r0 -} - -// MockProvider_Discovery_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Discovery' -type MockProvider_Discovery_Call struct { - *mock.Call -} - -// Discovery is a helper method to define mock.On call -func (_e *MockProvider_Expecter) Discovery() *MockProvider_Discovery_Call { - return &MockProvider_Discovery_Call{Call: _e.mock.On("Discovery")} -} - -func (_c *MockProvider_Discovery_Call) Run(run func()) *MockProvider_Discovery_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *MockProvider_Discovery_Call) Return(_a0 *service.DiscoveryResponse) *MockProvider_Discovery_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockProvider_Discovery_Call) RunAndReturn(run func() *service.DiscoveryResponse) *MockProvider_Discovery_Call { - _c.Call.Return(run) - return _c -} - -// Exchange provides a mock function with given fields: req -func (_m *MockProvider) Exchange(req service.TokenRequest) (*service.TokenResponse, error) { - ret := _m.Called(req) - - if len(ret) == 0 { - panic("no return value specified for Exchange") - } - - var r0 *service.TokenResponse - var r1 error - if rf, ok := ret.Get(0).(func(service.TokenRequest) (*service.TokenResponse, error)); ok { - return rf(req) - } - if rf, ok := ret.Get(0).(func(service.TokenRequest) *service.TokenResponse); ok { - r0 = rf(req) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*service.TokenResponse) - } - } - - if rf, ok := ret.Get(1).(func(service.TokenRequest) error); ok { - r1 = rf(req) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockProvider_Exchange_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Exchange' -type MockProvider_Exchange_Call struct { - *mock.Call -} - -// Exchange is a helper method to define mock.On call -// - req service.TokenRequest -func (_e *MockProvider_Expecter) Exchange(req interface{}) *MockProvider_Exchange_Call { - return &MockProvider_Exchange_Call{Call: _e.mock.On("Exchange", req)} -} - -func (_c *MockProvider_Exchange_Call) Run(run func(req service.TokenRequest)) *MockProvider_Exchange_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(service.TokenRequest)) - }) - return _c -} - -func (_c *MockProvider_Exchange_Call) Return(_a0 *service.TokenResponse, _a1 error) *MockProvider_Exchange_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockProvider_Exchange_Call) RunAndReturn(run func(service.TokenRequest) (*service.TokenResponse, error)) *MockProvider_Exchange_Call { - _c.Call.Return(run) - return _c -} - -// GetCertificates provides a mock function with no fields -func (_m *MockProvider) GetCertificates() *service.CertificatesResponse { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for GetCertificates") - } - - var r0 *service.CertificatesResponse - if rf, ok := ret.Get(0).(func() *service.CertificatesResponse); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*service.CertificatesResponse) - } - } - - return r0 -} - -// MockProvider_GetCertificates_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCertificates' -type MockProvider_GetCertificates_Call struct { - *mock.Call -} - -// GetCertificates is a helper method to define mock.On call -func (_e *MockProvider_Expecter) GetCertificates() *MockProvider_GetCertificates_Call { - return &MockProvider_GetCertificates_Call{Call: _e.mock.On("GetCertificates")} -} - -func (_c *MockProvider_GetCertificates_Call) Run(run func()) *MockProvider_GetCertificates_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *MockProvider_GetCertificates_Call) Return(_a0 *service.CertificatesResponse) *MockProvider_GetCertificates_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockProvider_GetCertificates_Call) RunAndReturn(run func() *service.CertificatesResponse) *MockProvider_GetCertificates_Call { - _c.Call.Return(run) - return _c -} - -// Refresh provides a mock function with given fields: refreshToken -func (_m *MockProvider) Refresh(refreshToken string) (*service.TokenResponse, error) { - ret := _m.Called(refreshToken) - - if len(ret) == 0 { - panic("no return value specified for Refresh") - } - - var r0 *service.TokenResponse - var r1 error - if rf, ok := ret.Get(0).(func(string) (*service.TokenResponse, error)); ok { - return rf(refreshToken) - } - if rf, ok := ret.Get(0).(func(string) *service.TokenResponse); ok { - r0 = rf(refreshToken) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*service.TokenResponse) - } - } - - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(refreshToken) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockProvider_Refresh_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Refresh' -type MockProvider_Refresh_Call struct { - *mock.Call -} - -// Refresh is a helper method to define mock.On call -// - refreshToken string -func (_e *MockProvider_Expecter) Refresh(refreshToken interface{}) *MockProvider_Refresh_Call { - return &MockProvider_Refresh_Call{Call: _e.mock.On("Refresh", refreshToken)} -} - -func (_c *MockProvider_Refresh_Call) Run(run func(refreshToken string)) *MockProvider_Refresh_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(string)) - }) - return _c -} - -func (_c *MockProvider_Refresh_Call) Return(_a0 *service.TokenResponse, _a1 error) *MockProvider_Refresh_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockProvider_Refresh_Call) RunAndReturn(run func(string) (*service.TokenResponse, error)) *MockProvider_Refresh_Call { - _c.Call.Return(run) - return _c -} - -// NewMockProvider creates a new instance of MockProvider. 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 NewMockProvider(t interface { - mock.TestingT - Cleanup(func()) -}) *MockProvider { - mock := &MockProvider{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/github.com/int128/kubelogin/integration_test/oidcserver/service_mock/mock_Service.go b/mocks/github.com/int128/kubelogin/integration_test/oidcserver/service_mock/mock_Service.go deleted file mode 100644 index a4417d3..0000000 --- a/mocks/github.com/int128/kubelogin/integration_test/oidcserver/service_mock/mock_Service.go +++ /dev/null @@ -1,487 +0,0 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. - -package service_mock - -import ( - service "github.com/int128/kubelogin/integration_test/oidcserver/service" - testconfig "github.com/int128/kubelogin/integration_test/oidcserver/testconfig" - mock "github.com/stretchr/testify/mock" -) - -// MockService is an autogenerated mock type for the Service type -type MockService struct { - mock.Mock -} - -type MockService_Expecter struct { - mock *mock.Mock -} - -func (_m *MockService) EXPECT() *MockService_Expecter { - return &MockService_Expecter{mock: &_m.Mock} -} - -// AuthenticateCode provides a mock function with given fields: req -func (_m *MockService) AuthenticateCode(req service.AuthenticationRequest) (string, error) { - ret := _m.Called(req) - - if len(ret) == 0 { - panic("no return value specified for AuthenticateCode") - } - - var r0 string - var r1 error - if rf, ok := ret.Get(0).(func(service.AuthenticationRequest) (string, error)); ok { - return rf(req) - } - if rf, ok := ret.Get(0).(func(service.AuthenticationRequest) string); ok { - r0 = rf(req) - } else { - r0 = ret.Get(0).(string) - } - - if rf, ok := ret.Get(1).(func(service.AuthenticationRequest) error); ok { - r1 = rf(req) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockService_AuthenticateCode_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AuthenticateCode' -type MockService_AuthenticateCode_Call struct { - *mock.Call -} - -// AuthenticateCode is a helper method to define mock.On call -// - req service.AuthenticationRequest -func (_e *MockService_Expecter) AuthenticateCode(req interface{}) *MockService_AuthenticateCode_Call { - return &MockService_AuthenticateCode_Call{Call: _e.mock.On("AuthenticateCode", req)} -} - -func (_c *MockService_AuthenticateCode_Call) Run(run func(req service.AuthenticationRequest)) *MockService_AuthenticateCode_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(service.AuthenticationRequest)) - }) - return _c -} - -func (_c *MockService_AuthenticateCode_Call) Return(code string, err error) *MockService_AuthenticateCode_Call { - _c.Call.Return(code, err) - return _c -} - -func (_c *MockService_AuthenticateCode_Call) RunAndReturn(run func(service.AuthenticationRequest) (string, error)) *MockService_AuthenticateCode_Call { - _c.Call.Return(run) - return _c -} - -// AuthenticatePassword provides a mock function with given fields: username, password, scope -func (_m *MockService) AuthenticatePassword(username string, password string, scope string) (*service.TokenResponse, error) { - ret := _m.Called(username, password, scope) - - if len(ret) == 0 { - panic("no return value specified for AuthenticatePassword") - } - - var r0 *service.TokenResponse - var r1 error - if rf, ok := ret.Get(0).(func(string, string, string) (*service.TokenResponse, error)); ok { - return rf(username, password, scope) - } - if rf, ok := ret.Get(0).(func(string, string, string) *service.TokenResponse); ok { - r0 = rf(username, password, scope) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*service.TokenResponse) - } - } - - if rf, ok := ret.Get(1).(func(string, string, string) error); ok { - r1 = rf(username, password, scope) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockService_AuthenticatePassword_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AuthenticatePassword' -type MockService_AuthenticatePassword_Call struct { - *mock.Call -} - -// AuthenticatePassword is a helper method to define mock.On call -// - username string -// - password string -// - scope string -func (_e *MockService_Expecter) AuthenticatePassword(username interface{}, password interface{}, scope interface{}) *MockService_AuthenticatePassword_Call { - return &MockService_AuthenticatePassword_Call{Call: _e.mock.On("AuthenticatePassword", username, password, scope)} -} - -func (_c *MockService_AuthenticatePassword_Call) Run(run func(username string, password string, scope string)) *MockService_AuthenticatePassword_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(string), args[1].(string), args[2].(string)) - }) - return _c -} - -func (_c *MockService_AuthenticatePassword_Call) Return(_a0 *service.TokenResponse, _a1 error) *MockService_AuthenticatePassword_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockService_AuthenticatePassword_Call) RunAndReturn(run func(string, string, string) (*service.TokenResponse, error)) *MockService_AuthenticatePassword_Call { - _c.Call.Return(run) - return _c -} - -// Discovery provides a mock function with no fields -func (_m *MockService) Discovery() *service.DiscoveryResponse { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for Discovery") - } - - var r0 *service.DiscoveryResponse - if rf, ok := ret.Get(0).(func() *service.DiscoveryResponse); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*service.DiscoveryResponse) - } - } - - return r0 -} - -// MockService_Discovery_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Discovery' -type MockService_Discovery_Call struct { - *mock.Call -} - -// Discovery is a helper method to define mock.On call -func (_e *MockService_Expecter) Discovery() *MockService_Discovery_Call { - return &MockService_Discovery_Call{Call: _e.mock.On("Discovery")} -} - -func (_c *MockService_Discovery_Call) Run(run func()) *MockService_Discovery_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *MockService_Discovery_Call) Return(_a0 *service.DiscoveryResponse) *MockService_Discovery_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockService_Discovery_Call) RunAndReturn(run func() *service.DiscoveryResponse) *MockService_Discovery_Call { - _c.Call.Return(run) - return _c -} - -// Exchange provides a mock function with given fields: req -func (_m *MockService) Exchange(req service.TokenRequest) (*service.TokenResponse, error) { - ret := _m.Called(req) - - if len(ret) == 0 { - panic("no return value specified for Exchange") - } - - var r0 *service.TokenResponse - var r1 error - if rf, ok := ret.Get(0).(func(service.TokenRequest) (*service.TokenResponse, error)); ok { - return rf(req) - } - if rf, ok := ret.Get(0).(func(service.TokenRequest) *service.TokenResponse); ok { - r0 = rf(req) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*service.TokenResponse) - } - } - - if rf, ok := ret.Get(1).(func(service.TokenRequest) error); ok { - r1 = rf(req) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockService_Exchange_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Exchange' -type MockService_Exchange_Call struct { - *mock.Call -} - -// Exchange is a helper method to define mock.On call -// - req service.TokenRequest -func (_e *MockService_Expecter) Exchange(req interface{}) *MockService_Exchange_Call { - return &MockService_Exchange_Call{Call: _e.mock.On("Exchange", req)} -} - -func (_c *MockService_Exchange_Call) Run(run func(req service.TokenRequest)) *MockService_Exchange_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(service.TokenRequest)) - }) - return _c -} - -func (_c *MockService_Exchange_Call) Return(_a0 *service.TokenResponse, _a1 error) *MockService_Exchange_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockService_Exchange_Call) RunAndReturn(run func(service.TokenRequest) (*service.TokenResponse, error)) *MockService_Exchange_Call { - _c.Call.Return(run) - return _c -} - -// GetCertificates provides a mock function with no fields -func (_m *MockService) GetCertificates() *service.CertificatesResponse { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for GetCertificates") - } - - var r0 *service.CertificatesResponse - if rf, ok := ret.Get(0).(func() *service.CertificatesResponse); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*service.CertificatesResponse) - } - } - - return r0 -} - -// MockService_GetCertificates_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCertificates' -type MockService_GetCertificates_Call struct { - *mock.Call -} - -// GetCertificates is a helper method to define mock.On call -func (_e *MockService_Expecter) GetCertificates() *MockService_GetCertificates_Call { - return &MockService_GetCertificates_Call{Call: _e.mock.On("GetCertificates")} -} - -func (_c *MockService_GetCertificates_Call) Run(run func()) *MockService_GetCertificates_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *MockService_GetCertificates_Call) Return(_a0 *service.CertificatesResponse) *MockService_GetCertificates_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockService_GetCertificates_Call) RunAndReturn(run func() *service.CertificatesResponse) *MockService_GetCertificates_Call { - _c.Call.Return(run) - return _c -} - -// IssuerURL provides a mock function with no fields -func (_m *MockService) IssuerURL() string { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for IssuerURL") - } - - var r0 string - if rf, ok := ret.Get(0).(func() string); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(string) - } - - return r0 -} - -// MockService_IssuerURL_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IssuerURL' -type MockService_IssuerURL_Call struct { - *mock.Call -} - -// IssuerURL is a helper method to define mock.On call -func (_e *MockService_Expecter) IssuerURL() *MockService_IssuerURL_Call { - return &MockService_IssuerURL_Call{Call: _e.mock.On("IssuerURL")} -} - -func (_c *MockService_IssuerURL_Call) Run(run func()) *MockService_IssuerURL_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *MockService_IssuerURL_Call) Return(_a0 string) *MockService_IssuerURL_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockService_IssuerURL_Call) RunAndReturn(run func() string) *MockService_IssuerURL_Call { - _c.Call.Return(run) - return _c -} - -// LastTokenResponse provides a mock function with no fields -func (_m *MockService) LastTokenResponse() *service.TokenResponse { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for LastTokenResponse") - } - - var r0 *service.TokenResponse - if rf, ok := ret.Get(0).(func() *service.TokenResponse); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*service.TokenResponse) - } - } - - return r0 -} - -// MockService_LastTokenResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LastTokenResponse' -type MockService_LastTokenResponse_Call struct { - *mock.Call -} - -// LastTokenResponse is a helper method to define mock.On call -func (_e *MockService_Expecter) LastTokenResponse() *MockService_LastTokenResponse_Call { - return &MockService_LastTokenResponse_Call{Call: _e.mock.On("LastTokenResponse")} -} - -func (_c *MockService_LastTokenResponse_Call) Run(run func()) *MockService_LastTokenResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *MockService_LastTokenResponse_Call) Return(_a0 *service.TokenResponse) *MockService_LastTokenResponse_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockService_LastTokenResponse_Call) RunAndReturn(run func() *service.TokenResponse) *MockService_LastTokenResponse_Call { - _c.Call.Return(run) - return _c -} - -// Refresh provides a mock function with given fields: refreshToken -func (_m *MockService) Refresh(refreshToken string) (*service.TokenResponse, error) { - ret := _m.Called(refreshToken) - - if len(ret) == 0 { - panic("no return value specified for Refresh") - } - - var r0 *service.TokenResponse - var r1 error - if rf, ok := ret.Get(0).(func(string) (*service.TokenResponse, error)); ok { - return rf(refreshToken) - } - if rf, ok := ret.Get(0).(func(string) *service.TokenResponse); ok { - r0 = rf(refreshToken) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*service.TokenResponse) - } - } - - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(refreshToken) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockService_Refresh_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Refresh' -type MockService_Refresh_Call struct { - *mock.Call -} - -// Refresh is a helper method to define mock.On call -// - refreshToken string -func (_e *MockService_Expecter) Refresh(refreshToken interface{}) *MockService_Refresh_Call { - return &MockService_Refresh_Call{Call: _e.mock.On("Refresh", refreshToken)} -} - -func (_c *MockService_Refresh_Call) Run(run func(refreshToken string)) *MockService_Refresh_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(string)) - }) - return _c -} - -func (_c *MockService_Refresh_Call) Return(_a0 *service.TokenResponse, _a1 error) *MockService_Refresh_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockService_Refresh_Call) RunAndReturn(run func(string) (*service.TokenResponse, error)) *MockService_Refresh_Call { - _c.Call.Return(run) - return _c -} - -// SetConfig provides a mock function with given fields: config -func (_m *MockService) SetConfig(config testconfig.Config) { - _m.Called(config) -} - -// MockService_SetConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetConfig' -type MockService_SetConfig_Call struct { - *mock.Call -} - -// SetConfig is a helper method to define mock.On call -// - config testconfig.Config -func (_e *MockService_Expecter) SetConfig(config interface{}) *MockService_SetConfig_Call { - return &MockService_SetConfig_Call{Call: _e.mock.On("SetConfig", config)} -} - -func (_c *MockService_SetConfig_Call) Run(run func(config testconfig.Config)) *MockService_SetConfig_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(testconfig.Config)) - }) - return _c -} - -func (_c *MockService_SetConfig_Call) Return() *MockService_SetConfig_Call { - _c.Call.Return() - return _c -} - -func (_c *MockService_SetConfig_Call) RunAndReturn(run func(testconfig.Config)) *MockService_SetConfig_Call { - _c.Run(run) - return _c -} - -// NewMockService creates a new instance of MockService. 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 NewMockService(t interface { - mock.TestingT - Cleanup(func()) -}) *MockService { - mock := &MockService{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/github.com/int128/kubelogin/integration_test/oidcserver/service_mock/mocks.go b/mocks/github.com/int128/kubelogin/integration_test/oidcserver/service_mock/mocks.go new file mode 100644 index 0000000..3081c07 --- /dev/null +++ b/mocks/github.com/int128/kubelogin/integration_test/oidcserver/service_mock/mocks.go @@ -0,0 +1,821 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package service_mock + +import ( + "github.com/int128/kubelogin/integration_test/oidcserver/service" + "github.com/int128/kubelogin/integration_test/oidcserver/testconfig" + mock "github.com/stretchr/testify/mock" +) + +// NewMockService creates a new instance of MockService. 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 NewMockService(t interface { + mock.TestingT + Cleanup(func()) +}) *MockService { + mock := &MockService{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MockService is an autogenerated mock type for the Service type +type MockService struct { + mock.Mock +} + +type MockService_Expecter struct { + mock *mock.Mock +} + +func (_m *MockService) EXPECT() *MockService_Expecter { + return &MockService_Expecter{mock: &_m.Mock} +} + +// AuthenticateCode provides a mock function for the type MockService +func (_mock *MockService) AuthenticateCode(req service.AuthenticationRequest) (string, error) { + ret := _mock.Called(req) + + if len(ret) == 0 { + panic("no return value specified for AuthenticateCode") + } + + var r0 string + var r1 error + if returnFunc, ok := ret.Get(0).(func(service.AuthenticationRequest) (string, error)); ok { + return returnFunc(req) + } + if returnFunc, ok := ret.Get(0).(func(service.AuthenticationRequest) string); ok { + r0 = returnFunc(req) + } else { + r0 = ret.Get(0).(string) + } + if returnFunc, ok := ret.Get(1).(func(service.AuthenticationRequest) error); ok { + r1 = returnFunc(req) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockService_AuthenticateCode_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AuthenticateCode' +type MockService_AuthenticateCode_Call struct { + *mock.Call +} + +// AuthenticateCode is a helper method to define mock.On call +// - req +func (_e *MockService_Expecter) AuthenticateCode(req interface{}) *MockService_AuthenticateCode_Call { + return &MockService_AuthenticateCode_Call{Call: _e.mock.On("AuthenticateCode", req)} +} + +func (_c *MockService_AuthenticateCode_Call) Run(run func(req service.AuthenticationRequest)) *MockService_AuthenticateCode_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(service.AuthenticationRequest)) + }) + return _c +} + +func (_c *MockService_AuthenticateCode_Call) Return(code string, err error) *MockService_AuthenticateCode_Call { + _c.Call.Return(code, err) + return _c +} + +func (_c *MockService_AuthenticateCode_Call) RunAndReturn(run func(req service.AuthenticationRequest) (string, error)) *MockService_AuthenticateCode_Call { + _c.Call.Return(run) + return _c +} + +// AuthenticatePassword provides a mock function for the type MockService +func (_mock *MockService) AuthenticatePassword(username string, password string, scope string) (*service.TokenResponse, error) { + ret := _mock.Called(username, password, scope) + + if len(ret) == 0 { + panic("no return value specified for AuthenticatePassword") + } + + var r0 *service.TokenResponse + var r1 error + if returnFunc, ok := ret.Get(0).(func(string, string, string) (*service.TokenResponse, error)); ok { + return returnFunc(username, password, scope) + } + if returnFunc, ok := ret.Get(0).(func(string, string, string) *service.TokenResponse); ok { + r0 = returnFunc(username, password, scope) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*service.TokenResponse) + } + } + if returnFunc, ok := ret.Get(1).(func(string, string, string) error); ok { + r1 = returnFunc(username, password, scope) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockService_AuthenticatePassword_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AuthenticatePassword' +type MockService_AuthenticatePassword_Call struct { + *mock.Call +} + +// AuthenticatePassword is a helper method to define mock.On call +// - username +// - password +// - scope +func (_e *MockService_Expecter) AuthenticatePassword(username interface{}, password interface{}, scope interface{}) *MockService_AuthenticatePassword_Call { + return &MockService_AuthenticatePassword_Call{Call: _e.mock.On("AuthenticatePassword", username, password, scope)} +} + +func (_c *MockService_AuthenticatePassword_Call) Run(run func(username string, password string, scope string)) *MockService_AuthenticatePassword_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockService_AuthenticatePassword_Call) Return(tokenResponse *service.TokenResponse, err error) *MockService_AuthenticatePassword_Call { + _c.Call.Return(tokenResponse, err) + return _c +} + +func (_c *MockService_AuthenticatePassword_Call) RunAndReturn(run func(username string, password string, scope string) (*service.TokenResponse, error)) *MockService_AuthenticatePassword_Call { + _c.Call.Return(run) + return _c +} + +// Discovery provides a mock function for the type MockService +func (_mock *MockService) Discovery() *service.DiscoveryResponse { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Discovery") + } + + var r0 *service.DiscoveryResponse + if returnFunc, ok := ret.Get(0).(func() *service.DiscoveryResponse); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*service.DiscoveryResponse) + } + } + return r0 +} + +// MockService_Discovery_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Discovery' +type MockService_Discovery_Call struct { + *mock.Call +} + +// Discovery is a helper method to define mock.On call +func (_e *MockService_Expecter) Discovery() *MockService_Discovery_Call { + return &MockService_Discovery_Call{Call: _e.mock.On("Discovery")} +} + +func (_c *MockService_Discovery_Call) Run(run func()) *MockService_Discovery_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockService_Discovery_Call) Return(discoveryResponse *service.DiscoveryResponse) *MockService_Discovery_Call { + _c.Call.Return(discoveryResponse) + return _c +} + +func (_c *MockService_Discovery_Call) RunAndReturn(run func() *service.DiscoveryResponse) *MockService_Discovery_Call { + _c.Call.Return(run) + return _c +} + +// Exchange provides a mock function for the type MockService +func (_mock *MockService) Exchange(req service.TokenRequest) (*service.TokenResponse, error) { + ret := _mock.Called(req) + + if len(ret) == 0 { + panic("no return value specified for Exchange") + } + + var r0 *service.TokenResponse + var r1 error + if returnFunc, ok := ret.Get(0).(func(service.TokenRequest) (*service.TokenResponse, error)); ok { + return returnFunc(req) + } + if returnFunc, ok := ret.Get(0).(func(service.TokenRequest) *service.TokenResponse); ok { + r0 = returnFunc(req) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*service.TokenResponse) + } + } + if returnFunc, ok := ret.Get(1).(func(service.TokenRequest) error); ok { + r1 = returnFunc(req) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockService_Exchange_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Exchange' +type MockService_Exchange_Call struct { + *mock.Call +} + +// Exchange is a helper method to define mock.On call +// - req +func (_e *MockService_Expecter) Exchange(req interface{}) *MockService_Exchange_Call { + return &MockService_Exchange_Call{Call: _e.mock.On("Exchange", req)} +} + +func (_c *MockService_Exchange_Call) Run(run func(req service.TokenRequest)) *MockService_Exchange_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(service.TokenRequest)) + }) + return _c +} + +func (_c *MockService_Exchange_Call) Return(tokenResponse *service.TokenResponse, err error) *MockService_Exchange_Call { + _c.Call.Return(tokenResponse, err) + return _c +} + +func (_c *MockService_Exchange_Call) RunAndReturn(run func(req service.TokenRequest) (*service.TokenResponse, error)) *MockService_Exchange_Call { + _c.Call.Return(run) + return _c +} + +// GetCertificates provides a mock function for the type MockService +func (_mock *MockService) GetCertificates() *service.CertificatesResponse { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for GetCertificates") + } + + var r0 *service.CertificatesResponse + if returnFunc, ok := ret.Get(0).(func() *service.CertificatesResponse); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*service.CertificatesResponse) + } + } + return r0 +} + +// MockService_GetCertificates_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCertificates' +type MockService_GetCertificates_Call struct { + *mock.Call +} + +// GetCertificates is a helper method to define mock.On call +func (_e *MockService_Expecter) GetCertificates() *MockService_GetCertificates_Call { + return &MockService_GetCertificates_Call{Call: _e.mock.On("GetCertificates")} +} + +func (_c *MockService_GetCertificates_Call) Run(run func()) *MockService_GetCertificates_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockService_GetCertificates_Call) Return(certificatesResponse *service.CertificatesResponse) *MockService_GetCertificates_Call { + _c.Call.Return(certificatesResponse) + return _c +} + +func (_c *MockService_GetCertificates_Call) RunAndReturn(run func() *service.CertificatesResponse) *MockService_GetCertificates_Call { + _c.Call.Return(run) + return _c +} + +// IssuerURL provides a mock function for the type MockService +func (_mock *MockService) IssuerURL() string { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for IssuerURL") + } + + var r0 string + if returnFunc, ok := ret.Get(0).(func() string); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(string) + } + return r0 +} + +// MockService_IssuerURL_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IssuerURL' +type MockService_IssuerURL_Call struct { + *mock.Call +} + +// IssuerURL is a helper method to define mock.On call +func (_e *MockService_Expecter) IssuerURL() *MockService_IssuerURL_Call { + return &MockService_IssuerURL_Call{Call: _e.mock.On("IssuerURL")} +} + +func (_c *MockService_IssuerURL_Call) Run(run func()) *MockService_IssuerURL_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockService_IssuerURL_Call) Return(s string) *MockService_IssuerURL_Call { + _c.Call.Return(s) + return _c +} + +func (_c *MockService_IssuerURL_Call) RunAndReturn(run func() string) *MockService_IssuerURL_Call { + _c.Call.Return(run) + return _c +} + +// LastTokenResponse provides a mock function for the type MockService +func (_mock *MockService) LastTokenResponse() *service.TokenResponse { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for LastTokenResponse") + } + + var r0 *service.TokenResponse + if returnFunc, ok := ret.Get(0).(func() *service.TokenResponse); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*service.TokenResponse) + } + } + return r0 +} + +// MockService_LastTokenResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LastTokenResponse' +type MockService_LastTokenResponse_Call struct { + *mock.Call +} + +// LastTokenResponse is a helper method to define mock.On call +func (_e *MockService_Expecter) LastTokenResponse() *MockService_LastTokenResponse_Call { + return &MockService_LastTokenResponse_Call{Call: _e.mock.On("LastTokenResponse")} +} + +func (_c *MockService_LastTokenResponse_Call) Run(run func()) *MockService_LastTokenResponse_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockService_LastTokenResponse_Call) Return(tokenResponse *service.TokenResponse) *MockService_LastTokenResponse_Call { + _c.Call.Return(tokenResponse) + return _c +} + +func (_c *MockService_LastTokenResponse_Call) RunAndReturn(run func() *service.TokenResponse) *MockService_LastTokenResponse_Call { + _c.Call.Return(run) + return _c +} + +// Refresh provides a mock function for the type MockService +func (_mock *MockService) Refresh(refreshToken string) (*service.TokenResponse, error) { + ret := _mock.Called(refreshToken) + + if len(ret) == 0 { + panic("no return value specified for Refresh") + } + + var r0 *service.TokenResponse + var r1 error + if returnFunc, ok := ret.Get(0).(func(string) (*service.TokenResponse, error)); ok { + return returnFunc(refreshToken) + } + if returnFunc, ok := ret.Get(0).(func(string) *service.TokenResponse); ok { + r0 = returnFunc(refreshToken) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*service.TokenResponse) + } + } + if returnFunc, ok := ret.Get(1).(func(string) error); ok { + r1 = returnFunc(refreshToken) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockService_Refresh_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Refresh' +type MockService_Refresh_Call struct { + *mock.Call +} + +// Refresh is a helper method to define mock.On call +// - refreshToken +func (_e *MockService_Expecter) Refresh(refreshToken interface{}) *MockService_Refresh_Call { + return &MockService_Refresh_Call{Call: _e.mock.On("Refresh", refreshToken)} +} + +func (_c *MockService_Refresh_Call) Run(run func(refreshToken string)) *MockService_Refresh_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *MockService_Refresh_Call) Return(tokenResponse *service.TokenResponse, err error) *MockService_Refresh_Call { + _c.Call.Return(tokenResponse, err) + return _c +} + +func (_c *MockService_Refresh_Call) RunAndReturn(run func(refreshToken string) (*service.TokenResponse, error)) *MockService_Refresh_Call { + _c.Call.Return(run) + return _c +} + +// SetConfig provides a mock function for the type MockService +func (_mock *MockService) SetConfig(config testconfig.Config) { + _mock.Called(config) + return +} + +// MockService_SetConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetConfig' +type MockService_SetConfig_Call struct { + *mock.Call +} + +// SetConfig is a helper method to define mock.On call +// - config +func (_e *MockService_Expecter) SetConfig(config interface{}) *MockService_SetConfig_Call { + return &MockService_SetConfig_Call{Call: _e.mock.On("SetConfig", config)} +} + +func (_c *MockService_SetConfig_Call) Run(run func(config testconfig.Config)) *MockService_SetConfig_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(testconfig.Config)) + }) + return _c +} + +func (_c *MockService_SetConfig_Call) Return() *MockService_SetConfig_Call { + _c.Call.Return() + return _c +} + +func (_c *MockService_SetConfig_Call) RunAndReturn(run func(config testconfig.Config)) *MockService_SetConfig_Call { + _c.Run(run) + return _c +} + +// NewMockProvider creates a new instance of MockProvider. 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 NewMockProvider(t interface { + mock.TestingT + Cleanup(func()) +}) *MockProvider { + mock := &MockProvider{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MockProvider is an autogenerated mock type for the Provider type +type MockProvider struct { + mock.Mock +} + +type MockProvider_Expecter struct { + mock *mock.Mock +} + +func (_m *MockProvider) EXPECT() *MockProvider_Expecter { + return &MockProvider_Expecter{mock: &_m.Mock} +} + +// AuthenticateCode provides a mock function for the type MockProvider +func (_mock *MockProvider) AuthenticateCode(req service.AuthenticationRequest) (string, error) { + ret := _mock.Called(req) + + if len(ret) == 0 { + panic("no return value specified for AuthenticateCode") + } + + var r0 string + var r1 error + if returnFunc, ok := ret.Get(0).(func(service.AuthenticationRequest) (string, error)); ok { + return returnFunc(req) + } + if returnFunc, ok := ret.Get(0).(func(service.AuthenticationRequest) string); ok { + r0 = returnFunc(req) + } else { + r0 = ret.Get(0).(string) + } + if returnFunc, ok := ret.Get(1).(func(service.AuthenticationRequest) error); ok { + r1 = returnFunc(req) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockProvider_AuthenticateCode_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AuthenticateCode' +type MockProvider_AuthenticateCode_Call struct { + *mock.Call +} + +// AuthenticateCode is a helper method to define mock.On call +// - req +func (_e *MockProvider_Expecter) AuthenticateCode(req interface{}) *MockProvider_AuthenticateCode_Call { + return &MockProvider_AuthenticateCode_Call{Call: _e.mock.On("AuthenticateCode", req)} +} + +func (_c *MockProvider_AuthenticateCode_Call) Run(run func(req service.AuthenticationRequest)) *MockProvider_AuthenticateCode_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(service.AuthenticationRequest)) + }) + return _c +} + +func (_c *MockProvider_AuthenticateCode_Call) Return(code string, err error) *MockProvider_AuthenticateCode_Call { + _c.Call.Return(code, err) + return _c +} + +func (_c *MockProvider_AuthenticateCode_Call) RunAndReturn(run func(req service.AuthenticationRequest) (string, error)) *MockProvider_AuthenticateCode_Call { + _c.Call.Return(run) + return _c +} + +// AuthenticatePassword provides a mock function for the type MockProvider +func (_mock *MockProvider) AuthenticatePassword(username string, password string, scope string) (*service.TokenResponse, error) { + ret := _mock.Called(username, password, scope) + + if len(ret) == 0 { + panic("no return value specified for AuthenticatePassword") + } + + var r0 *service.TokenResponse + var r1 error + if returnFunc, ok := ret.Get(0).(func(string, string, string) (*service.TokenResponse, error)); ok { + return returnFunc(username, password, scope) + } + if returnFunc, ok := ret.Get(0).(func(string, string, string) *service.TokenResponse); ok { + r0 = returnFunc(username, password, scope) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*service.TokenResponse) + } + } + if returnFunc, ok := ret.Get(1).(func(string, string, string) error); ok { + r1 = returnFunc(username, password, scope) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockProvider_AuthenticatePassword_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AuthenticatePassword' +type MockProvider_AuthenticatePassword_Call struct { + *mock.Call +} + +// AuthenticatePassword is a helper method to define mock.On call +// - username +// - password +// - scope +func (_e *MockProvider_Expecter) AuthenticatePassword(username interface{}, password interface{}, scope interface{}) *MockProvider_AuthenticatePassword_Call { + return &MockProvider_AuthenticatePassword_Call{Call: _e.mock.On("AuthenticatePassword", username, password, scope)} +} + +func (_c *MockProvider_AuthenticatePassword_Call) Run(run func(username string, password string, scope string)) *MockProvider_AuthenticatePassword_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockProvider_AuthenticatePassword_Call) Return(tokenResponse *service.TokenResponse, err error) *MockProvider_AuthenticatePassword_Call { + _c.Call.Return(tokenResponse, err) + return _c +} + +func (_c *MockProvider_AuthenticatePassword_Call) RunAndReturn(run func(username string, password string, scope string) (*service.TokenResponse, error)) *MockProvider_AuthenticatePassword_Call { + _c.Call.Return(run) + return _c +} + +// Discovery provides a mock function for the type MockProvider +func (_mock *MockProvider) Discovery() *service.DiscoveryResponse { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Discovery") + } + + var r0 *service.DiscoveryResponse + if returnFunc, ok := ret.Get(0).(func() *service.DiscoveryResponse); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*service.DiscoveryResponse) + } + } + return r0 +} + +// MockProvider_Discovery_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Discovery' +type MockProvider_Discovery_Call struct { + *mock.Call +} + +// Discovery is a helper method to define mock.On call +func (_e *MockProvider_Expecter) Discovery() *MockProvider_Discovery_Call { + return &MockProvider_Discovery_Call{Call: _e.mock.On("Discovery")} +} + +func (_c *MockProvider_Discovery_Call) Run(run func()) *MockProvider_Discovery_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockProvider_Discovery_Call) Return(discoveryResponse *service.DiscoveryResponse) *MockProvider_Discovery_Call { + _c.Call.Return(discoveryResponse) + return _c +} + +func (_c *MockProvider_Discovery_Call) RunAndReturn(run func() *service.DiscoveryResponse) *MockProvider_Discovery_Call { + _c.Call.Return(run) + return _c +} + +// Exchange provides a mock function for the type MockProvider +func (_mock *MockProvider) Exchange(req service.TokenRequest) (*service.TokenResponse, error) { + ret := _mock.Called(req) + + if len(ret) == 0 { + panic("no return value specified for Exchange") + } + + var r0 *service.TokenResponse + var r1 error + if returnFunc, ok := ret.Get(0).(func(service.TokenRequest) (*service.TokenResponse, error)); ok { + return returnFunc(req) + } + if returnFunc, ok := ret.Get(0).(func(service.TokenRequest) *service.TokenResponse); ok { + r0 = returnFunc(req) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*service.TokenResponse) + } + } + if returnFunc, ok := ret.Get(1).(func(service.TokenRequest) error); ok { + r1 = returnFunc(req) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockProvider_Exchange_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Exchange' +type MockProvider_Exchange_Call struct { + *mock.Call +} + +// Exchange is a helper method to define mock.On call +// - req +func (_e *MockProvider_Expecter) Exchange(req interface{}) *MockProvider_Exchange_Call { + return &MockProvider_Exchange_Call{Call: _e.mock.On("Exchange", req)} +} + +func (_c *MockProvider_Exchange_Call) Run(run func(req service.TokenRequest)) *MockProvider_Exchange_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(service.TokenRequest)) + }) + return _c +} + +func (_c *MockProvider_Exchange_Call) Return(tokenResponse *service.TokenResponse, err error) *MockProvider_Exchange_Call { + _c.Call.Return(tokenResponse, err) + return _c +} + +func (_c *MockProvider_Exchange_Call) RunAndReturn(run func(req service.TokenRequest) (*service.TokenResponse, error)) *MockProvider_Exchange_Call { + _c.Call.Return(run) + return _c +} + +// GetCertificates provides a mock function for the type MockProvider +func (_mock *MockProvider) GetCertificates() *service.CertificatesResponse { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for GetCertificates") + } + + var r0 *service.CertificatesResponse + if returnFunc, ok := ret.Get(0).(func() *service.CertificatesResponse); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*service.CertificatesResponse) + } + } + return r0 +} + +// MockProvider_GetCertificates_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCertificates' +type MockProvider_GetCertificates_Call struct { + *mock.Call +} + +// GetCertificates is a helper method to define mock.On call +func (_e *MockProvider_Expecter) GetCertificates() *MockProvider_GetCertificates_Call { + return &MockProvider_GetCertificates_Call{Call: _e.mock.On("GetCertificates")} +} + +func (_c *MockProvider_GetCertificates_Call) Run(run func()) *MockProvider_GetCertificates_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockProvider_GetCertificates_Call) Return(certificatesResponse *service.CertificatesResponse) *MockProvider_GetCertificates_Call { + _c.Call.Return(certificatesResponse) + return _c +} + +func (_c *MockProvider_GetCertificates_Call) RunAndReturn(run func() *service.CertificatesResponse) *MockProvider_GetCertificates_Call { + _c.Call.Return(run) + return _c +} + +// Refresh provides a mock function for the type MockProvider +func (_mock *MockProvider) Refresh(refreshToken string) (*service.TokenResponse, error) { + ret := _mock.Called(refreshToken) + + if len(ret) == 0 { + panic("no return value specified for Refresh") + } + + var r0 *service.TokenResponse + var r1 error + if returnFunc, ok := ret.Get(0).(func(string) (*service.TokenResponse, error)); ok { + return returnFunc(refreshToken) + } + if returnFunc, ok := ret.Get(0).(func(string) *service.TokenResponse); ok { + r0 = returnFunc(refreshToken) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*service.TokenResponse) + } + } + if returnFunc, ok := ret.Get(1).(func(string) error); ok { + r1 = returnFunc(refreshToken) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockProvider_Refresh_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Refresh' +type MockProvider_Refresh_Call struct { + *mock.Call +} + +// Refresh is a helper method to define mock.On call +// - refreshToken +func (_e *MockProvider_Expecter) Refresh(refreshToken interface{}) *MockProvider_Refresh_Call { + return &MockProvider_Refresh_Call{Call: _e.mock.On("Refresh", refreshToken)} +} + +func (_c *MockProvider_Refresh_Call) Run(run func(refreshToken string)) *MockProvider_Refresh_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *MockProvider_Refresh_Call) Return(tokenResponse *service.TokenResponse, err error) *MockProvider_Refresh_Call { + _c.Call.Return(tokenResponse, err) + return _c +} + +func (_c *MockProvider_Refresh_Call) RunAndReturn(run func(refreshToken string) (*service.TokenResponse, error)) *MockProvider_Refresh_Call { + _c.Call.Return(run) + return _c +} diff --git a/mocks/github.com/int128/kubelogin/pkg/cmd_mock/mock_Interface.go b/mocks/github.com/int128/kubelogin/pkg/cmd_mock/mocks.go similarity index 70% rename from mocks/github.com/int128/kubelogin/pkg/cmd_mock/mock_Interface.go rename to mocks/github.com/int128/kubelogin/pkg/cmd_mock/mocks.go index 5cbc7a7..9fd4512 100644 --- a/mocks/github.com/int128/kubelogin/pkg/cmd_mock/mock_Interface.go +++ b/mocks/github.com/int128/kubelogin/pkg/cmd_mock/mocks.go @@ -1,74 +1,15 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package cmd_mock import ( - context "context" + "context" mock "github.com/stretchr/testify/mock" ) -// MockInterface is an autogenerated mock type for the Interface type -type MockInterface struct { - mock.Mock -} - -type MockInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *MockInterface) EXPECT() *MockInterface_Expecter { - return &MockInterface_Expecter{mock: &_m.Mock} -} - -// Run provides a mock function with given fields: ctx, args, version -func (_m *MockInterface) Run(ctx context.Context, args []string, version string) int { - ret := _m.Called(ctx, args, version) - - if len(ret) == 0 { - panic("no return value specified for Run") - } - - var r0 int - if rf, ok := ret.Get(0).(func(context.Context, []string, string) int); ok { - r0 = rf(ctx, args, version) - } else { - r0 = ret.Get(0).(int) - } - - return r0 -} - -// MockInterface_Run_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Run' -type MockInterface_Run_Call struct { - *mock.Call -} - -// Run is a helper method to define mock.On call -// - ctx context.Context -// - args []string -// - version string -func (_e *MockInterface_Expecter) Run(ctx interface{}, args interface{}, version interface{}) *MockInterface_Run_Call { - return &MockInterface_Run_Call{Call: _e.mock.On("Run", ctx, args, version)} -} - -func (_c *MockInterface_Run_Call) Run(run func(ctx context.Context, args []string, version string)) *MockInterface_Run_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].([]string), args[2].(string)) - }) - return _c -} - -func (_c *MockInterface_Run_Call) Return(_a0 int) *MockInterface_Run_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockInterface_Run_Call) RunAndReturn(run func(context.Context, []string, string) int) *MockInterface_Run_Call { - _c.Call.Return(run) - return _c -} - // NewMockInterface creates a new instance of MockInterface. 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 NewMockInterface(t interface { @@ -82,3 +23,63 @@ func NewMockInterface(t interface { return mock } + +// MockInterface is an autogenerated mock type for the Interface type +type MockInterface struct { + mock.Mock +} + +type MockInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockInterface) EXPECT() *MockInterface_Expecter { + return &MockInterface_Expecter{mock: &_m.Mock} +} + +// Run provides a mock function for the type MockInterface +func (_mock *MockInterface) Run(ctx context.Context, args []string, version string) int { + ret := _mock.Called(ctx, args, version) + + if len(ret) == 0 { + panic("no return value specified for Run") + } + + var r0 int + if returnFunc, ok := ret.Get(0).(func(context.Context, []string, string) int); ok { + r0 = returnFunc(ctx, args, version) + } else { + r0 = ret.Get(0).(int) + } + return r0 +} + +// MockInterface_Run_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Run' +type MockInterface_Run_Call struct { + *mock.Call +} + +// Run is a helper method to define mock.On call +// - ctx +// - args +// - version +func (_e *MockInterface_Expecter) Run(ctx interface{}, args interface{}, version interface{}) *MockInterface_Run_Call { + return &MockInterface_Run_Call{Call: _e.mock.On("Run", ctx, args, version)} +} + +func (_c *MockInterface_Run_Call) Run(run func(ctx context.Context, args []string, version string)) *MockInterface_Run_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].([]string), args[2].(string)) + }) + return _c +} + +func (_c *MockInterface_Run_Call) Return(n int) *MockInterface_Run_Call { + _c.Call.Return(n) + return _c +} + +func (_c *MockInterface_Run_Call) RunAndReturn(run func(ctx context.Context, args []string, version string) int) *MockInterface_Run_Call { + _c.Call.Return(run) + return _c +} diff --git a/mocks/github.com/int128/kubelogin/pkg/credentialplugin/reader_mock/mock_Interface.go b/mocks/github.com/int128/kubelogin/pkg/credentialplugin/reader_mock/mocks.go similarity index 70% rename from mocks/github.com/int128/kubelogin/pkg/credentialplugin/reader_mock/mock_Interface.go rename to mocks/github.com/int128/kubelogin/pkg/credentialplugin/reader_mock/mocks.go index 445a307..025c194 100644 --- a/mocks/github.com/int128/kubelogin/pkg/credentialplugin/reader_mock/mock_Interface.go +++ b/mocks/github.com/int128/kubelogin/pkg/credentialplugin/reader_mock/mocks.go @@ -1,12 +1,28 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package reader_mock import ( - credentialplugin "github.com/int128/kubelogin/pkg/credentialplugin" + "github.com/int128/kubelogin/pkg/credentialplugin" mock "github.com/stretchr/testify/mock" ) +// NewMockInterface creates a new instance of MockInterface. 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 NewMockInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockInterface { + mock := &MockInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // MockInterface is an autogenerated mock type for the Interface type type MockInterface struct { mock.Mock @@ -20,9 +36,9 @@ func (_m *MockInterface) EXPECT() *MockInterface_Expecter { return &MockInterface_Expecter{mock: &_m.Mock} } -// Read provides a mock function with no fields -func (_m *MockInterface) Read() (credentialplugin.Input, error) { - ret := _m.Called() +// Read provides a mock function for the type MockInterface +func (_mock *MockInterface) Read() (credentialplugin.Input, error) { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for Read") @@ -30,21 +46,19 @@ func (_m *MockInterface) Read() (credentialplugin.Input, error) { var r0 credentialplugin.Input var r1 error - if rf, ok := ret.Get(0).(func() (credentialplugin.Input, error)); ok { - return rf() + if returnFunc, ok := ret.Get(0).(func() (credentialplugin.Input, error)); ok { + return returnFunc() } - if rf, ok := ret.Get(0).(func() credentialplugin.Input); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() credentialplugin.Input); ok { + r0 = returnFunc() } else { r0 = ret.Get(0).(credentialplugin.Input) } - - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() + if returnFunc, ok := ret.Get(1).(func() error); ok { + r1 = returnFunc() } else { r1 = ret.Error(1) } - return r0, r1 } @@ -65,8 +79,8 @@ func (_c *MockInterface_Read_Call) Run(run func()) *MockInterface_Read_Call { return _c } -func (_c *MockInterface_Read_Call) Return(_a0 credentialplugin.Input, _a1 error) *MockInterface_Read_Call { - _c.Call.Return(_a0, _a1) +func (_c *MockInterface_Read_Call) Return(input credentialplugin.Input, err error) *MockInterface_Read_Call { + _c.Call.Return(input, err) return _c } @@ -74,17 +88,3 @@ func (_c *MockInterface_Read_Call) RunAndReturn(run func() (credentialplugin.Inp _c.Call.Return(run) return _c } - -// NewMockInterface creates a new instance of MockInterface. 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 NewMockInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *MockInterface { - mock := &MockInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/github.com/int128/kubelogin/pkg/credentialplugin/writer_mock/mock_Interface.go b/mocks/github.com/int128/kubelogin/pkg/credentialplugin/writer_mock/mocks.go similarity index 71% rename from mocks/github.com/int128/kubelogin/pkg/credentialplugin/writer_mock/mock_Interface.go rename to mocks/github.com/int128/kubelogin/pkg/credentialplugin/writer_mock/mocks.go index 1d648e3..685ae39 100644 --- a/mocks/github.com/int128/kubelogin/pkg/credentialplugin/writer_mock/mock_Interface.go +++ b/mocks/github.com/int128/kubelogin/pkg/credentialplugin/writer_mock/mocks.go @@ -1,71 +1,14 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package writer_mock import ( - credentialplugin "github.com/int128/kubelogin/pkg/credentialplugin" + "github.com/int128/kubelogin/pkg/credentialplugin" mock "github.com/stretchr/testify/mock" ) -// MockInterface is an autogenerated mock type for the Interface type -type MockInterface struct { - mock.Mock -} - -type MockInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *MockInterface) EXPECT() *MockInterface_Expecter { - return &MockInterface_Expecter{mock: &_m.Mock} -} - -// Write provides a mock function with given fields: out -func (_m *MockInterface) Write(out credentialplugin.Output) error { - ret := _m.Called(out) - - if len(ret) == 0 { - panic("no return value specified for Write") - } - - var r0 error - if rf, ok := ret.Get(0).(func(credentialplugin.Output) error); ok { - r0 = rf(out) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// MockInterface_Write_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Write' -type MockInterface_Write_Call struct { - *mock.Call -} - -// Write is a helper method to define mock.On call -// - out credentialplugin.Output -func (_e *MockInterface_Expecter) Write(out interface{}) *MockInterface_Write_Call { - return &MockInterface_Write_Call{Call: _e.mock.On("Write", out)} -} - -func (_c *MockInterface_Write_Call) Run(run func(out credentialplugin.Output)) *MockInterface_Write_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(credentialplugin.Output)) - }) - return _c -} - -func (_c *MockInterface_Write_Call) Return(_a0 error) *MockInterface_Write_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockInterface_Write_Call) RunAndReturn(run func(credentialplugin.Output) error) *MockInterface_Write_Call { - _c.Call.Return(run) - return _c -} - // NewMockInterface creates a new instance of MockInterface. 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 NewMockInterface(t interface { @@ -79,3 +22,61 @@ func NewMockInterface(t interface { return mock } + +// MockInterface is an autogenerated mock type for the Interface type +type MockInterface struct { + mock.Mock +} + +type MockInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockInterface) EXPECT() *MockInterface_Expecter { + return &MockInterface_Expecter{mock: &_m.Mock} +} + +// Write provides a mock function for the type MockInterface +func (_mock *MockInterface) Write(out credentialplugin.Output) error { + ret := _mock.Called(out) + + if len(ret) == 0 { + panic("no return value specified for Write") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(credentialplugin.Output) error); ok { + r0 = returnFunc(out) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockInterface_Write_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Write' +type MockInterface_Write_Call struct { + *mock.Call +} + +// Write is a helper method to define mock.On call +// - out +func (_e *MockInterface_Expecter) Write(out interface{}) *MockInterface_Write_Call { + return &MockInterface_Write_Call{Call: _e.mock.On("Write", out)} +} + +func (_c *MockInterface_Write_Call) Run(run func(out credentialplugin.Output)) *MockInterface_Write_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(credentialplugin.Output)) + }) + return _c +} + +func (_c *MockInterface_Write_Call) Return(err error) *MockInterface_Write_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockInterface_Write_Call) RunAndReturn(run func(out credentialplugin.Output) error) *MockInterface_Write_Call { + _c.Call.Return(run) + return _c +} diff --git a/mocks/github.com/int128/kubelogin/pkg/infrastructure/browser_mock/mock_Interface.go b/mocks/github.com/int128/kubelogin/pkg/infrastructure/browser_mock/mocks.go similarity index 70% rename from mocks/github.com/int128/kubelogin/pkg/infrastructure/browser_mock/mock_Interface.go rename to mocks/github.com/int128/kubelogin/pkg/infrastructure/browser_mock/mocks.go index 665ee59..64bff11 100644 --- a/mocks/github.com/int128/kubelogin/pkg/infrastructure/browser_mock/mock_Interface.go +++ b/mocks/github.com/int128/kubelogin/pkg/infrastructure/browser_mock/mocks.go @@ -1,120 +1,15 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package browser_mock import ( - context "context" + "context" mock "github.com/stretchr/testify/mock" ) -// MockInterface is an autogenerated mock type for the Interface type -type MockInterface struct { - mock.Mock -} - -type MockInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *MockInterface) EXPECT() *MockInterface_Expecter { - return &MockInterface_Expecter{mock: &_m.Mock} -} - -// Open provides a mock function with given fields: url -func (_m *MockInterface) Open(url string) error { - ret := _m.Called(url) - - if len(ret) == 0 { - panic("no return value specified for Open") - } - - var r0 error - if rf, ok := ret.Get(0).(func(string) error); ok { - r0 = rf(url) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// MockInterface_Open_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Open' -type MockInterface_Open_Call struct { - *mock.Call -} - -// Open is a helper method to define mock.On call -// - url string -func (_e *MockInterface_Expecter) Open(url interface{}) *MockInterface_Open_Call { - return &MockInterface_Open_Call{Call: _e.mock.On("Open", url)} -} - -func (_c *MockInterface_Open_Call) Run(run func(url string)) *MockInterface_Open_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(string)) - }) - return _c -} - -func (_c *MockInterface_Open_Call) Return(_a0 error) *MockInterface_Open_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockInterface_Open_Call) RunAndReturn(run func(string) error) *MockInterface_Open_Call { - _c.Call.Return(run) - return _c -} - -// OpenCommand provides a mock function with given fields: ctx, url, command -func (_m *MockInterface) OpenCommand(ctx context.Context, url string, command string) error { - ret := _m.Called(ctx, url, command) - - if len(ret) == 0 { - panic("no return value specified for OpenCommand") - } - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, string, string) error); ok { - r0 = rf(ctx, url, command) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// MockInterface_OpenCommand_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OpenCommand' -type MockInterface_OpenCommand_Call struct { - *mock.Call -} - -// OpenCommand is a helper method to define mock.On call -// - ctx context.Context -// - url string -// - command string -func (_e *MockInterface_Expecter) OpenCommand(ctx interface{}, url interface{}, command interface{}) *MockInterface_OpenCommand_Call { - return &MockInterface_OpenCommand_Call{Call: _e.mock.On("OpenCommand", ctx, url, command)} -} - -func (_c *MockInterface_OpenCommand_Call) Run(run func(ctx context.Context, url string, command string)) *MockInterface_OpenCommand_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(string), args[2].(string)) - }) - return _c -} - -func (_c *MockInterface_OpenCommand_Call) Return(_a0 error) *MockInterface_OpenCommand_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockInterface_OpenCommand_Call) RunAndReturn(run func(context.Context, string, string) error) *MockInterface_OpenCommand_Call { - _c.Call.Return(run) - return _c -} - // NewMockInterface creates a new instance of MockInterface. 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 NewMockInterface(t interface { @@ -128,3 +23,108 @@ func NewMockInterface(t interface { return mock } + +// MockInterface is an autogenerated mock type for the Interface type +type MockInterface struct { + mock.Mock +} + +type MockInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockInterface) EXPECT() *MockInterface_Expecter { + return &MockInterface_Expecter{mock: &_m.Mock} +} + +// Open provides a mock function for the type MockInterface +func (_mock *MockInterface) Open(url string) error { + ret := _mock.Called(url) + + if len(ret) == 0 { + panic("no return value specified for Open") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(string) error); ok { + r0 = returnFunc(url) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockInterface_Open_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Open' +type MockInterface_Open_Call struct { + *mock.Call +} + +// Open is a helper method to define mock.On call +// - url +func (_e *MockInterface_Expecter) Open(url interface{}) *MockInterface_Open_Call { + return &MockInterface_Open_Call{Call: _e.mock.On("Open", url)} +} + +func (_c *MockInterface_Open_Call) Run(run func(url string)) *MockInterface_Open_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *MockInterface_Open_Call) Return(err error) *MockInterface_Open_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockInterface_Open_Call) RunAndReturn(run func(url string) error) *MockInterface_Open_Call { + _c.Call.Return(run) + return _c +} + +// OpenCommand provides a mock function for the type MockInterface +func (_mock *MockInterface) OpenCommand(ctx context.Context, url string, command string) error { + ret := _mock.Called(ctx, url, command) + + if len(ret) == 0 { + panic("no return value specified for OpenCommand") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) error); ok { + r0 = returnFunc(ctx, url, command) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockInterface_OpenCommand_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OpenCommand' +type MockInterface_OpenCommand_Call struct { + *mock.Call +} + +// OpenCommand is a helper method to define mock.On call +// - ctx +// - url +// - command +func (_e *MockInterface_Expecter) OpenCommand(ctx interface{}, url interface{}, command interface{}) *MockInterface_OpenCommand_Call { + return &MockInterface_OpenCommand_Call{Call: _e.mock.On("OpenCommand", ctx, url, command)} +} + +func (_c *MockInterface_OpenCommand_Call) Run(run func(ctx context.Context, url string, command string)) *MockInterface_OpenCommand_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockInterface_OpenCommand_Call) Return(err error) *MockInterface_OpenCommand_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockInterface_OpenCommand_Call) RunAndReturn(run func(ctx context.Context, url string, command string) error) *MockInterface_OpenCommand_Call { + _c.Call.Return(run) + return _c +} diff --git a/mocks/github.com/int128/kubelogin/pkg/infrastructure/clock_mock/mock_Interface.go b/mocks/github.com/int128/kubelogin/pkg/infrastructure/clock_mock/mocks.go similarity index 78% rename from mocks/github.com/int128/kubelogin/pkg/infrastructure/clock_mock/mock_Interface.go rename to mocks/github.com/int128/kubelogin/pkg/infrastructure/clock_mock/mocks.go index dd4e5b8..5daa2ca 100644 --- a/mocks/github.com/int128/kubelogin/pkg/infrastructure/clock_mock/mock_Interface.go +++ b/mocks/github.com/int128/kubelogin/pkg/infrastructure/clock_mock/mocks.go @@ -1,13 +1,29 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package clock_mock import ( - time "time" + "time" mock "github.com/stretchr/testify/mock" ) +// NewMockInterface creates a new instance of MockInterface. 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 NewMockInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockInterface { + mock := &MockInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // MockInterface is an autogenerated mock type for the Interface type type MockInterface struct { mock.Mock @@ -21,21 +37,20 @@ func (_m *MockInterface) EXPECT() *MockInterface_Expecter { return &MockInterface_Expecter{mock: &_m.Mock} } -// Now provides a mock function with no fields -func (_m *MockInterface) Now() time.Time { - ret := _m.Called() +// Now provides a mock function for the type MockInterface +func (_mock *MockInterface) Now() time.Time { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for Now") } var r0 time.Time - if rf, ok := ret.Get(0).(func() time.Time); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() time.Time); ok { + r0 = returnFunc() } else { r0 = ret.Get(0).(time.Time) } - return r0 } @@ -56,8 +71,8 @@ func (_c *MockInterface_Now_Call) Run(run func()) *MockInterface_Now_Call { return _c } -func (_c *MockInterface_Now_Call) Return(_a0 time.Time) *MockInterface_Now_Call { - _c.Call.Return(_a0) +func (_c *MockInterface_Now_Call) Return(time1 time.Time) *MockInterface_Now_Call { + _c.Call.Return(time1) return _c } @@ -65,17 +80,3 @@ func (_c *MockInterface_Now_Call) RunAndReturn(run func() time.Time) *MockInterf _c.Call.Return(run) return _c } - -// NewMockInterface creates a new instance of MockInterface. 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 NewMockInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *MockInterface { - mock := &MockInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/github.com/int128/kubelogin/pkg/infrastructure/logger_mock/mock_Interface.go b/mocks/github.com/int128/kubelogin/pkg/infrastructure/logger_mock/mock_Interface.go deleted file mode 100644 index bb824ba..0000000 --- a/mocks/github.com/int128/kubelogin/pkg/infrastructure/logger_mock/mock_Interface.go +++ /dev/null @@ -1,208 +0,0 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. - -package logger_mock - -import ( - logger "github.com/int128/kubelogin/pkg/infrastructure/logger" - mock "github.com/stretchr/testify/mock" - - pflag "github.com/spf13/pflag" -) - -// MockInterface is an autogenerated mock type for the Interface type -type MockInterface struct { - mock.Mock -} - -type MockInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *MockInterface) EXPECT() *MockInterface_Expecter { - return &MockInterface_Expecter{mock: &_m.Mock} -} - -// AddFlags provides a mock function with given fields: f -func (_m *MockInterface) AddFlags(f *pflag.FlagSet) { - _m.Called(f) -} - -// MockInterface_AddFlags_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddFlags' -type MockInterface_AddFlags_Call struct { - *mock.Call -} - -// AddFlags is a helper method to define mock.On call -// - f *pflag.FlagSet -func (_e *MockInterface_Expecter) AddFlags(f interface{}) *MockInterface_AddFlags_Call { - return &MockInterface_AddFlags_Call{Call: _e.mock.On("AddFlags", f)} -} - -func (_c *MockInterface_AddFlags_Call) Run(run func(f *pflag.FlagSet)) *MockInterface_AddFlags_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*pflag.FlagSet)) - }) - return _c -} - -func (_c *MockInterface_AddFlags_Call) Return() *MockInterface_AddFlags_Call { - _c.Call.Return() - return _c -} - -func (_c *MockInterface_AddFlags_Call) RunAndReturn(run func(*pflag.FlagSet)) *MockInterface_AddFlags_Call { - _c.Run(run) - return _c -} - -// IsEnabled provides a mock function with given fields: level -func (_m *MockInterface) IsEnabled(level int) bool { - ret := _m.Called(level) - - if len(ret) == 0 { - panic("no return value specified for IsEnabled") - } - - var r0 bool - if rf, ok := ret.Get(0).(func(int) bool); ok { - r0 = rf(level) - } else { - r0 = ret.Get(0).(bool) - } - - return r0 -} - -// MockInterface_IsEnabled_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsEnabled' -type MockInterface_IsEnabled_Call struct { - *mock.Call -} - -// IsEnabled is a helper method to define mock.On call -// - level int -func (_e *MockInterface_Expecter) IsEnabled(level interface{}) *MockInterface_IsEnabled_Call { - return &MockInterface_IsEnabled_Call{Call: _e.mock.On("IsEnabled", level)} -} - -func (_c *MockInterface_IsEnabled_Call) Run(run func(level int)) *MockInterface_IsEnabled_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(int)) - }) - return _c -} - -func (_c *MockInterface_IsEnabled_Call) Return(_a0 bool) *MockInterface_IsEnabled_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockInterface_IsEnabled_Call) RunAndReturn(run func(int) bool) *MockInterface_IsEnabled_Call { - _c.Call.Return(run) - return _c -} - -// Printf provides a mock function with given fields: format, args -func (_m *MockInterface) Printf(format string, args ...interface{}) { - var _ca []interface{} - _ca = append(_ca, format) - _ca = append(_ca, args...) - _m.Called(_ca...) -} - -// MockInterface_Printf_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Printf' -type MockInterface_Printf_Call struct { - *mock.Call -} - -// Printf is a helper method to define mock.On call -// - format string -// - args ...interface{} -func (_e *MockInterface_Expecter) Printf(format interface{}, args ...interface{}) *MockInterface_Printf_Call { - return &MockInterface_Printf_Call{Call: _e.mock.On("Printf", - append([]interface{}{format}, args...)...)} -} - -func (_c *MockInterface_Printf_Call) Run(run func(format string, args ...interface{})) *MockInterface_Printf_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]interface{}, len(args)-1) - for i, a := range args[1:] { - if a != nil { - variadicArgs[i] = a.(interface{}) - } - } - run(args[0].(string), variadicArgs...) - }) - return _c -} - -func (_c *MockInterface_Printf_Call) Return() *MockInterface_Printf_Call { - _c.Call.Return() - return _c -} - -func (_c *MockInterface_Printf_Call) RunAndReturn(run func(string, ...interface{})) *MockInterface_Printf_Call { - _c.Run(run) - return _c -} - -// V provides a mock function with given fields: level -func (_m *MockInterface) V(level int) logger.Verbose { - ret := _m.Called(level) - - if len(ret) == 0 { - panic("no return value specified for V") - } - - var r0 logger.Verbose - if rf, ok := ret.Get(0).(func(int) logger.Verbose); ok { - r0 = rf(level) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(logger.Verbose) - } - } - - return r0 -} - -// MockInterface_V_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'V' -type MockInterface_V_Call struct { - *mock.Call -} - -// V is a helper method to define mock.On call -// - level int -func (_e *MockInterface_Expecter) V(level interface{}) *MockInterface_V_Call { - return &MockInterface_V_Call{Call: _e.mock.On("V", level)} -} - -func (_c *MockInterface_V_Call) Run(run func(level int)) *MockInterface_V_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(int)) - }) - return _c -} - -func (_c *MockInterface_V_Call) Return(_a0 logger.Verbose) *MockInterface_V_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockInterface_V_Call) RunAndReturn(run func(int) logger.Verbose) *MockInterface_V_Call { - _c.Call.Return(run) - return _c -} - -// NewMockInterface creates a new instance of MockInterface. 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 NewMockInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *MockInterface { - mock := &MockInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/github.com/int128/kubelogin/pkg/infrastructure/logger_mock/mock_Verbose.go b/mocks/github.com/int128/kubelogin/pkg/infrastructure/logger_mock/mock_Verbose.go deleted file mode 100644 index b5f5430..0000000 --- a/mocks/github.com/int128/kubelogin/pkg/infrastructure/logger_mock/mock_Verbose.go +++ /dev/null @@ -1,76 +0,0 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. - -package logger_mock - -import mock "github.com/stretchr/testify/mock" - -// MockVerbose is an autogenerated mock type for the Verbose type -type MockVerbose struct { - mock.Mock -} - -type MockVerbose_Expecter struct { - mock *mock.Mock -} - -func (_m *MockVerbose) EXPECT() *MockVerbose_Expecter { - return &MockVerbose_Expecter{mock: &_m.Mock} -} - -// Infof provides a mock function with given fields: format, args -func (_m *MockVerbose) Infof(format string, args ...interface{}) { - var _ca []interface{} - _ca = append(_ca, format) - _ca = append(_ca, args...) - _m.Called(_ca...) -} - -// MockVerbose_Infof_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Infof' -type MockVerbose_Infof_Call struct { - *mock.Call -} - -// Infof is a helper method to define mock.On call -// - format string -// - args ...interface{} -func (_e *MockVerbose_Expecter) Infof(format interface{}, args ...interface{}) *MockVerbose_Infof_Call { - return &MockVerbose_Infof_Call{Call: _e.mock.On("Infof", - append([]interface{}{format}, args...)...)} -} - -func (_c *MockVerbose_Infof_Call) Run(run func(format string, args ...interface{})) *MockVerbose_Infof_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]interface{}, len(args)-1) - for i, a := range args[1:] { - if a != nil { - variadicArgs[i] = a.(interface{}) - } - } - run(args[0].(string), variadicArgs...) - }) - return _c -} - -func (_c *MockVerbose_Infof_Call) Return() *MockVerbose_Infof_Call { - _c.Call.Return() - return _c -} - -func (_c *MockVerbose_Infof_Call) RunAndReturn(run func(string, ...interface{})) *MockVerbose_Infof_Call { - _c.Run(run) - return _c -} - -// NewMockVerbose creates a new instance of MockVerbose. 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 NewMockVerbose(t interface { - mock.TestingT - Cleanup(func()) -}) *MockVerbose { - mock := &MockVerbose{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/github.com/int128/kubelogin/pkg/infrastructure/logger_mock/mock_goLogger.go b/mocks/github.com/int128/kubelogin/pkg/infrastructure/logger_mock/mock_goLogger.go deleted file mode 100644 index 1787083..0000000 --- a/mocks/github.com/int128/kubelogin/pkg/infrastructure/logger_mock/mock_goLogger.go +++ /dev/null @@ -1,76 +0,0 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. - -package logger_mock - -import mock "github.com/stretchr/testify/mock" - -// MockgoLogger is an autogenerated mock type for the goLogger type -type MockgoLogger struct { - mock.Mock -} - -type MockgoLogger_Expecter struct { - mock *mock.Mock -} - -func (_m *MockgoLogger) EXPECT() *MockgoLogger_Expecter { - return &MockgoLogger_Expecter{mock: &_m.Mock} -} - -// Printf provides a mock function with given fields: format, v -func (_m *MockgoLogger) Printf(format string, v ...interface{}) { - var _ca []interface{} - _ca = append(_ca, format) - _ca = append(_ca, v...) - _m.Called(_ca...) -} - -// MockgoLogger_Printf_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Printf' -type MockgoLogger_Printf_Call struct { - *mock.Call -} - -// Printf is a helper method to define mock.On call -// - format string -// - v ...interface{} -func (_e *MockgoLogger_Expecter) Printf(format interface{}, v ...interface{}) *MockgoLogger_Printf_Call { - return &MockgoLogger_Printf_Call{Call: _e.mock.On("Printf", - append([]interface{}{format}, v...)...)} -} - -func (_c *MockgoLogger_Printf_Call) Run(run func(format string, v ...interface{})) *MockgoLogger_Printf_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]interface{}, len(args)-1) - for i, a := range args[1:] { - if a != nil { - variadicArgs[i] = a.(interface{}) - } - } - run(args[0].(string), variadicArgs...) - }) - return _c -} - -func (_c *MockgoLogger_Printf_Call) Return() *MockgoLogger_Printf_Call { - _c.Call.Return() - return _c -} - -func (_c *MockgoLogger_Printf_Call) RunAndReturn(run func(string, ...interface{})) *MockgoLogger_Printf_Call { - _c.Run(run) - return _c -} - -// NewMockgoLogger creates a new instance of MockgoLogger. 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 NewMockgoLogger(t interface { - mock.TestingT - Cleanup(func()) -}) *MockgoLogger { - mock := &MockgoLogger{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/github.com/int128/kubelogin/pkg/infrastructure/logger_mock/mocks.go b/mocks/github.com/int128/kubelogin/pkg/infrastructure/logger_mock/mocks.go new file mode 100644 index 0000000..51301f6 --- /dev/null +++ b/mocks/github.com/int128/kubelogin/pkg/infrastructure/logger_mock/mocks.go @@ -0,0 +1,344 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package logger_mock + +import ( + "github.com/int128/kubelogin/pkg/infrastructure/logger" + "github.com/spf13/pflag" + mock "github.com/stretchr/testify/mock" +) + +// NewMockInterface creates a new instance of MockInterface. 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 NewMockInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockInterface { + mock := &MockInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MockInterface is an autogenerated mock type for the Interface type +type MockInterface struct { + mock.Mock +} + +type MockInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockInterface) EXPECT() *MockInterface_Expecter { + return &MockInterface_Expecter{mock: &_m.Mock} +} + +// AddFlags provides a mock function for the type MockInterface +func (_mock *MockInterface) AddFlags(f *pflag.FlagSet) { + _mock.Called(f) + return +} + +// MockInterface_AddFlags_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddFlags' +type MockInterface_AddFlags_Call struct { + *mock.Call +} + +// AddFlags is a helper method to define mock.On call +// - f +func (_e *MockInterface_Expecter) AddFlags(f interface{}) *MockInterface_AddFlags_Call { + return &MockInterface_AddFlags_Call{Call: _e.mock.On("AddFlags", f)} +} + +func (_c *MockInterface_AddFlags_Call) Run(run func(f *pflag.FlagSet)) *MockInterface_AddFlags_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*pflag.FlagSet)) + }) + return _c +} + +func (_c *MockInterface_AddFlags_Call) Return() *MockInterface_AddFlags_Call { + _c.Call.Return() + return _c +} + +func (_c *MockInterface_AddFlags_Call) RunAndReturn(run func(f *pflag.FlagSet)) *MockInterface_AddFlags_Call { + _c.Run(run) + return _c +} + +// IsEnabled provides a mock function for the type MockInterface +func (_mock *MockInterface) IsEnabled(level int) bool { + ret := _mock.Called(level) + + if len(ret) == 0 { + panic("no return value specified for IsEnabled") + } + + var r0 bool + if returnFunc, ok := ret.Get(0).(func(int) bool); ok { + r0 = returnFunc(level) + } else { + r0 = ret.Get(0).(bool) + } + return r0 +} + +// MockInterface_IsEnabled_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsEnabled' +type MockInterface_IsEnabled_Call struct { + *mock.Call +} + +// IsEnabled is a helper method to define mock.On call +// - level +func (_e *MockInterface_Expecter) IsEnabled(level interface{}) *MockInterface_IsEnabled_Call { + return &MockInterface_IsEnabled_Call{Call: _e.mock.On("IsEnabled", level)} +} + +func (_c *MockInterface_IsEnabled_Call) Run(run func(level int)) *MockInterface_IsEnabled_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(int)) + }) + return _c +} + +func (_c *MockInterface_IsEnabled_Call) Return(b bool) *MockInterface_IsEnabled_Call { + _c.Call.Return(b) + return _c +} + +func (_c *MockInterface_IsEnabled_Call) RunAndReturn(run func(level int) bool) *MockInterface_IsEnabled_Call { + _c.Call.Return(run) + return _c +} + +// Printf provides a mock function for the type MockInterface +func (_mock *MockInterface) Printf(format string, args ...interface{}) { + if len(args) > 0 { + _mock.Called(format, args) + } else { + _mock.Called(format) + } + + return +} + +// MockInterface_Printf_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Printf' +type MockInterface_Printf_Call struct { + *mock.Call +} + +// Printf is a helper method to define mock.On call +// - format +// - args +func (_e *MockInterface_Expecter) Printf(format interface{}, args ...interface{}) *MockInterface_Printf_Call { + return &MockInterface_Printf_Call{Call: _e.mock.On("Printf", + append([]interface{}{format}, args...)...)} +} + +func (_c *MockInterface_Printf_Call) Run(run func(format string, args ...interface{})) *MockInterface_Printf_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := args[1].([]interface{}) + run(args[0].(string), variadicArgs...) + }) + return _c +} + +func (_c *MockInterface_Printf_Call) Return() *MockInterface_Printf_Call { + _c.Call.Return() + return _c +} + +func (_c *MockInterface_Printf_Call) RunAndReturn(run func(format string, args ...interface{})) *MockInterface_Printf_Call { + _c.Run(run) + return _c +} + +// V provides a mock function for the type MockInterface +func (_mock *MockInterface) V(level int) logger.Verbose { + ret := _mock.Called(level) + + if len(ret) == 0 { + panic("no return value specified for V") + } + + var r0 logger.Verbose + if returnFunc, ok := ret.Get(0).(func(int) logger.Verbose); ok { + r0 = returnFunc(level) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(logger.Verbose) + } + } + return r0 +} + +// MockInterface_V_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'V' +type MockInterface_V_Call struct { + *mock.Call +} + +// V is a helper method to define mock.On call +// - level +func (_e *MockInterface_Expecter) V(level interface{}) *MockInterface_V_Call { + return &MockInterface_V_Call{Call: _e.mock.On("V", level)} +} + +func (_c *MockInterface_V_Call) Run(run func(level int)) *MockInterface_V_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(int)) + }) + return _c +} + +func (_c *MockInterface_V_Call) Return(verbose logger.Verbose) *MockInterface_V_Call { + _c.Call.Return(verbose) + return _c +} + +func (_c *MockInterface_V_Call) RunAndReturn(run func(level int) logger.Verbose) *MockInterface_V_Call { + _c.Call.Return(run) + return _c +} + +// NewMockVerbose creates a new instance of MockVerbose. 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 NewMockVerbose(t interface { + mock.TestingT + Cleanup(func()) +}) *MockVerbose { + mock := &MockVerbose{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MockVerbose is an autogenerated mock type for the Verbose type +type MockVerbose struct { + mock.Mock +} + +type MockVerbose_Expecter struct { + mock *mock.Mock +} + +func (_m *MockVerbose) EXPECT() *MockVerbose_Expecter { + return &MockVerbose_Expecter{mock: &_m.Mock} +} + +// Infof provides a mock function for the type MockVerbose +func (_mock *MockVerbose) Infof(format string, args ...interface{}) { + if len(args) > 0 { + _mock.Called(format, args) + } else { + _mock.Called(format) + } + + return +} + +// MockVerbose_Infof_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Infof' +type MockVerbose_Infof_Call struct { + *mock.Call +} + +// Infof is a helper method to define mock.On call +// - format +// - args +func (_e *MockVerbose_Expecter) Infof(format interface{}, args ...interface{}) *MockVerbose_Infof_Call { + return &MockVerbose_Infof_Call{Call: _e.mock.On("Infof", + append([]interface{}{format}, args...)...)} +} + +func (_c *MockVerbose_Infof_Call) Run(run func(format string, args ...interface{})) *MockVerbose_Infof_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := args[1].([]interface{}) + run(args[0].(string), variadicArgs...) + }) + return _c +} + +func (_c *MockVerbose_Infof_Call) Return() *MockVerbose_Infof_Call { + _c.Call.Return() + return _c +} + +func (_c *MockVerbose_Infof_Call) RunAndReturn(run func(format string, args ...interface{})) *MockVerbose_Infof_Call { + _c.Run(run) + return _c +} + +// newMockgoLogger creates a new instance of mockgoLogger. 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 newMockgoLogger(t interface { + mock.TestingT + Cleanup(func()) +}) *mockgoLogger { + mock := &mockgoLogger{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// mockgoLogger is an autogenerated mock type for the goLogger type +type mockgoLogger struct { + mock.Mock +} + +type mockgoLogger_Expecter struct { + mock *mock.Mock +} + +func (_m *mockgoLogger) EXPECT() *mockgoLogger_Expecter { + return &mockgoLogger_Expecter{mock: &_m.Mock} +} + +// Printf provides a mock function for the type mockgoLogger +func (_mock *mockgoLogger) Printf(format string, v ...interface{}) { + if len(v) > 0 { + _mock.Called(format, v) + } else { + _mock.Called(format) + } + + return +} + +// mockgoLogger_Printf_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Printf' +type mockgoLogger_Printf_Call struct { + *mock.Call +} + +// Printf is a helper method to define mock.On call +// - format +// - v +func (_e *mockgoLogger_Expecter) Printf(format interface{}, v ...interface{}) *mockgoLogger_Printf_Call { + return &mockgoLogger_Printf_Call{Call: _e.mock.On("Printf", + append([]interface{}{format}, v...)...)} +} + +func (_c *mockgoLogger_Printf_Call) Run(run func(format string, v ...interface{})) *mockgoLogger_Printf_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := args[1].([]interface{}) + run(args[0].(string), variadicArgs...) + }) + return _c +} + +func (_c *mockgoLogger_Printf_Call) Return() *mockgoLogger_Printf_Call { + _c.Call.Return() + return _c +} + +func (_c *mockgoLogger_Printf_Call) RunAndReturn(run func(format string, v ...interface{})) *mockgoLogger_Printf_Call { + _c.Run(run) + return _c +} diff --git a/mocks/github.com/int128/kubelogin/pkg/infrastructure/reader_mock/mock_Interface.go b/mocks/github.com/int128/kubelogin/pkg/infrastructure/reader_mock/mocks.go similarity index 62% rename from mocks/github.com/int128/kubelogin/pkg/infrastructure/reader_mock/mock_Interface.go rename to mocks/github.com/int128/kubelogin/pkg/infrastructure/reader_mock/mocks.go index ec1e8d2..4b988c0 100644 --- a/mocks/github.com/int128/kubelogin/pkg/infrastructure/reader_mock/mock_Interface.go +++ b/mocks/github.com/int128/kubelogin/pkg/infrastructure/reader_mock/mocks.go @@ -1,133 +1,12 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package reader_mock -import mock "github.com/stretchr/testify/mock" - -// MockInterface is an autogenerated mock type for the Interface type -type MockInterface struct { - mock.Mock -} - -type MockInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *MockInterface) EXPECT() *MockInterface_Expecter { - return &MockInterface_Expecter{mock: &_m.Mock} -} - -// ReadPassword provides a mock function with given fields: prompt -func (_m *MockInterface) ReadPassword(prompt string) (string, error) { - ret := _m.Called(prompt) - - if len(ret) == 0 { - panic("no return value specified for ReadPassword") - } - - var r0 string - var r1 error - if rf, ok := ret.Get(0).(func(string) (string, error)); ok { - return rf(prompt) - } - if rf, ok := ret.Get(0).(func(string) string); ok { - r0 = rf(prompt) - } else { - r0 = ret.Get(0).(string) - } - - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(prompt) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockInterface_ReadPassword_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReadPassword' -type MockInterface_ReadPassword_Call struct { - *mock.Call -} - -// ReadPassword is a helper method to define mock.On call -// - prompt string -func (_e *MockInterface_Expecter) ReadPassword(prompt interface{}) *MockInterface_ReadPassword_Call { - return &MockInterface_ReadPassword_Call{Call: _e.mock.On("ReadPassword", prompt)} -} - -func (_c *MockInterface_ReadPassword_Call) Run(run func(prompt string)) *MockInterface_ReadPassword_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(string)) - }) - return _c -} - -func (_c *MockInterface_ReadPassword_Call) Return(_a0 string, _a1 error) *MockInterface_ReadPassword_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockInterface_ReadPassword_Call) RunAndReturn(run func(string) (string, error)) *MockInterface_ReadPassword_Call { - _c.Call.Return(run) - return _c -} - -// ReadString provides a mock function with given fields: prompt -func (_m *MockInterface) ReadString(prompt string) (string, error) { - ret := _m.Called(prompt) - - if len(ret) == 0 { - panic("no return value specified for ReadString") - } - - var r0 string - var r1 error - if rf, ok := ret.Get(0).(func(string) (string, error)); ok { - return rf(prompt) - } - if rf, ok := ret.Get(0).(func(string) string); ok { - r0 = rf(prompt) - } else { - r0 = ret.Get(0).(string) - } - - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(prompt) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockInterface_ReadString_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReadString' -type MockInterface_ReadString_Call struct { - *mock.Call -} - -// ReadString is a helper method to define mock.On call -// - prompt string -func (_e *MockInterface_Expecter) ReadString(prompt interface{}) *MockInterface_ReadString_Call { - return &MockInterface_ReadString_Call{Call: _e.mock.On("ReadString", prompt)} -} - -func (_c *MockInterface_ReadString_Call) Run(run func(prompt string)) *MockInterface_ReadString_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(string)) - }) - return _c -} - -func (_c *MockInterface_ReadString_Call) Return(_a0 string, _a1 error) *MockInterface_ReadString_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockInterface_ReadString_Call) RunAndReturn(run func(string) (string, error)) *MockInterface_ReadString_Call { - _c.Call.Return(run) - return _c -} +import ( + mock "github.com/stretchr/testify/mock" +) // NewMockInterface creates a new instance of MockInterface. 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. @@ -142,3 +21,124 @@ func NewMockInterface(t interface { return mock } + +// MockInterface is an autogenerated mock type for the Interface type +type MockInterface struct { + mock.Mock +} + +type MockInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockInterface) EXPECT() *MockInterface_Expecter { + return &MockInterface_Expecter{mock: &_m.Mock} +} + +// ReadPassword provides a mock function for the type MockInterface +func (_mock *MockInterface) ReadPassword(prompt string) (string, error) { + ret := _mock.Called(prompt) + + if len(ret) == 0 { + panic("no return value specified for ReadPassword") + } + + var r0 string + var r1 error + if returnFunc, ok := ret.Get(0).(func(string) (string, error)); ok { + return returnFunc(prompt) + } + if returnFunc, ok := ret.Get(0).(func(string) string); ok { + r0 = returnFunc(prompt) + } else { + r0 = ret.Get(0).(string) + } + if returnFunc, ok := ret.Get(1).(func(string) error); ok { + r1 = returnFunc(prompt) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockInterface_ReadPassword_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReadPassword' +type MockInterface_ReadPassword_Call struct { + *mock.Call +} + +// ReadPassword is a helper method to define mock.On call +// - prompt +func (_e *MockInterface_Expecter) ReadPassword(prompt interface{}) *MockInterface_ReadPassword_Call { + return &MockInterface_ReadPassword_Call{Call: _e.mock.On("ReadPassword", prompt)} +} + +func (_c *MockInterface_ReadPassword_Call) Run(run func(prompt string)) *MockInterface_ReadPassword_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *MockInterface_ReadPassword_Call) Return(s string, err error) *MockInterface_ReadPassword_Call { + _c.Call.Return(s, err) + return _c +} + +func (_c *MockInterface_ReadPassword_Call) RunAndReturn(run func(prompt string) (string, error)) *MockInterface_ReadPassword_Call { + _c.Call.Return(run) + return _c +} + +// ReadString provides a mock function for the type MockInterface +func (_mock *MockInterface) ReadString(prompt string) (string, error) { + ret := _mock.Called(prompt) + + if len(ret) == 0 { + panic("no return value specified for ReadString") + } + + var r0 string + var r1 error + if returnFunc, ok := ret.Get(0).(func(string) (string, error)); ok { + return returnFunc(prompt) + } + if returnFunc, ok := ret.Get(0).(func(string) string); ok { + r0 = returnFunc(prompt) + } else { + r0 = ret.Get(0).(string) + } + if returnFunc, ok := ret.Get(1).(func(string) error); ok { + r1 = returnFunc(prompt) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockInterface_ReadString_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReadString' +type MockInterface_ReadString_Call struct { + *mock.Call +} + +// ReadString is a helper method to define mock.On call +// - prompt +func (_e *MockInterface_Expecter) ReadString(prompt interface{}) *MockInterface_ReadString_Call { + return &MockInterface_ReadString_Call{Call: _e.mock.On("ReadString", prompt)} +} + +func (_c *MockInterface_ReadString_Call) Run(run func(prompt string)) *MockInterface_ReadString_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *MockInterface_ReadString_Call) Return(s string, err error) *MockInterface_ReadString_Call { + _c.Call.Return(s, err) + return _c +} + +func (_c *MockInterface_ReadString_Call) RunAndReturn(run func(prompt string) (string, error)) *MockInterface_ReadString_Call { + _c.Call.Return(run) + return _c +} diff --git a/mocks/github.com/int128/kubelogin/pkg/infrastructure/stdio_mock/mock_Stdin.go b/mocks/github.com/int128/kubelogin/pkg/infrastructure/stdio_mock/mock_Stdin.go deleted file mode 100644 index ac508dc..0000000 --- a/mocks/github.com/int128/kubelogin/pkg/infrastructure/stdio_mock/mock_Stdin.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. - -package stdio_mock - -import mock "github.com/stretchr/testify/mock" - -// MockStdin is an autogenerated mock type for the Stdin type -type MockStdin struct { - mock.Mock -} - -type MockStdin_Expecter struct { - mock *mock.Mock -} - -func (_m *MockStdin) EXPECT() *MockStdin_Expecter { - return &MockStdin_Expecter{mock: &_m.Mock} -} - -// Read provides a mock function with given fields: p -func (_m *MockStdin) Read(p []byte) (int, error) { - ret := _m.Called(p) - - if len(ret) == 0 { - panic("no return value specified for Read") - } - - var r0 int - var r1 error - if rf, ok := ret.Get(0).(func([]byte) (int, error)); ok { - return rf(p) - } - if rf, ok := ret.Get(0).(func([]byte) int); ok { - r0 = rf(p) - } else { - r0 = ret.Get(0).(int) - } - - if rf, ok := ret.Get(1).(func([]byte) error); ok { - r1 = rf(p) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockStdin_Read_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Read' -type MockStdin_Read_Call struct { - *mock.Call -} - -// Read is a helper method to define mock.On call -// - p []byte -func (_e *MockStdin_Expecter) Read(p interface{}) *MockStdin_Read_Call { - return &MockStdin_Read_Call{Call: _e.mock.On("Read", p)} -} - -func (_c *MockStdin_Read_Call) Run(run func(p []byte)) *MockStdin_Read_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].([]byte)) - }) - return _c -} - -func (_c *MockStdin_Read_Call) Return(n int, err error) *MockStdin_Read_Call { - _c.Call.Return(n, err) - return _c -} - -func (_c *MockStdin_Read_Call) RunAndReturn(run func([]byte) (int, error)) *MockStdin_Read_Call { - _c.Call.Return(run) - return _c -} - -// NewMockStdin creates a new instance of MockStdin. 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 NewMockStdin(t interface { - mock.TestingT - Cleanup(func()) -}) *MockStdin { - mock := &MockStdin{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/github.com/int128/kubelogin/pkg/infrastructure/stdio_mock/mock_Stdout.go b/mocks/github.com/int128/kubelogin/pkg/infrastructure/stdio_mock/mock_Stdout.go deleted file mode 100644 index 2e1b20a..0000000 --- a/mocks/github.com/int128/kubelogin/pkg/infrastructure/stdio_mock/mock_Stdout.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. - -package stdio_mock - -import mock "github.com/stretchr/testify/mock" - -// MockStdout is an autogenerated mock type for the Stdout type -type MockStdout struct { - mock.Mock -} - -type MockStdout_Expecter struct { - mock *mock.Mock -} - -func (_m *MockStdout) EXPECT() *MockStdout_Expecter { - return &MockStdout_Expecter{mock: &_m.Mock} -} - -// Write provides a mock function with given fields: p -func (_m *MockStdout) Write(p []byte) (int, error) { - ret := _m.Called(p) - - if len(ret) == 0 { - panic("no return value specified for Write") - } - - var r0 int - var r1 error - if rf, ok := ret.Get(0).(func([]byte) (int, error)); ok { - return rf(p) - } - if rf, ok := ret.Get(0).(func([]byte) int); ok { - r0 = rf(p) - } else { - r0 = ret.Get(0).(int) - } - - if rf, ok := ret.Get(1).(func([]byte) error); ok { - r1 = rf(p) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockStdout_Write_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Write' -type MockStdout_Write_Call struct { - *mock.Call -} - -// Write is a helper method to define mock.On call -// - p []byte -func (_e *MockStdout_Expecter) Write(p interface{}) *MockStdout_Write_Call { - return &MockStdout_Write_Call{Call: _e.mock.On("Write", p)} -} - -func (_c *MockStdout_Write_Call) Run(run func(p []byte)) *MockStdout_Write_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].([]byte)) - }) - return _c -} - -func (_c *MockStdout_Write_Call) Return(n int, err error) *MockStdout_Write_Call { - _c.Call.Return(n, err) - return _c -} - -func (_c *MockStdout_Write_Call) RunAndReturn(run func([]byte) (int, error)) *MockStdout_Write_Call { - _c.Call.Return(run) - return _c -} - -// NewMockStdout creates a new instance of MockStdout. 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 NewMockStdout(t interface { - mock.TestingT - Cleanup(func()) -}) *MockStdout { - mock := &MockStdout{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/github.com/int128/kubelogin/pkg/jwt_mock/mock_Clock.go b/mocks/github.com/int128/kubelogin/pkg/jwt_mock/mocks.go similarity index 78% rename from mocks/github.com/int128/kubelogin/pkg/jwt_mock/mock_Clock.go rename to mocks/github.com/int128/kubelogin/pkg/jwt_mock/mocks.go index 3fb9445..72e72e7 100644 --- a/mocks/github.com/int128/kubelogin/pkg/jwt_mock/mock_Clock.go +++ b/mocks/github.com/int128/kubelogin/pkg/jwt_mock/mocks.go @@ -1,13 +1,29 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package jwt_mock import ( - time "time" + "time" mock "github.com/stretchr/testify/mock" ) +// NewMockClock creates a new instance of MockClock. 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 NewMockClock(t interface { + mock.TestingT + Cleanup(func()) +}) *MockClock { + mock := &MockClock{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // MockClock is an autogenerated mock type for the Clock type type MockClock struct { mock.Mock @@ -21,21 +37,20 @@ func (_m *MockClock) EXPECT() *MockClock_Expecter { return &MockClock_Expecter{mock: &_m.Mock} } -// Now provides a mock function with no fields -func (_m *MockClock) Now() time.Time { - ret := _m.Called() +// Now provides a mock function for the type MockClock +func (_mock *MockClock) Now() time.Time { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for Now") } var r0 time.Time - if rf, ok := ret.Get(0).(func() time.Time); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() time.Time); ok { + r0 = returnFunc() } else { r0 = ret.Get(0).(time.Time) } - return r0 } @@ -56,8 +71,8 @@ func (_c *MockClock_Now_Call) Run(run func()) *MockClock_Now_Call { return _c } -func (_c *MockClock_Now_Call) Return(_a0 time.Time) *MockClock_Now_Call { - _c.Call.Return(_a0) +func (_c *MockClock_Now_Call) Return(time1 time.Time) *MockClock_Now_Call { + _c.Call.Return(time1) return _c } @@ -65,17 +80,3 @@ func (_c *MockClock_Now_Call) RunAndReturn(run func() time.Time) *MockClock_Now_ _c.Call.Return(run) return _c } - -// NewMockClock creates a new instance of MockClock. 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 NewMockClock(t interface { - mock.TestingT - Cleanup(func()) -}) *MockClock { - mock := &MockClock{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/github.com/int128/kubelogin/pkg/kubeconfig/loader_mock/mock_Interface.go b/mocks/github.com/int128/kubelogin/pkg/kubeconfig/loader_mock/mocks.go similarity index 59% rename from mocks/github.com/int128/kubelogin/pkg/kubeconfig/loader_mock/mock_Interface.go rename to mocks/github.com/int128/kubelogin/pkg/kubeconfig/loader_mock/mocks.go index ebf8a74..0643bab 100644 --- a/mocks/github.com/int128/kubelogin/pkg/kubeconfig/loader_mock/mock_Interface.go +++ b/mocks/github.com/int128/kubelogin/pkg/kubeconfig/loader_mock/mocks.go @@ -1,86 +1,14 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package loader_mock import ( - kubeconfig "github.com/int128/kubelogin/pkg/kubeconfig" - + "github.com/int128/kubelogin/pkg/kubeconfig" mock "github.com/stretchr/testify/mock" ) -// MockInterface is an autogenerated mock type for the Interface type -type MockInterface struct { - mock.Mock -} - -type MockInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *MockInterface) EXPECT() *MockInterface_Expecter { - return &MockInterface_Expecter{mock: &_m.Mock} -} - -// GetCurrentAuthProvider provides a mock function with given fields: explicitFilename, contextName, userName -func (_m *MockInterface) GetCurrentAuthProvider(explicitFilename string, contextName kubeconfig.ContextName, userName kubeconfig.UserName) (*kubeconfig.AuthProvider, error) { - ret := _m.Called(explicitFilename, contextName, userName) - - if len(ret) == 0 { - panic("no return value specified for GetCurrentAuthProvider") - } - - var r0 *kubeconfig.AuthProvider - var r1 error - if rf, ok := ret.Get(0).(func(string, kubeconfig.ContextName, kubeconfig.UserName) (*kubeconfig.AuthProvider, error)); ok { - return rf(explicitFilename, contextName, userName) - } - if rf, ok := ret.Get(0).(func(string, kubeconfig.ContextName, kubeconfig.UserName) *kubeconfig.AuthProvider); ok { - r0 = rf(explicitFilename, contextName, userName) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*kubeconfig.AuthProvider) - } - } - - if rf, ok := ret.Get(1).(func(string, kubeconfig.ContextName, kubeconfig.UserName) error); ok { - r1 = rf(explicitFilename, contextName, userName) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockInterface_GetCurrentAuthProvider_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCurrentAuthProvider' -type MockInterface_GetCurrentAuthProvider_Call struct { - *mock.Call -} - -// GetCurrentAuthProvider is a helper method to define mock.On call -// - explicitFilename string -// - contextName kubeconfig.ContextName -// - userName kubeconfig.UserName -func (_e *MockInterface_Expecter) GetCurrentAuthProvider(explicitFilename interface{}, contextName interface{}, userName interface{}) *MockInterface_GetCurrentAuthProvider_Call { - return &MockInterface_GetCurrentAuthProvider_Call{Call: _e.mock.On("GetCurrentAuthProvider", explicitFilename, contextName, userName)} -} - -func (_c *MockInterface_GetCurrentAuthProvider_Call) Run(run func(explicitFilename string, contextName kubeconfig.ContextName, userName kubeconfig.UserName)) *MockInterface_GetCurrentAuthProvider_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(string), args[1].(kubeconfig.ContextName), args[2].(kubeconfig.UserName)) - }) - return _c -} - -func (_c *MockInterface_GetCurrentAuthProvider_Call) Return(_a0 *kubeconfig.AuthProvider, _a1 error) *MockInterface_GetCurrentAuthProvider_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockInterface_GetCurrentAuthProvider_Call) RunAndReturn(run func(string, kubeconfig.ContextName, kubeconfig.UserName) (*kubeconfig.AuthProvider, error)) *MockInterface_GetCurrentAuthProvider_Call { - _c.Call.Return(run) - return _c -} - // NewMockInterface creates a new instance of MockInterface. 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 NewMockInterface(t interface { @@ -94,3 +22,74 @@ func NewMockInterface(t interface { return mock } + +// MockInterface is an autogenerated mock type for the Interface type +type MockInterface struct { + mock.Mock +} + +type MockInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockInterface) EXPECT() *MockInterface_Expecter { + return &MockInterface_Expecter{mock: &_m.Mock} +} + +// GetCurrentAuthProvider provides a mock function for the type MockInterface +func (_mock *MockInterface) GetCurrentAuthProvider(explicitFilename string, contextName kubeconfig.ContextName, userName kubeconfig.UserName) (*kubeconfig.AuthProvider, error) { + ret := _mock.Called(explicitFilename, contextName, userName) + + if len(ret) == 0 { + panic("no return value specified for GetCurrentAuthProvider") + } + + var r0 *kubeconfig.AuthProvider + var r1 error + if returnFunc, ok := ret.Get(0).(func(string, kubeconfig.ContextName, kubeconfig.UserName) (*kubeconfig.AuthProvider, error)); ok { + return returnFunc(explicitFilename, contextName, userName) + } + if returnFunc, ok := ret.Get(0).(func(string, kubeconfig.ContextName, kubeconfig.UserName) *kubeconfig.AuthProvider); ok { + r0 = returnFunc(explicitFilename, contextName, userName) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*kubeconfig.AuthProvider) + } + } + if returnFunc, ok := ret.Get(1).(func(string, kubeconfig.ContextName, kubeconfig.UserName) error); ok { + r1 = returnFunc(explicitFilename, contextName, userName) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockInterface_GetCurrentAuthProvider_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCurrentAuthProvider' +type MockInterface_GetCurrentAuthProvider_Call struct { + *mock.Call +} + +// GetCurrentAuthProvider is a helper method to define mock.On call +// - explicitFilename +// - contextName +// - userName +func (_e *MockInterface_Expecter) GetCurrentAuthProvider(explicitFilename interface{}, contextName interface{}, userName interface{}) *MockInterface_GetCurrentAuthProvider_Call { + return &MockInterface_GetCurrentAuthProvider_Call{Call: _e.mock.On("GetCurrentAuthProvider", explicitFilename, contextName, userName)} +} + +func (_c *MockInterface_GetCurrentAuthProvider_Call) Run(run func(explicitFilename string, contextName kubeconfig.ContextName, userName kubeconfig.UserName)) *MockInterface_GetCurrentAuthProvider_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(kubeconfig.ContextName), args[2].(kubeconfig.UserName)) + }) + return _c +} + +func (_c *MockInterface_GetCurrentAuthProvider_Call) Return(authProvider *kubeconfig.AuthProvider, err error) *MockInterface_GetCurrentAuthProvider_Call { + _c.Call.Return(authProvider, err) + return _c +} + +func (_c *MockInterface_GetCurrentAuthProvider_Call) RunAndReturn(run func(explicitFilename string, contextName kubeconfig.ContextName, userName kubeconfig.UserName) (*kubeconfig.AuthProvider, error)) *MockInterface_GetCurrentAuthProvider_Call { + _c.Call.Return(run) + return _c +} diff --git a/mocks/github.com/int128/kubelogin/pkg/kubeconfig/writer_mock/mock_Interface.go b/mocks/github.com/int128/kubelogin/pkg/kubeconfig/writer_mock/mocks.go similarity index 75% rename from mocks/github.com/int128/kubelogin/pkg/kubeconfig/writer_mock/mock_Interface.go rename to mocks/github.com/int128/kubelogin/pkg/kubeconfig/writer_mock/mocks.go index 11afd59..82a7aa7 100644 --- a/mocks/github.com/int128/kubelogin/pkg/kubeconfig/writer_mock/mock_Interface.go +++ b/mocks/github.com/int128/kubelogin/pkg/kubeconfig/writer_mock/mocks.go @@ -1,71 +1,14 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package writer_mock import ( - kubeconfig "github.com/int128/kubelogin/pkg/kubeconfig" + "github.com/int128/kubelogin/pkg/kubeconfig" mock "github.com/stretchr/testify/mock" ) -// MockInterface is an autogenerated mock type for the Interface type -type MockInterface struct { - mock.Mock -} - -type MockInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *MockInterface) EXPECT() *MockInterface_Expecter { - return &MockInterface_Expecter{mock: &_m.Mock} -} - -// UpdateAuthProvider provides a mock function with given fields: p -func (_m *MockInterface) UpdateAuthProvider(p kubeconfig.AuthProvider) error { - ret := _m.Called(p) - - if len(ret) == 0 { - panic("no return value specified for UpdateAuthProvider") - } - - var r0 error - if rf, ok := ret.Get(0).(func(kubeconfig.AuthProvider) error); ok { - r0 = rf(p) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// MockInterface_UpdateAuthProvider_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateAuthProvider' -type MockInterface_UpdateAuthProvider_Call struct { - *mock.Call -} - -// UpdateAuthProvider is a helper method to define mock.On call -// - p kubeconfig.AuthProvider -func (_e *MockInterface_Expecter) UpdateAuthProvider(p interface{}) *MockInterface_UpdateAuthProvider_Call { - return &MockInterface_UpdateAuthProvider_Call{Call: _e.mock.On("UpdateAuthProvider", p)} -} - -func (_c *MockInterface_UpdateAuthProvider_Call) Run(run func(p kubeconfig.AuthProvider)) *MockInterface_UpdateAuthProvider_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(kubeconfig.AuthProvider)) - }) - return _c -} - -func (_c *MockInterface_UpdateAuthProvider_Call) Return(_a0 error) *MockInterface_UpdateAuthProvider_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockInterface_UpdateAuthProvider_Call) RunAndReturn(run func(kubeconfig.AuthProvider) error) *MockInterface_UpdateAuthProvider_Call { - _c.Call.Return(run) - return _c -} - // NewMockInterface creates a new instance of MockInterface. 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 NewMockInterface(t interface { @@ -79,3 +22,61 @@ func NewMockInterface(t interface { return mock } + +// MockInterface is an autogenerated mock type for the Interface type +type MockInterface struct { + mock.Mock +} + +type MockInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockInterface) EXPECT() *MockInterface_Expecter { + return &MockInterface_Expecter{mock: &_m.Mock} +} + +// UpdateAuthProvider provides a mock function for the type MockInterface +func (_mock *MockInterface) UpdateAuthProvider(p kubeconfig.AuthProvider) error { + ret := _mock.Called(p) + + if len(ret) == 0 { + panic("no return value specified for UpdateAuthProvider") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(kubeconfig.AuthProvider) error); ok { + r0 = returnFunc(p) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockInterface_UpdateAuthProvider_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateAuthProvider' +type MockInterface_UpdateAuthProvider_Call struct { + *mock.Call +} + +// UpdateAuthProvider is a helper method to define mock.On call +// - p +func (_e *MockInterface_Expecter) UpdateAuthProvider(p interface{}) *MockInterface_UpdateAuthProvider_Call { + return &MockInterface_UpdateAuthProvider_Call{Call: _e.mock.On("UpdateAuthProvider", p)} +} + +func (_c *MockInterface_UpdateAuthProvider_Call) Run(run func(p kubeconfig.AuthProvider)) *MockInterface_UpdateAuthProvider_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(kubeconfig.AuthProvider)) + }) + return _c +} + +func (_c *MockInterface_UpdateAuthProvider_Call) Return(err error) *MockInterface_UpdateAuthProvider_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockInterface_UpdateAuthProvider_Call) RunAndReturn(run func(p kubeconfig.AuthProvider) error) *MockInterface_UpdateAuthProvider_Call { + _c.Call.Return(run) + return _c +} diff --git a/mocks/github.com/int128/kubelogin/pkg/oidc/client_mock/mock_FactoryInterface.go b/mocks/github.com/int128/kubelogin/pkg/oidc/client_mock/mock_FactoryInterface.go deleted file mode 100644 index 2c8d267..0000000 --- a/mocks/github.com/int128/kubelogin/pkg/oidc/client_mock/mock_FactoryInterface.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. - -package client_mock - -import ( - context "context" - - client "github.com/int128/kubelogin/pkg/oidc/client" - - mock "github.com/stretchr/testify/mock" - - oidc "github.com/int128/kubelogin/pkg/oidc" - - tlsclientconfig "github.com/int128/kubelogin/pkg/tlsclientconfig" -) - -// MockFactoryInterface is an autogenerated mock type for the FactoryInterface type -type MockFactoryInterface struct { - mock.Mock -} - -type MockFactoryInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *MockFactoryInterface) EXPECT() *MockFactoryInterface_Expecter { - return &MockFactoryInterface_Expecter{mock: &_m.Mock} -} - -// New provides a mock function with given fields: ctx, prov, tlsClientConfig -func (_m *MockFactoryInterface) New(ctx context.Context, prov oidc.Provider, tlsClientConfig tlsclientconfig.Config) (client.Interface, error) { - ret := _m.Called(ctx, prov, tlsClientConfig) - - if len(ret) == 0 { - panic("no return value specified for New") - } - - var r0 client.Interface - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, oidc.Provider, tlsclientconfig.Config) (client.Interface, error)); ok { - return rf(ctx, prov, tlsClientConfig) - } - if rf, ok := ret.Get(0).(func(context.Context, oidc.Provider, tlsclientconfig.Config) client.Interface); ok { - r0 = rf(ctx, prov, tlsClientConfig) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(client.Interface) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, oidc.Provider, tlsclientconfig.Config) error); ok { - r1 = rf(ctx, prov, tlsClientConfig) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockFactoryInterface_New_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'New' -type MockFactoryInterface_New_Call struct { - *mock.Call -} - -// New is a helper method to define mock.On call -// - ctx context.Context -// - prov oidc.Provider -// - tlsClientConfig tlsclientconfig.Config -func (_e *MockFactoryInterface_Expecter) New(ctx interface{}, prov interface{}, tlsClientConfig interface{}) *MockFactoryInterface_New_Call { - return &MockFactoryInterface_New_Call{Call: _e.mock.On("New", ctx, prov, tlsClientConfig)} -} - -func (_c *MockFactoryInterface_New_Call) Run(run func(ctx context.Context, prov oidc.Provider, tlsClientConfig tlsclientconfig.Config)) *MockFactoryInterface_New_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(oidc.Provider), args[2].(tlsclientconfig.Config)) - }) - return _c -} - -func (_c *MockFactoryInterface_New_Call) Return(_a0 client.Interface, _a1 error) *MockFactoryInterface_New_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockFactoryInterface_New_Call) RunAndReturn(run func(context.Context, oidc.Provider, tlsclientconfig.Config) (client.Interface, error)) *MockFactoryInterface_New_Call { - _c.Call.Return(run) - return _c -} - -// NewMockFactoryInterface creates a new instance of MockFactoryInterface. 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 NewMockFactoryInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *MockFactoryInterface { - mock := &MockFactoryInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/github.com/int128/kubelogin/pkg/oidc/client_mock/mock_Interface.go b/mocks/github.com/int128/kubelogin/pkg/oidc/client_mock/mock_Interface.go deleted file mode 100644 index f2dac1a..0000000 --- a/mocks/github.com/int128/kubelogin/pkg/oidc/client_mock/mock_Interface.go +++ /dev/null @@ -1,490 +0,0 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. - -package client_mock - -import ( - context "context" - - client "github.com/int128/kubelogin/pkg/oidc/client" - - mock "github.com/stretchr/testify/mock" - - oauth2dev "github.com/int128/oauth2dev" - - oidc "github.com/int128/kubelogin/pkg/oidc" - - pkce "github.com/int128/kubelogin/pkg/pkce" -) - -// MockInterface is an autogenerated mock type for the Interface type -type MockInterface struct { - mock.Mock -} - -type MockInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *MockInterface) EXPECT() *MockInterface_Expecter { - return &MockInterface_Expecter{mock: &_m.Mock} -} - -// ExchangeAuthCode provides a mock function with given fields: ctx, in -func (_m *MockInterface) ExchangeAuthCode(ctx context.Context, in client.ExchangeAuthCodeInput) (*oidc.TokenSet, error) { - ret := _m.Called(ctx, in) - - if len(ret) == 0 { - panic("no return value specified for ExchangeAuthCode") - } - - var r0 *oidc.TokenSet - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, client.ExchangeAuthCodeInput) (*oidc.TokenSet, error)); ok { - return rf(ctx, in) - } - if rf, ok := ret.Get(0).(func(context.Context, client.ExchangeAuthCodeInput) *oidc.TokenSet); ok { - r0 = rf(ctx, in) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*oidc.TokenSet) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, client.ExchangeAuthCodeInput) error); ok { - r1 = rf(ctx, in) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockInterface_ExchangeAuthCode_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ExchangeAuthCode' -type MockInterface_ExchangeAuthCode_Call struct { - *mock.Call -} - -// ExchangeAuthCode is a helper method to define mock.On call -// - ctx context.Context -// - in client.ExchangeAuthCodeInput -func (_e *MockInterface_Expecter) ExchangeAuthCode(ctx interface{}, in interface{}) *MockInterface_ExchangeAuthCode_Call { - return &MockInterface_ExchangeAuthCode_Call{Call: _e.mock.On("ExchangeAuthCode", ctx, in)} -} - -func (_c *MockInterface_ExchangeAuthCode_Call) Run(run func(ctx context.Context, in client.ExchangeAuthCodeInput)) *MockInterface_ExchangeAuthCode_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(client.ExchangeAuthCodeInput)) - }) - return _c -} - -func (_c *MockInterface_ExchangeAuthCode_Call) Return(_a0 *oidc.TokenSet, _a1 error) *MockInterface_ExchangeAuthCode_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockInterface_ExchangeAuthCode_Call) RunAndReturn(run func(context.Context, client.ExchangeAuthCodeInput) (*oidc.TokenSet, error)) *MockInterface_ExchangeAuthCode_Call { - _c.Call.Return(run) - return _c -} - -// ExchangeDeviceCode provides a mock function with given fields: ctx, authResponse -func (_m *MockInterface) ExchangeDeviceCode(ctx context.Context, authResponse *oauth2dev.AuthorizationResponse) (*oidc.TokenSet, error) { - ret := _m.Called(ctx, authResponse) - - if len(ret) == 0 { - panic("no return value specified for ExchangeDeviceCode") - } - - var r0 *oidc.TokenSet - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *oauth2dev.AuthorizationResponse) (*oidc.TokenSet, error)); ok { - return rf(ctx, authResponse) - } - if rf, ok := ret.Get(0).(func(context.Context, *oauth2dev.AuthorizationResponse) *oidc.TokenSet); ok { - r0 = rf(ctx, authResponse) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*oidc.TokenSet) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *oauth2dev.AuthorizationResponse) error); ok { - r1 = rf(ctx, authResponse) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockInterface_ExchangeDeviceCode_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ExchangeDeviceCode' -type MockInterface_ExchangeDeviceCode_Call struct { - *mock.Call -} - -// ExchangeDeviceCode is a helper method to define mock.On call -// - ctx context.Context -// - authResponse *oauth2dev.AuthorizationResponse -func (_e *MockInterface_Expecter) ExchangeDeviceCode(ctx interface{}, authResponse interface{}) *MockInterface_ExchangeDeviceCode_Call { - return &MockInterface_ExchangeDeviceCode_Call{Call: _e.mock.On("ExchangeDeviceCode", ctx, authResponse)} -} - -func (_c *MockInterface_ExchangeDeviceCode_Call) Run(run func(ctx context.Context, authResponse *oauth2dev.AuthorizationResponse)) *MockInterface_ExchangeDeviceCode_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(*oauth2dev.AuthorizationResponse)) - }) - return _c -} - -func (_c *MockInterface_ExchangeDeviceCode_Call) Return(_a0 *oidc.TokenSet, _a1 error) *MockInterface_ExchangeDeviceCode_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockInterface_ExchangeDeviceCode_Call) RunAndReturn(run func(context.Context, *oauth2dev.AuthorizationResponse) (*oidc.TokenSet, error)) *MockInterface_ExchangeDeviceCode_Call { - _c.Call.Return(run) - return _c -} - -// GetAuthCodeURL provides a mock function with given fields: in -func (_m *MockInterface) GetAuthCodeURL(in client.AuthCodeURLInput) string { - ret := _m.Called(in) - - if len(ret) == 0 { - panic("no return value specified for GetAuthCodeURL") - } - - var r0 string - if rf, ok := ret.Get(0).(func(client.AuthCodeURLInput) string); ok { - r0 = rf(in) - } else { - r0 = ret.Get(0).(string) - } - - return r0 -} - -// MockInterface_GetAuthCodeURL_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAuthCodeURL' -type MockInterface_GetAuthCodeURL_Call struct { - *mock.Call -} - -// GetAuthCodeURL is a helper method to define mock.On call -// - in client.AuthCodeURLInput -func (_e *MockInterface_Expecter) GetAuthCodeURL(in interface{}) *MockInterface_GetAuthCodeURL_Call { - return &MockInterface_GetAuthCodeURL_Call{Call: _e.mock.On("GetAuthCodeURL", in)} -} - -func (_c *MockInterface_GetAuthCodeURL_Call) Run(run func(in client.AuthCodeURLInput)) *MockInterface_GetAuthCodeURL_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(client.AuthCodeURLInput)) - }) - return _c -} - -func (_c *MockInterface_GetAuthCodeURL_Call) Return(_a0 string) *MockInterface_GetAuthCodeURL_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockInterface_GetAuthCodeURL_Call) RunAndReturn(run func(client.AuthCodeURLInput) string) *MockInterface_GetAuthCodeURL_Call { - _c.Call.Return(run) - return _c -} - -// GetDeviceAuthorization provides a mock function with given fields: ctx -func (_m *MockInterface) GetDeviceAuthorization(ctx context.Context) (*oauth2dev.AuthorizationResponse, error) { - ret := _m.Called(ctx) - - if len(ret) == 0 { - panic("no return value specified for GetDeviceAuthorization") - } - - var r0 *oauth2dev.AuthorizationResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context) (*oauth2dev.AuthorizationResponse, error)); ok { - return rf(ctx) - } - if rf, ok := ret.Get(0).(func(context.Context) *oauth2dev.AuthorizationResponse); ok { - r0 = rf(ctx) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*oauth2dev.AuthorizationResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context) error); ok { - r1 = rf(ctx) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockInterface_GetDeviceAuthorization_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDeviceAuthorization' -type MockInterface_GetDeviceAuthorization_Call struct { - *mock.Call -} - -// GetDeviceAuthorization is a helper method to define mock.On call -// - ctx context.Context -func (_e *MockInterface_Expecter) GetDeviceAuthorization(ctx interface{}) *MockInterface_GetDeviceAuthorization_Call { - return &MockInterface_GetDeviceAuthorization_Call{Call: _e.mock.On("GetDeviceAuthorization", ctx)} -} - -func (_c *MockInterface_GetDeviceAuthorization_Call) Run(run func(ctx context.Context)) *MockInterface_GetDeviceAuthorization_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context)) - }) - return _c -} - -func (_c *MockInterface_GetDeviceAuthorization_Call) Return(_a0 *oauth2dev.AuthorizationResponse, _a1 error) *MockInterface_GetDeviceAuthorization_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockInterface_GetDeviceAuthorization_Call) RunAndReturn(run func(context.Context) (*oauth2dev.AuthorizationResponse, error)) *MockInterface_GetDeviceAuthorization_Call { - _c.Call.Return(run) - return _c -} - -// GetTokenByAuthCode provides a mock function with given fields: ctx, in, localServerReadyChan -func (_m *MockInterface) GetTokenByAuthCode(ctx context.Context, in client.GetTokenByAuthCodeInput, localServerReadyChan chan<- string) (*oidc.TokenSet, error) { - ret := _m.Called(ctx, in, localServerReadyChan) - - if len(ret) == 0 { - panic("no return value specified for GetTokenByAuthCode") - } - - var r0 *oidc.TokenSet - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, client.GetTokenByAuthCodeInput, chan<- string) (*oidc.TokenSet, error)); ok { - return rf(ctx, in, localServerReadyChan) - } - if rf, ok := ret.Get(0).(func(context.Context, client.GetTokenByAuthCodeInput, chan<- string) *oidc.TokenSet); ok { - r0 = rf(ctx, in, localServerReadyChan) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*oidc.TokenSet) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, client.GetTokenByAuthCodeInput, chan<- string) error); ok { - r1 = rf(ctx, in, localServerReadyChan) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockInterface_GetTokenByAuthCode_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTokenByAuthCode' -type MockInterface_GetTokenByAuthCode_Call struct { - *mock.Call -} - -// GetTokenByAuthCode is a helper method to define mock.On call -// - ctx context.Context -// - in client.GetTokenByAuthCodeInput -// - localServerReadyChan chan<- string -func (_e *MockInterface_Expecter) GetTokenByAuthCode(ctx interface{}, in interface{}, localServerReadyChan interface{}) *MockInterface_GetTokenByAuthCode_Call { - return &MockInterface_GetTokenByAuthCode_Call{Call: _e.mock.On("GetTokenByAuthCode", ctx, in, localServerReadyChan)} -} - -func (_c *MockInterface_GetTokenByAuthCode_Call) Run(run func(ctx context.Context, in client.GetTokenByAuthCodeInput, localServerReadyChan chan<- string)) *MockInterface_GetTokenByAuthCode_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(client.GetTokenByAuthCodeInput), args[2].(chan<- string)) - }) - return _c -} - -func (_c *MockInterface_GetTokenByAuthCode_Call) Return(_a0 *oidc.TokenSet, _a1 error) *MockInterface_GetTokenByAuthCode_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockInterface_GetTokenByAuthCode_Call) RunAndReturn(run func(context.Context, client.GetTokenByAuthCodeInput, chan<- string) (*oidc.TokenSet, error)) *MockInterface_GetTokenByAuthCode_Call { - _c.Call.Return(run) - return _c -} - -// GetTokenByROPC provides a mock function with given fields: ctx, username, password -func (_m *MockInterface) GetTokenByROPC(ctx context.Context, username string, password string) (*oidc.TokenSet, error) { - ret := _m.Called(ctx, username, password) - - if len(ret) == 0 { - panic("no return value specified for GetTokenByROPC") - } - - var r0 *oidc.TokenSet - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string, string) (*oidc.TokenSet, error)); ok { - return rf(ctx, username, password) - } - if rf, ok := ret.Get(0).(func(context.Context, string, string) *oidc.TokenSet); ok { - r0 = rf(ctx, username, password) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*oidc.TokenSet) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { - r1 = rf(ctx, username, password) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockInterface_GetTokenByROPC_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTokenByROPC' -type MockInterface_GetTokenByROPC_Call struct { - *mock.Call -} - -// GetTokenByROPC is a helper method to define mock.On call -// - ctx context.Context -// - username string -// - password string -func (_e *MockInterface_Expecter) GetTokenByROPC(ctx interface{}, username interface{}, password interface{}) *MockInterface_GetTokenByROPC_Call { - return &MockInterface_GetTokenByROPC_Call{Call: _e.mock.On("GetTokenByROPC", ctx, username, password)} -} - -func (_c *MockInterface_GetTokenByROPC_Call) Run(run func(ctx context.Context, username string, password string)) *MockInterface_GetTokenByROPC_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(string), args[2].(string)) - }) - return _c -} - -func (_c *MockInterface_GetTokenByROPC_Call) Return(_a0 *oidc.TokenSet, _a1 error) *MockInterface_GetTokenByROPC_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockInterface_GetTokenByROPC_Call) RunAndReturn(run func(context.Context, string, string) (*oidc.TokenSet, error)) *MockInterface_GetTokenByROPC_Call { - _c.Call.Return(run) - return _c -} - -// NegotiatedPKCEMethod provides a mock function with no fields -func (_m *MockInterface) NegotiatedPKCEMethod() pkce.Method { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for NegotiatedPKCEMethod") - } - - var r0 pkce.Method - if rf, ok := ret.Get(0).(func() pkce.Method); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(pkce.Method) - } - - return r0 -} - -// MockInterface_NegotiatedPKCEMethod_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NegotiatedPKCEMethod' -type MockInterface_NegotiatedPKCEMethod_Call struct { - *mock.Call -} - -// NegotiatedPKCEMethod is a helper method to define mock.On call -func (_e *MockInterface_Expecter) NegotiatedPKCEMethod() *MockInterface_NegotiatedPKCEMethod_Call { - return &MockInterface_NegotiatedPKCEMethod_Call{Call: _e.mock.On("NegotiatedPKCEMethod")} -} - -func (_c *MockInterface_NegotiatedPKCEMethod_Call) Run(run func()) *MockInterface_NegotiatedPKCEMethod_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *MockInterface_NegotiatedPKCEMethod_Call) Return(_a0 pkce.Method) *MockInterface_NegotiatedPKCEMethod_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockInterface_NegotiatedPKCEMethod_Call) RunAndReturn(run func() pkce.Method) *MockInterface_NegotiatedPKCEMethod_Call { - _c.Call.Return(run) - return _c -} - -// Refresh provides a mock function with given fields: ctx, refreshToken -func (_m *MockInterface) Refresh(ctx context.Context, refreshToken string) (*oidc.TokenSet, error) { - ret := _m.Called(ctx, refreshToken) - - if len(ret) == 0 { - panic("no return value specified for Refresh") - } - - var r0 *oidc.TokenSet - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string) (*oidc.TokenSet, error)); ok { - return rf(ctx, refreshToken) - } - if rf, ok := ret.Get(0).(func(context.Context, string) *oidc.TokenSet); ok { - r0 = rf(ctx, refreshToken) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*oidc.TokenSet) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(ctx, refreshToken) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockInterface_Refresh_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Refresh' -type MockInterface_Refresh_Call struct { - *mock.Call -} - -// Refresh is a helper method to define mock.On call -// - ctx context.Context -// - refreshToken string -func (_e *MockInterface_Expecter) Refresh(ctx interface{}, refreshToken interface{}) *MockInterface_Refresh_Call { - return &MockInterface_Refresh_Call{Call: _e.mock.On("Refresh", ctx, refreshToken)} -} - -func (_c *MockInterface_Refresh_Call) Run(run func(ctx context.Context, refreshToken string)) *MockInterface_Refresh_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(string)) - }) - return _c -} - -func (_c *MockInterface_Refresh_Call) Return(_a0 *oidc.TokenSet, _a1 error) *MockInterface_Refresh_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockInterface_Refresh_Call) RunAndReturn(run func(context.Context, string) (*oidc.TokenSet, error)) *MockInterface_Refresh_Call { - _c.Call.Return(run) - return _c -} - -// NewMockInterface creates a new instance of MockInterface. 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 NewMockInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *MockInterface { - mock := &MockInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/github.com/int128/kubelogin/pkg/oidc/client_mock/mocks.go b/mocks/github.com/int128/kubelogin/pkg/oidc/client_mock/mocks.go new file mode 100644 index 0000000..4323172 --- /dev/null +++ b/mocks/github.com/int128/kubelogin/pkg/oidc/client_mock/mocks.go @@ -0,0 +1,560 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package client_mock + +import ( + "context" + + "github.com/int128/kubelogin/pkg/oidc" + "github.com/int128/kubelogin/pkg/oidc/client" + "github.com/int128/kubelogin/pkg/pkce" + "github.com/int128/kubelogin/pkg/tlsclientconfig" + "github.com/int128/oauth2dev" + mock "github.com/stretchr/testify/mock" +) + +// NewMockInterface creates a new instance of MockInterface. 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 NewMockInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockInterface { + mock := &MockInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MockInterface is an autogenerated mock type for the Interface type +type MockInterface struct { + mock.Mock +} + +type MockInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockInterface) EXPECT() *MockInterface_Expecter { + return &MockInterface_Expecter{mock: &_m.Mock} +} + +// ExchangeAuthCode provides a mock function for the type MockInterface +func (_mock *MockInterface) ExchangeAuthCode(ctx context.Context, in client.ExchangeAuthCodeInput) (*oidc.TokenSet, error) { + ret := _mock.Called(ctx, in) + + if len(ret) == 0 { + panic("no return value specified for ExchangeAuthCode") + } + + var r0 *oidc.TokenSet + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, client.ExchangeAuthCodeInput) (*oidc.TokenSet, error)); ok { + return returnFunc(ctx, in) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, client.ExchangeAuthCodeInput) *oidc.TokenSet); ok { + r0 = returnFunc(ctx, in) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*oidc.TokenSet) + } + } + if returnFunc, ok := ret.Get(1).(func(context.Context, client.ExchangeAuthCodeInput) error); ok { + r1 = returnFunc(ctx, in) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockInterface_ExchangeAuthCode_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ExchangeAuthCode' +type MockInterface_ExchangeAuthCode_Call struct { + *mock.Call +} + +// ExchangeAuthCode is a helper method to define mock.On call +// - ctx +// - in +func (_e *MockInterface_Expecter) ExchangeAuthCode(ctx interface{}, in interface{}) *MockInterface_ExchangeAuthCode_Call { + return &MockInterface_ExchangeAuthCode_Call{Call: _e.mock.On("ExchangeAuthCode", ctx, in)} +} + +func (_c *MockInterface_ExchangeAuthCode_Call) Run(run func(ctx context.Context, in client.ExchangeAuthCodeInput)) *MockInterface_ExchangeAuthCode_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(client.ExchangeAuthCodeInput)) + }) + return _c +} + +func (_c *MockInterface_ExchangeAuthCode_Call) Return(tokenSet *oidc.TokenSet, err error) *MockInterface_ExchangeAuthCode_Call { + _c.Call.Return(tokenSet, err) + return _c +} + +func (_c *MockInterface_ExchangeAuthCode_Call) RunAndReturn(run func(ctx context.Context, in client.ExchangeAuthCodeInput) (*oidc.TokenSet, error)) *MockInterface_ExchangeAuthCode_Call { + _c.Call.Return(run) + return _c +} + +// ExchangeDeviceCode provides a mock function for the type MockInterface +func (_mock *MockInterface) ExchangeDeviceCode(ctx context.Context, authResponse *oauth2dev.AuthorizationResponse) (*oidc.TokenSet, error) { + ret := _mock.Called(ctx, authResponse) + + if len(ret) == 0 { + panic("no return value specified for ExchangeDeviceCode") + } + + var r0 *oidc.TokenSet + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, *oauth2dev.AuthorizationResponse) (*oidc.TokenSet, error)); ok { + return returnFunc(ctx, authResponse) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, *oauth2dev.AuthorizationResponse) *oidc.TokenSet); ok { + r0 = returnFunc(ctx, authResponse) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*oidc.TokenSet) + } + } + if returnFunc, ok := ret.Get(1).(func(context.Context, *oauth2dev.AuthorizationResponse) error); ok { + r1 = returnFunc(ctx, authResponse) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockInterface_ExchangeDeviceCode_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ExchangeDeviceCode' +type MockInterface_ExchangeDeviceCode_Call struct { + *mock.Call +} + +// ExchangeDeviceCode is a helper method to define mock.On call +// - ctx +// - authResponse +func (_e *MockInterface_Expecter) ExchangeDeviceCode(ctx interface{}, authResponse interface{}) *MockInterface_ExchangeDeviceCode_Call { + return &MockInterface_ExchangeDeviceCode_Call{Call: _e.mock.On("ExchangeDeviceCode", ctx, authResponse)} +} + +func (_c *MockInterface_ExchangeDeviceCode_Call) Run(run func(ctx context.Context, authResponse *oauth2dev.AuthorizationResponse)) *MockInterface_ExchangeDeviceCode_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*oauth2dev.AuthorizationResponse)) + }) + return _c +} + +func (_c *MockInterface_ExchangeDeviceCode_Call) Return(tokenSet *oidc.TokenSet, err error) *MockInterface_ExchangeDeviceCode_Call { + _c.Call.Return(tokenSet, err) + return _c +} + +func (_c *MockInterface_ExchangeDeviceCode_Call) RunAndReturn(run func(ctx context.Context, authResponse *oauth2dev.AuthorizationResponse) (*oidc.TokenSet, error)) *MockInterface_ExchangeDeviceCode_Call { + _c.Call.Return(run) + return _c +} + +// GetAuthCodeURL provides a mock function for the type MockInterface +func (_mock *MockInterface) GetAuthCodeURL(in client.AuthCodeURLInput) string { + ret := _mock.Called(in) + + if len(ret) == 0 { + panic("no return value specified for GetAuthCodeURL") + } + + var r0 string + if returnFunc, ok := ret.Get(0).(func(client.AuthCodeURLInput) string); ok { + r0 = returnFunc(in) + } else { + r0 = ret.Get(0).(string) + } + return r0 +} + +// MockInterface_GetAuthCodeURL_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAuthCodeURL' +type MockInterface_GetAuthCodeURL_Call struct { + *mock.Call +} + +// GetAuthCodeURL is a helper method to define mock.On call +// - in +func (_e *MockInterface_Expecter) GetAuthCodeURL(in interface{}) *MockInterface_GetAuthCodeURL_Call { + return &MockInterface_GetAuthCodeURL_Call{Call: _e.mock.On("GetAuthCodeURL", in)} +} + +func (_c *MockInterface_GetAuthCodeURL_Call) Run(run func(in client.AuthCodeURLInput)) *MockInterface_GetAuthCodeURL_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(client.AuthCodeURLInput)) + }) + return _c +} + +func (_c *MockInterface_GetAuthCodeURL_Call) Return(s string) *MockInterface_GetAuthCodeURL_Call { + _c.Call.Return(s) + return _c +} + +func (_c *MockInterface_GetAuthCodeURL_Call) RunAndReturn(run func(in client.AuthCodeURLInput) string) *MockInterface_GetAuthCodeURL_Call { + _c.Call.Return(run) + return _c +} + +// GetDeviceAuthorization provides a mock function for the type MockInterface +func (_mock *MockInterface) GetDeviceAuthorization(ctx context.Context) (*oauth2dev.AuthorizationResponse, error) { + ret := _mock.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for GetDeviceAuthorization") + } + + var r0 *oauth2dev.AuthorizationResponse + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context) (*oauth2dev.AuthorizationResponse, error)); ok { + return returnFunc(ctx) + } + if returnFunc, ok := ret.Get(0).(func(context.Context) *oauth2dev.AuthorizationResponse); ok { + r0 = returnFunc(ctx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*oauth2dev.AuthorizationResponse) + } + } + if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = returnFunc(ctx) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockInterface_GetDeviceAuthorization_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDeviceAuthorization' +type MockInterface_GetDeviceAuthorization_Call struct { + *mock.Call +} + +// GetDeviceAuthorization is a helper method to define mock.On call +// - ctx +func (_e *MockInterface_Expecter) GetDeviceAuthorization(ctx interface{}) *MockInterface_GetDeviceAuthorization_Call { + return &MockInterface_GetDeviceAuthorization_Call{Call: _e.mock.On("GetDeviceAuthorization", ctx)} +} + +func (_c *MockInterface_GetDeviceAuthorization_Call) Run(run func(ctx context.Context)) *MockInterface_GetDeviceAuthorization_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *MockInterface_GetDeviceAuthorization_Call) Return(authorizationResponse *oauth2dev.AuthorizationResponse, err error) *MockInterface_GetDeviceAuthorization_Call { + _c.Call.Return(authorizationResponse, err) + return _c +} + +func (_c *MockInterface_GetDeviceAuthorization_Call) RunAndReturn(run func(ctx context.Context) (*oauth2dev.AuthorizationResponse, error)) *MockInterface_GetDeviceAuthorization_Call { + _c.Call.Return(run) + return _c +} + +// GetTokenByAuthCode provides a mock function for the type MockInterface +func (_mock *MockInterface) GetTokenByAuthCode(ctx context.Context, in client.GetTokenByAuthCodeInput, localServerReadyChan chan<- string) (*oidc.TokenSet, error) { + ret := _mock.Called(ctx, in, localServerReadyChan) + + if len(ret) == 0 { + panic("no return value specified for GetTokenByAuthCode") + } + + var r0 *oidc.TokenSet + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, client.GetTokenByAuthCodeInput, chan<- string) (*oidc.TokenSet, error)); ok { + return returnFunc(ctx, in, localServerReadyChan) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, client.GetTokenByAuthCodeInput, chan<- string) *oidc.TokenSet); ok { + r0 = returnFunc(ctx, in, localServerReadyChan) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*oidc.TokenSet) + } + } + if returnFunc, ok := ret.Get(1).(func(context.Context, client.GetTokenByAuthCodeInput, chan<- string) error); ok { + r1 = returnFunc(ctx, in, localServerReadyChan) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockInterface_GetTokenByAuthCode_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTokenByAuthCode' +type MockInterface_GetTokenByAuthCode_Call struct { + *mock.Call +} + +// GetTokenByAuthCode is a helper method to define mock.On call +// - ctx +// - in +// - localServerReadyChan +func (_e *MockInterface_Expecter) GetTokenByAuthCode(ctx interface{}, in interface{}, localServerReadyChan interface{}) *MockInterface_GetTokenByAuthCode_Call { + return &MockInterface_GetTokenByAuthCode_Call{Call: _e.mock.On("GetTokenByAuthCode", ctx, in, localServerReadyChan)} +} + +func (_c *MockInterface_GetTokenByAuthCode_Call) Run(run func(ctx context.Context, in client.GetTokenByAuthCodeInput, localServerReadyChan chan<- string)) *MockInterface_GetTokenByAuthCode_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(client.GetTokenByAuthCodeInput), args[2].(chan<- string)) + }) + return _c +} + +func (_c *MockInterface_GetTokenByAuthCode_Call) Return(tokenSet *oidc.TokenSet, err error) *MockInterface_GetTokenByAuthCode_Call { + _c.Call.Return(tokenSet, err) + return _c +} + +func (_c *MockInterface_GetTokenByAuthCode_Call) RunAndReturn(run func(ctx context.Context, in client.GetTokenByAuthCodeInput, localServerReadyChan chan<- string) (*oidc.TokenSet, error)) *MockInterface_GetTokenByAuthCode_Call { + _c.Call.Return(run) + return _c +} + +// GetTokenByROPC provides a mock function for the type MockInterface +func (_mock *MockInterface) GetTokenByROPC(ctx context.Context, username string, password string) (*oidc.TokenSet, error) { + ret := _mock.Called(ctx, username, password) + + if len(ret) == 0 { + panic("no return value specified for GetTokenByROPC") + } + + var r0 *oidc.TokenSet + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) (*oidc.TokenSet, error)); ok { + return returnFunc(ctx, username, password) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) *oidc.TokenSet); ok { + r0 = returnFunc(ctx, username, password) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*oidc.TokenSet) + } + } + if returnFunc, ok := ret.Get(1).(func(context.Context, string, string) error); ok { + r1 = returnFunc(ctx, username, password) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockInterface_GetTokenByROPC_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTokenByROPC' +type MockInterface_GetTokenByROPC_Call struct { + *mock.Call +} + +// GetTokenByROPC is a helper method to define mock.On call +// - ctx +// - username +// - password +func (_e *MockInterface_Expecter) GetTokenByROPC(ctx interface{}, username interface{}, password interface{}) *MockInterface_GetTokenByROPC_Call { + return &MockInterface_GetTokenByROPC_Call{Call: _e.mock.On("GetTokenByROPC", ctx, username, password)} +} + +func (_c *MockInterface_GetTokenByROPC_Call) Run(run func(ctx context.Context, username string, password string)) *MockInterface_GetTokenByROPC_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *MockInterface_GetTokenByROPC_Call) Return(tokenSet *oidc.TokenSet, err error) *MockInterface_GetTokenByROPC_Call { + _c.Call.Return(tokenSet, err) + return _c +} + +func (_c *MockInterface_GetTokenByROPC_Call) RunAndReturn(run func(ctx context.Context, username string, password string) (*oidc.TokenSet, error)) *MockInterface_GetTokenByROPC_Call { + _c.Call.Return(run) + return _c +} + +// NegotiatedPKCEMethod provides a mock function for the type MockInterface +func (_mock *MockInterface) NegotiatedPKCEMethod() pkce.Method { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for NegotiatedPKCEMethod") + } + + var r0 pkce.Method + if returnFunc, ok := ret.Get(0).(func() pkce.Method); ok { + r0 = returnFunc() + } else { + r0 = ret.Get(0).(pkce.Method) + } + return r0 +} + +// MockInterface_NegotiatedPKCEMethod_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NegotiatedPKCEMethod' +type MockInterface_NegotiatedPKCEMethod_Call struct { + *mock.Call +} + +// NegotiatedPKCEMethod is a helper method to define mock.On call +func (_e *MockInterface_Expecter) NegotiatedPKCEMethod() *MockInterface_NegotiatedPKCEMethod_Call { + return &MockInterface_NegotiatedPKCEMethod_Call{Call: _e.mock.On("NegotiatedPKCEMethod")} +} + +func (_c *MockInterface_NegotiatedPKCEMethod_Call) Run(run func()) *MockInterface_NegotiatedPKCEMethod_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockInterface_NegotiatedPKCEMethod_Call) Return(method pkce.Method) *MockInterface_NegotiatedPKCEMethod_Call { + _c.Call.Return(method) + return _c +} + +func (_c *MockInterface_NegotiatedPKCEMethod_Call) RunAndReturn(run func() pkce.Method) *MockInterface_NegotiatedPKCEMethod_Call { + _c.Call.Return(run) + return _c +} + +// Refresh provides a mock function for the type MockInterface +func (_mock *MockInterface) Refresh(ctx context.Context, refreshToken string) (*oidc.TokenSet, error) { + ret := _mock.Called(ctx, refreshToken) + + if len(ret) == 0 { + panic("no return value specified for Refresh") + } + + var r0 *oidc.TokenSet + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, string) (*oidc.TokenSet, error)); ok { + return returnFunc(ctx, refreshToken) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, string) *oidc.TokenSet); ok { + r0 = returnFunc(ctx, refreshToken) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*oidc.TokenSet) + } + } + if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = returnFunc(ctx, refreshToken) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockInterface_Refresh_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Refresh' +type MockInterface_Refresh_Call struct { + *mock.Call +} + +// Refresh is a helper method to define mock.On call +// - ctx +// - refreshToken +func (_e *MockInterface_Expecter) Refresh(ctx interface{}, refreshToken interface{}) *MockInterface_Refresh_Call { + return &MockInterface_Refresh_Call{Call: _e.mock.On("Refresh", ctx, refreshToken)} +} + +func (_c *MockInterface_Refresh_Call) Run(run func(ctx context.Context, refreshToken string)) *MockInterface_Refresh_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockInterface_Refresh_Call) Return(tokenSet *oidc.TokenSet, err error) *MockInterface_Refresh_Call { + _c.Call.Return(tokenSet, err) + return _c +} + +func (_c *MockInterface_Refresh_Call) RunAndReturn(run func(ctx context.Context, refreshToken string) (*oidc.TokenSet, error)) *MockInterface_Refresh_Call { + _c.Call.Return(run) + return _c +} + +// NewMockFactoryInterface creates a new instance of MockFactoryInterface. 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 NewMockFactoryInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *MockFactoryInterface { + mock := &MockFactoryInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MockFactoryInterface is an autogenerated mock type for the FactoryInterface type +type MockFactoryInterface struct { + mock.Mock +} + +type MockFactoryInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockFactoryInterface) EXPECT() *MockFactoryInterface_Expecter { + return &MockFactoryInterface_Expecter{mock: &_m.Mock} +} + +// New provides a mock function for the type MockFactoryInterface +func (_mock *MockFactoryInterface) New(ctx context.Context, prov oidc.Provider, tlsClientConfig tlsclientconfig.Config) (client.Interface, error) { + ret := _mock.Called(ctx, prov, tlsClientConfig) + + if len(ret) == 0 { + panic("no return value specified for New") + } + + var r0 client.Interface + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, oidc.Provider, tlsclientconfig.Config) (client.Interface, error)); ok { + return returnFunc(ctx, prov, tlsClientConfig) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, oidc.Provider, tlsclientconfig.Config) client.Interface); ok { + r0 = returnFunc(ctx, prov, tlsClientConfig) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(client.Interface) + } + } + if returnFunc, ok := ret.Get(1).(func(context.Context, oidc.Provider, tlsclientconfig.Config) error); ok { + r1 = returnFunc(ctx, prov, tlsClientConfig) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockFactoryInterface_New_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'New' +type MockFactoryInterface_New_Call struct { + *mock.Call +} + +// New is a helper method to define mock.On call +// - ctx +// - prov +// - tlsClientConfig +func (_e *MockFactoryInterface_Expecter) New(ctx interface{}, prov interface{}, tlsClientConfig interface{}) *MockFactoryInterface_New_Call { + return &MockFactoryInterface_New_Call{Call: _e.mock.On("New", ctx, prov, tlsClientConfig)} +} + +func (_c *MockFactoryInterface_New_Call) Run(run func(ctx context.Context, prov oidc.Provider, tlsClientConfig tlsclientconfig.Config)) *MockFactoryInterface_New_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(oidc.Provider), args[2].(tlsclientconfig.Config)) + }) + return _c +} + +func (_c *MockFactoryInterface_New_Call) Return(interfaceParam client.Interface, err error) *MockFactoryInterface_New_Call { + _c.Call.Return(interfaceParam, err) + return _c +} + +func (_c *MockFactoryInterface_New_Call) RunAndReturn(run func(ctx context.Context, prov oidc.Provider, tlsClientConfig tlsclientconfig.Config) (client.Interface, error)) *MockFactoryInterface_New_Call { + _c.Call.Return(run) + return _c +} diff --git a/mocks/github.com/int128/kubelogin/pkg/testing/logger_mock/mock_testingLogger.go b/mocks/github.com/int128/kubelogin/pkg/testing/logger_mock/mock_testingLogger.go deleted file mode 100644 index bdf100a..0000000 --- a/mocks/github.com/int128/kubelogin/pkg/testing/logger_mock/mock_testingLogger.go +++ /dev/null @@ -1,76 +0,0 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. - -package logger_mock - -import mock "github.com/stretchr/testify/mock" - -// MocktestingLogger is an autogenerated mock type for the testingLogger type -type MocktestingLogger struct { - mock.Mock -} - -type MocktestingLogger_Expecter struct { - mock *mock.Mock -} - -func (_m *MocktestingLogger) EXPECT() *MocktestingLogger_Expecter { - return &MocktestingLogger_Expecter{mock: &_m.Mock} -} - -// Logf provides a mock function with given fields: format, v -func (_m *MocktestingLogger) Logf(format string, v ...interface{}) { - var _ca []interface{} - _ca = append(_ca, format) - _ca = append(_ca, v...) - _m.Called(_ca...) -} - -// MocktestingLogger_Logf_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Logf' -type MocktestingLogger_Logf_Call struct { - *mock.Call -} - -// Logf is a helper method to define mock.On call -// - format string -// - v ...interface{} -func (_e *MocktestingLogger_Expecter) Logf(format interface{}, v ...interface{}) *MocktestingLogger_Logf_Call { - return &MocktestingLogger_Logf_Call{Call: _e.mock.On("Logf", - append([]interface{}{format}, v...)...)} -} - -func (_c *MocktestingLogger_Logf_Call) Run(run func(format string, v ...interface{})) *MocktestingLogger_Logf_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]interface{}, len(args)-1) - for i, a := range args[1:] { - if a != nil { - variadicArgs[i] = a.(interface{}) - } - } - run(args[0].(string), variadicArgs...) - }) - return _c -} - -func (_c *MocktestingLogger_Logf_Call) Return() *MocktestingLogger_Logf_Call { - _c.Call.Return() - return _c -} - -func (_c *MocktestingLogger_Logf_Call) RunAndReturn(run func(string, ...interface{})) *MocktestingLogger_Logf_Call { - _c.Run(run) - return _c -} - -// NewMocktestingLogger creates a new instance of MocktestingLogger. 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 NewMocktestingLogger(t interface { - mock.TestingT - Cleanup(func()) -}) *MocktestingLogger { - mock := &MocktestingLogger{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/github.com/int128/kubelogin/pkg/testing/logger_mock/mocks.go b/mocks/github.com/int128/kubelogin/pkg/testing/logger_mock/mocks.go new file mode 100644 index 0000000..0a7f7b9 --- /dev/null +++ b/mocks/github.com/int128/kubelogin/pkg/testing/logger_mock/mocks.go @@ -0,0 +1,78 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package logger_mock + +import ( + mock "github.com/stretchr/testify/mock" +) + +// newMocktestingLogger creates a new instance of mocktestingLogger. 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 newMocktestingLogger(t interface { + mock.TestingT + Cleanup(func()) +}) *mocktestingLogger { + mock := &mocktestingLogger{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// mocktestingLogger is an autogenerated mock type for the testingLogger type +type mocktestingLogger struct { + mock.Mock +} + +type mocktestingLogger_Expecter struct { + mock *mock.Mock +} + +func (_m *mocktestingLogger) EXPECT() *mocktestingLogger_Expecter { + return &mocktestingLogger_Expecter{mock: &_m.Mock} +} + +// Logf provides a mock function for the type mocktestingLogger +func (_mock *mocktestingLogger) Logf(format string, v ...interface{}) { + if len(v) > 0 { + _mock.Called(format, v) + } else { + _mock.Called(format) + } + + return +} + +// mocktestingLogger_Logf_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Logf' +type mocktestingLogger_Logf_Call struct { + *mock.Call +} + +// Logf is a helper method to define mock.On call +// - format +// - v +func (_e *mocktestingLogger_Expecter) Logf(format interface{}, v ...interface{}) *mocktestingLogger_Logf_Call { + return &mocktestingLogger_Logf_Call{Call: _e.mock.On("Logf", + append([]interface{}{format}, v...)...)} +} + +func (_c *mocktestingLogger_Logf_Call) Run(run func(format string, v ...interface{})) *mocktestingLogger_Logf_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := args[1].([]interface{}) + run(args[0].(string), variadicArgs...) + }) + return _c +} + +func (_c *mocktestingLogger_Logf_Call) Return() *mocktestingLogger_Logf_Call { + _c.Call.Return() + return _c +} + +func (_c *mocktestingLogger_Logf_Call) RunAndReturn(run func(format string, v ...interface{})) *mocktestingLogger_Logf_Call { + _c.Run(run) + return _c +} diff --git a/mocks/github.com/int128/kubelogin/pkg/tlsclientconfig/loader_mock/mock_Interface.go b/mocks/github.com/int128/kubelogin/pkg/tlsclientconfig/loader_mock/mocks.go similarity index 63% rename from mocks/github.com/int128/kubelogin/pkg/tlsclientconfig/loader_mock/mock_Interface.go rename to mocks/github.com/int128/kubelogin/pkg/tlsclientconfig/loader_mock/mocks.go index b7c3fae..f70a790 100644 --- a/mocks/github.com/int128/kubelogin/pkg/tlsclientconfig/loader_mock/mock_Interface.go +++ b/mocks/github.com/int128/kubelogin/pkg/tlsclientconfig/loader_mock/mocks.go @@ -1,86 +1,16 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package loader_mock import ( - tls "crypto/tls" + "crypto/tls" + "github.com/int128/kubelogin/pkg/tlsclientconfig" mock "github.com/stretchr/testify/mock" - - tlsclientconfig "github.com/int128/kubelogin/pkg/tlsclientconfig" ) -// MockInterface is an autogenerated mock type for the Interface type -type MockInterface struct { - mock.Mock -} - -type MockInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *MockInterface) EXPECT() *MockInterface_Expecter { - return &MockInterface_Expecter{mock: &_m.Mock} -} - -// Load provides a mock function with given fields: config -func (_m *MockInterface) Load(config tlsclientconfig.Config) (*tls.Config, error) { - ret := _m.Called(config) - - if len(ret) == 0 { - panic("no return value specified for Load") - } - - var r0 *tls.Config - var r1 error - if rf, ok := ret.Get(0).(func(tlsclientconfig.Config) (*tls.Config, error)); ok { - return rf(config) - } - if rf, ok := ret.Get(0).(func(tlsclientconfig.Config) *tls.Config); ok { - r0 = rf(config) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*tls.Config) - } - } - - if rf, ok := ret.Get(1).(func(tlsclientconfig.Config) error); ok { - r1 = rf(config) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockInterface_Load_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Load' -type MockInterface_Load_Call struct { - *mock.Call -} - -// Load is a helper method to define mock.On call -// - config tlsclientconfig.Config -func (_e *MockInterface_Expecter) Load(config interface{}) *MockInterface_Load_Call { - return &MockInterface_Load_Call{Call: _e.mock.On("Load", config)} -} - -func (_c *MockInterface_Load_Call) Run(run func(config tlsclientconfig.Config)) *MockInterface_Load_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(tlsclientconfig.Config)) - }) - return _c -} - -func (_c *MockInterface_Load_Call) Return(_a0 *tls.Config, _a1 error) *MockInterface_Load_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockInterface_Load_Call) RunAndReturn(run func(tlsclientconfig.Config) (*tls.Config, error)) *MockInterface_Load_Call { - _c.Call.Return(run) - return _c -} - // NewMockInterface creates a new instance of MockInterface. 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 NewMockInterface(t interface { @@ -94,3 +24,72 @@ func NewMockInterface(t interface { return mock } + +// MockInterface is an autogenerated mock type for the Interface type +type MockInterface struct { + mock.Mock +} + +type MockInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockInterface) EXPECT() *MockInterface_Expecter { + return &MockInterface_Expecter{mock: &_m.Mock} +} + +// Load provides a mock function for the type MockInterface +func (_mock *MockInterface) Load(config tlsclientconfig.Config) (*tls.Config, error) { + ret := _mock.Called(config) + + if len(ret) == 0 { + panic("no return value specified for Load") + } + + var r0 *tls.Config + var r1 error + if returnFunc, ok := ret.Get(0).(func(tlsclientconfig.Config) (*tls.Config, error)); ok { + return returnFunc(config) + } + if returnFunc, ok := ret.Get(0).(func(tlsclientconfig.Config) *tls.Config); ok { + r0 = returnFunc(config) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*tls.Config) + } + } + if returnFunc, ok := ret.Get(1).(func(tlsclientconfig.Config) error); ok { + r1 = returnFunc(config) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockInterface_Load_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Load' +type MockInterface_Load_Call struct { + *mock.Call +} + +// Load is a helper method to define mock.On call +// - config +func (_e *MockInterface_Expecter) Load(config interface{}) *MockInterface_Load_Call { + return &MockInterface_Load_Call{Call: _e.mock.On("Load", config)} +} + +func (_c *MockInterface_Load_Call) Run(run func(config tlsclientconfig.Config)) *MockInterface_Load_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(tlsclientconfig.Config)) + }) + return _c +} + +func (_c *MockInterface_Load_Call) Return(config1 *tls.Config, err error) *MockInterface_Load_Call { + _c.Call.Return(config1, err) + return _c +} + +func (_c *MockInterface_Load_Call) RunAndReturn(run func(config tlsclientconfig.Config) (*tls.Config, error)) *MockInterface_Load_Call { + _c.Call.Return(run) + return _c +} diff --git a/mocks/github.com/int128/kubelogin/pkg/tokencache/repository_mock/mock_Interface.go b/mocks/github.com/int128/kubelogin/pkg/tokencache/repository_mock/mocks.go similarity index 58% rename from mocks/github.com/int128/kubelogin/pkg/tokencache/repository_mock/mock_Interface.go rename to mocks/github.com/int128/kubelogin/pkg/tokencache/repository_mock/mocks.go index cfbffa9..fe67d24 100644 --- a/mocks/github.com/int128/kubelogin/pkg/tokencache/repository_mock/mock_Interface.go +++ b/mocks/github.com/int128/kubelogin/pkg/tokencache/repository_mock/mocks.go @@ -1,241 +1,17 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package repository_mock import ( - io "io" + "io" - oidc "github.com/int128/kubelogin/pkg/oidc" + "github.com/int128/kubelogin/pkg/oidc" + "github.com/int128/kubelogin/pkg/tokencache" mock "github.com/stretchr/testify/mock" - - tokencache "github.com/int128/kubelogin/pkg/tokencache" ) -// MockInterface is an autogenerated mock type for the Interface type -type MockInterface struct { - mock.Mock -} - -type MockInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *MockInterface) EXPECT() *MockInterface_Expecter { - return &MockInterface_Expecter{mock: &_m.Mock} -} - -// DeleteAll provides a mock function with given fields: config -func (_m *MockInterface) DeleteAll(config tokencache.Config) error { - ret := _m.Called(config) - - if len(ret) == 0 { - panic("no return value specified for DeleteAll") - } - - var r0 error - if rf, ok := ret.Get(0).(func(tokencache.Config) error); ok { - r0 = rf(config) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// MockInterface_DeleteAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteAll' -type MockInterface_DeleteAll_Call struct { - *mock.Call -} - -// DeleteAll is a helper method to define mock.On call -// - config tokencache.Config -func (_e *MockInterface_Expecter) DeleteAll(config interface{}) *MockInterface_DeleteAll_Call { - return &MockInterface_DeleteAll_Call{Call: _e.mock.On("DeleteAll", config)} -} - -func (_c *MockInterface_DeleteAll_Call) Run(run func(config tokencache.Config)) *MockInterface_DeleteAll_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(tokencache.Config)) - }) - return _c -} - -func (_c *MockInterface_DeleteAll_Call) Return(_a0 error) *MockInterface_DeleteAll_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockInterface_DeleteAll_Call) RunAndReturn(run func(tokencache.Config) error) *MockInterface_DeleteAll_Call { - _c.Call.Return(run) - return _c -} - -// FindByKey provides a mock function with given fields: config, key -func (_m *MockInterface) FindByKey(config tokencache.Config, key tokencache.Key) (*oidc.TokenSet, error) { - ret := _m.Called(config, key) - - if len(ret) == 0 { - panic("no return value specified for FindByKey") - } - - var r0 *oidc.TokenSet - var r1 error - if rf, ok := ret.Get(0).(func(tokencache.Config, tokencache.Key) (*oidc.TokenSet, error)); ok { - return rf(config, key) - } - if rf, ok := ret.Get(0).(func(tokencache.Config, tokencache.Key) *oidc.TokenSet); ok { - r0 = rf(config, key) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*oidc.TokenSet) - } - } - - if rf, ok := ret.Get(1).(func(tokencache.Config, tokencache.Key) error); ok { - r1 = rf(config, key) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockInterface_FindByKey_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FindByKey' -type MockInterface_FindByKey_Call struct { - *mock.Call -} - -// FindByKey is a helper method to define mock.On call -// - config tokencache.Config -// - key tokencache.Key -func (_e *MockInterface_Expecter) FindByKey(config interface{}, key interface{}) *MockInterface_FindByKey_Call { - return &MockInterface_FindByKey_Call{Call: _e.mock.On("FindByKey", config, key)} -} - -func (_c *MockInterface_FindByKey_Call) Run(run func(config tokencache.Config, key tokencache.Key)) *MockInterface_FindByKey_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(tokencache.Config), args[1].(tokencache.Key)) - }) - return _c -} - -func (_c *MockInterface_FindByKey_Call) Return(_a0 *oidc.TokenSet, _a1 error) *MockInterface_FindByKey_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockInterface_FindByKey_Call) RunAndReturn(run func(tokencache.Config, tokencache.Key) (*oidc.TokenSet, error)) *MockInterface_FindByKey_Call { - _c.Call.Return(run) - return _c -} - -// Lock provides a mock function with given fields: config, key -func (_m *MockInterface) Lock(config tokencache.Config, key tokencache.Key) (io.Closer, error) { - ret := _m.Called(config, key) - - if len(ret) == 0 { - panic("no return value specified for Lock") - } - - var r0 io.Closer - var r1 error - if rf, ok := ret.Get(0).(func(tokencache.Config, tokencache.Key) (io.Closer, error)); ok { - return rf(config, key) - } - if rf, ok := ret.Get(0).(func(tokencache.Config, tokencache.Key) io.Closer); ok { - r0 = rf(config, key) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(io.Closer) - } - } - - if rf, ok := ret.Get(1).(func(tokencache.Config, tokencache.Key) error); ok { - r1 = rf(config, key) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockInterface_Lock_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Lock' -type MockInterface_Lock_Call struct { - *mock.Call -} - -// Lock is a helper method to define mock.On call -// - config tokencache.Config -// - key tokencache.Key -func (_e *MockInterface_Expecter) Lock(config interface{}, key interface{}) *MockInterface_Lock_Call { - return &MockInterface_Lock_Call{Call: _e.mock.On("Lock", config, key)} -} - -func (_c *MockInterface_Lock_Call) Run(run func(config tokencache.Config, key tokencache.Key)) *MockInterface_Lock_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(tokencache.Config), args[1].(tokencache.Key)) - }) - return _c -} - -func (_c *MockInterface_Lock_Call) Return(_a0 io.Closer, _a1 error) *MockInterface_Lock_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockInterface_Lock_Call) RunAndReturn(run func(tokencache.Config, tokencache.Key) (io.Closer, error)) *MockInterface_Lock_Call { - _c.Call.Return(run) - return _c -} - -// Save provides a mock function with given fields: config, key, tokenSet -func (_m *MockInterface) Save(config tokencache.Config, key tokencache.Key, tokenSet oidc.TokenSet) error { - ret := _m.Called(config, key, tokenSet) - - if len(ret) == 0 { - panic("no return value specified for Save") - } - - var r0 error - if rf, ok := ret.Get(0).(func(tokencache.Config, tokencache.Key, oidc.TokenSet) error); ok { - r0 = rf(config, key, tokenSet) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// MockInterface_Save_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Save' -type MockInterface_Save_Call struct { - *mock.Call -} - -// Save is a helper method to define mock.On call -// - config tokencache.Config -// - key tokencache.Key -// - tokenSet oidc.TokenSet -func (_e *MockInterface_Expecter) Save(config interface{}, key interface{}, tokenSet interface{}) *MockInterface_Save_Call { - return &MockInterface_Save_Call{Call: _e.mock.On("Save", config, key, tokenSet)} -} - -func (_c *MockInterface_Save_Call) Run(run func(config tokencache.Config, key tokencache.Key, tokenSet oidc.TokenSet)) *MockInterface_Save_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(tokencache.Config), args[1].(tokencache.Key), args[2].(oidc.TokenSet)) - }) - return _c -} - -func (_c *MockInterface_Save_Call) Return(_a0 error) *MockInterface_Save_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockInterface_Save_Call) RunAndReturn(run func(tokencache.Config, tokencache.Key, oidc.TokenSet) error) *MockInterface_Save_Call { - _c.Call.Return(run) - return _c -} - // NewMockInterface creates a new instance of MockInterface. 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 NewMockInterface(t interface { @@ -249,3 +25,222 @@ func NewMockInterface(t interface { return mock } + +// MockInterface is an autogenerated mock type for the Interface type +type MockInterface struct { + mock.Mock +} + +type MockInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockInterface) EXPECT() *MockInterface_Expecter { + return &MockInterface_Expecter{mock: &_m.Mock} +} + +// DeleteAll provides a mock function for the type MockInterface +func (_mock *MockInterface) DeleteAll(config tokencache.Config) error { + ret := _mock.Called(config) + + if len(ret) == 0 { + panic("no return value specified for DeleteAll") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(tokencache.Config) error); ok { + r0 = returnFunc(config) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockInterface_DeleteAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteAll' +type MockInterface_DeleteAll_Call struct { + *mock.Call +} + +// DeleteAll is a helper method to define mock.On call +// - config +func (_e *MockInterface_Expecter) DeleteAll(config interface{}) *MockInterface_DeleteAll_Call { + return &MockInterface_DeleteAll_Call{Call: _e.mock.On("DeleteAll", config)} +} + +func (_c *MockInterface_DeleteAll_Call) Run(run func(config tokencache.Config)) *MockInterface_DeleteAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(tokencache.Config)) + }) + return _c +} + +func (_c *MockInterface_DeleteAll_Call) Return(err error) *MockInterface_DeleteAll_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockInterface_DeleteAll_Call) RunAndReturn(run func(config tokencache.Config) error) *MockInterface_DeleteAll_Call { + _c.Call.Return(run) + return _c +} + +// FindByKey provides a mock function for the type MockInterface +func (_mock *MockInterface) FindByKey(config tokencache.Config, key tokencache.Key) (*oidc.TokenSet, error) { + ret := _mock.Called(config, key) + + if len(ret) == 0 { + panic("no return value specified for FindByKey") + } + + var r0 *oidc.TokenSet + var r1 error + if returnFunc, ok := ret.Get(0).(func(tokencache.Config, tokencache.Key) (*oidc.TokenSet, error)); ok { + return returnFunc(config, key) + } + if returnFunc, ok := ret.Get(0).(func(tokencache.Config, tokencache.Key) *oidc.TokenSet); ok { + r0 = returnFunc(config, key) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*oidc.TokenSet) + } + } + if returnFunc, ok := ret.Get(1).(func(tokencache.Config, tokencache.Key) error); ok { + r1 = returnFunc(config, key) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockInterface_FindByKey_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FindByKey' +type MockInterface_FindByKey_Call struct { + *mock.Call +} + +// FindByKey is a helper method to define mock.On call +// - config +// - key +func (_e *MockInterface_Expecter) FindByKey(config interface{}, key interface{}) *MockInterface_FindByKey_Call { + return &MockInterface_FindByKey_Call{Call: _e.mock.On("FindByKey", config, key)} +} + +func (_c *MockInterface_FindByKey_Call) Run(run func(config tokencache.Config, key tokencache.Key)) *MockInterface_FindByKey_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(tokencache.Config), args[1].(tokencache.Key)) + }) + return _c +} + +func (_c *MockInterface_FindByKey_Call) Return(tokenSet *oidc.TokenSet, err error) *MockInterface_FindByKey_Call { + _c.Call.Return(tokenSet, err) + return _c +} + +func (_c *MockInterface_FindByKey_Call) RunAndReturn(run func(config tokencache.Config, key tokencache.Key) (*oidc.TokenSet, error)) *MockInterface_FindByKey_Call { + _c.Call.Return(run) + return _c +} + +// Lock provides a mock function for the type MockInterface +func (_mock *MockInterface) Lock(config tokencache.Config, key tokencache.Key) (io.Closer, error) { + ret := _mock.Called(config, key) + + if len(ret) == 0 { + panic("no return value specified for Lock") + } + + var r0 io.Closer + var r1 error + if returnFunc, ok := ret.Get(0).(func(tokencache.Config, tokencache.Key) (io.Closer, error)); ok { + return returnFunc(config, key) + } + if returnFunc, ok := ret.Get(0).(func(tokencache.Config, tokencache.Key) io.Closer); ok { + r0 = returnFunc(config, key) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(io.Closer) + } + } + if returnFunc, ok := ret.Get(1).(func(tokencache.Config, tokencache.Key) error); ok { + r1 = returnFunc(config, key) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockInterface_Lock_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Lock' +type MockInterface_Lock_Call struct { + *mock.Call +} + +// Lock is a helper method to define mock.On call +// - config +// - key +func (_e *MockInterface_Expecter) Lock(config interface{}, key interface{}) *MockInterface_Lock_Call { + return &MockInterface_Lock_Call{Call: _e.mock.On("Lock", config, key)} +} + +func (_c *MockInterface_Lock_Call) Run(run func(config tokencache.Config, key tokencache.Key)) *MockInterface_Lock_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(tokencache.Config), args[1].(tokencache.Key)) + }) + return _c +} + +func (_c *MockInterface_Lock_Call) Return(closer io.Closer, err error) *MockInterface_Lock_Call { + _c.Call.Return(closer, err) + return _c +} + +func (_c *MockInterface_Lock_Call) RunAndReturn(run func(config tokencache.Config, key tokencache.Key) (io.Closer, error)) *MockInterface_Lock_Call { + _c.Call.Return(run) + return _c +} + +// Save provides a mock function for the type MockInterface +func (_mock *MockInterface) Save(config tokencache.Config, key tokencache.Key, tokenSet oidc.TokenSet) error { + ret := _mock.Called(config, key, tokenSet) + + if len(ret) == 0 { + panic("no return value specified for Save") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(tokencache.Config, tokencache.Key, oidc.TokenSet) error); ok { + r0 = returnFunc(config, key, tokenSet) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockInterface_Save_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Save' +type MockInterface_Save_Call struct { + *mock.Call +} + +// Save is a helper method to define mock.On call +// - config +// - key +// - tokenSet +func (_e *MockInterface_Expecter) Save(config interface{}, key interface{}, tokenSet interface{}) *MockInterface_Save_Call { + return &MockInterface_Save_Call{Call: _e.mock.On("Save", config, key, tokenSet)} +} + +func (_c *MockInterface_Save_Call) Run(run func(config tokencache.Config, key tokencache.Key, tokenSet oidc.TokenSet)) *MockInterface_Save_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(tokencache.Config), args[1].(tokencache.Key), args[2].(oidc.TokenSet)) + }) + return _c +} + +func (_c *MockInterface_Save_Call) Return(err error) *MockInterface_Save_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockInterface_Save_Call) RunAndReturn(run func(config tokencache.Config, key tokencache.Key, tokenSet oidc.TokenSet) error) *MockInterface_Save_Call { + _c.Call.Return(run) + return _c +} diff --git a/mocks/github.com/int128/kubelogin/pkg/usecases/authentication_mock/mock_Interface.go b/mocks/github.com/int128/kubelogin/pkg/usecases/authentication_mock/mocks.go similarity index 61% rename from mocks/github.com/int128/kubelogin/pkg/usecases/authentication_mock/mock_Interface.go rename to mocks/github.com/int128/kubelogin/pkg/usecases/authentication_mock/mocks.go index e347466..e73509b 100644 --- a/mocks/github.com/int128/kubelogin/pkg/usecases/authentication_mock/mock_Interface.go +++ b/mocks/github.com/int128/kubelogin/pkg/usecases/authentication_mock/mocks.go @@ -1,87 +1,16 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package authentication_mock import ( - context "context" - - authentication "github.com/int128/kubelogin/pkg/usecases/authentication" + "context" + "github.com/int128/kubelogin/pkg/usecases/authentication" mock "github.com/stretchr/testify/mock" ) -// MockInterface is an autogenerated mock type for the Interface type -type MockInterface struct { - mock.Mock -} - -type MockInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *MockInterface) EXPECT() *MockInterface_Expecter { - return &MockInterface_Expecter{mock: &_m.Mock} -} - -// Do provides a mock function with given fields: ctx, in -func (_m *MockInterface) Do(ctx context.Context, in authentication.Input) (*authentication.Output, error) { - ret := _m.Called(ctx, in) - - if len(ret) == 0 { - panic("no return value specified for Do") - } - - var r0 *authentication.Output - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, authentication.Input) (*authentication.Output, error)); ok { - return rf(ctx, in) - } - if rf, ok := ret.Get(0).(func(context.Context, authentication.Input) *authentication.Output); ok { - r0 = rf(ctx, in) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*authentication.Output) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, authentication.Input) error); ok { - r1 = rf(ctx, in) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockInterface_Do_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Do' -type MockInterface_Do_Call struct { - *mock.Call -} - -// Do is a helper method to define mock.On call -// - ctx context.Context -// - in authentication.Input -func (_e *MockInterface_Expecter) Do(ctx interface{}, in interface{}) *MockInterface_Do_Call { - return &MockInterface_Do_Call{Call: _e.mock.On("Do", ctx, in)} -} - -func (_c *MockInterface_Do_Call) Run(run func(ctx context.Context, in authentication.Input)) *MockInterface_Do_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(authentication.Input)) - }) - return _c -} - -func (_c *MockInterface_Do_Call) Return(_a0 *authentication.Output, _a1 error) *MockInterface_Do_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockInterface_Do_Call) RunAndReturn(run func(context.Context, authentication.Input) (*authentication.Output, error)) *MockInterface_Do_Call { - _c.Call.Return(run) - return _c -} - // NewMockInterface creates a new instance of MockInterface. 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 NewMockInterface(t interface { @@ -95,3 +24,73 @@ func NewMockInterface(t interface { return mock } + +// MockInterface is an autogenerated mock type for the Interface type +type MockInterface struct { + mock.Mock +} + +type MockInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockInterface) EXPECT() *MockInterface_Expecter { + return &MockInterface_Expecter{mock: &_m.Mock} +} + +// Do provides a mock function for the type MockInterface +func (_mock *MockInterface) Do(ctx context.Context, in authentication.Input) (*authentication.Output, error) { + ret := _mock.Called(ctx, in) + + if len(ret) == 0 { + panic("no return value specified for Do") + } + + var r0 *authentication.Output + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, authentication.Input) (*authentication.Output, error)); ok { + return returnFunc(ctx, in) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, authentication.Input) *authentication.Output); ok { + r0 = returnFunc(ctx, in) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*authentication.Output) + } + } + if returnFunc, ok := ret.Get(1).(func(context.Context, authentication.Input) error); ok { + r1 = returnFunc(ctx, in) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockInterface_Do_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Do' +type MockInterface_Do_Call struct { + *mock.Call +} + +// Do is a helper method to define mock.On call +// - ctx +// - in +func (_e *MockInterface_Expecter) Do(ctx interface{}, in interface{}) *MockInterface_Do_Call { + return &MockInterface_Do_Call{Call: _e.mock.On("Do", ctx, in)} +} + +func (_c *MockInterface_Do_Call) Run(run func(ctx context.Context, in authentication.Input)) *MockInterface_Do_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(authentication.Input)) + }) + return _c +} + +func (_c *MockInterface_Do_Call) Return(output *authentication.Output, err error) *MockInterface_Do_Call { + _c.Call.Return(output, err) + return _c +} + +func (_c *MockInterface_Do_Call) RunAndReturn(run func(ctx context.Context, in authentication.Input) (*authentication.Output, error)) *MockInterface_Do_Call { + _c.Call.Return(run) + return _c +} diff --git a/mocks/github.com/int128/kubelogin/pkg/usecases/clean_mock/mock_Interface.go b/mocks/github.com/int128/kubelogin/pkg/usecases/clean_mock/mocks.go similarity index 70% rename from mocks/github.com/int128/kubelogin/pkg/usecases/clean_mock/mock_Interface.go rename to mocks/github.com/int128/kubelogin/pkg/usecases/clean_mock/mocks.go index 1ba3af2..d9945ae 100644 --- a/mocks/github.com/int128/kubelogin/pkg/usecases/clean_mock/mock_Interface.go +++ b/mocks/github.com/int128/kubelogin/pkg/usecases/clean_mock/mocks.go @@ -1,75 +1,16 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package clean_mock import ( - context "context" - - clean "github.com/int128/kubelogin/pkg/usecases/clean" + "context" + "github.com/int128/kubelogin/pkg/usecases/clean" mock "github.com/stretchr/testify/mock" ) -// MockInterface is an autogenerated mock type for the Interface type -type MockInterface struct { - mock.Mock -} - -type MockInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *MockInterface) EXPECT() *MockInterface_Expecter { - return &MockInterface_Expecter{mock: &_m.Mock} -} - -// Do provides a mock function with given fields: ctx, in -func (_m *MockInterface) Do(ctx context.Context, in clean.Input) error { - ret := _m.Called(ctx, in) - - if len(ret) == 0 { - panic("no return value specified for Do") - } - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, clean.Input) error); ok { - r0 = rf(ctx, in) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// MockInterface_Do_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Do' -type MockInterface_Do_Call struct { - *mock.Call -} - -// Do is a helper method to define mock.On call -// - ctx context.Context -// - in clean.Input -func (_e *MockInterface_Expecter) Do(ctx interface{}, in interface{}) *MockInterface_Do_Call { - return &MockInterface_Do_Call{Call: _e.mock.On("Do", ctx, in)} -} - -func (_c *MockInterface_Do_Call) Run(run func(ctx context.Context, in clean.Input)) *MockInterface_Do_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(clean.Input)) - }) - return _c -} - -func (_c *MockInterface_Do_Call) Return(_a0 error) *MockInterface_Do_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockInterface_Do_Call) RunAndReturn(run func(context.Context, clean.Input) error) *MockInterface_Do_Call { - _c.Call.Return(run) - return _c -} - // NewMockInterface creates a new instance of MockInterface. 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 NewMockInterface(t interface { @@ -83,3 +24,62 @@ func NewMockInterface(t interface { return mock } + +// MockInterface is an autogenerated mock type for the Interface type +type MockInterface struct { + mock.Mock +} + +type MockInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockInterface) EXPECT() *MockInterface_Expecter { + return &MockInterface_Expecter{mock: &_m.Mock} +} + +// Do provides a mock function for the type MockInterface +func (_mock *MockInterface) Do(ctx context.Context, in clean.Input) error { + ret := _mock.Called(ctx, in) + + if len(ret) == 0 { + panic("no return value specified for Do") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(context.Context, clean.Input) error); ok { + r0 = returnFunc(ctx, in) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockInterface_Do_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Do' +type MockInterface_Do_Call struct { + *mock.Call +} + +// Do is a helper method to define mock.On call +// - ctx +// - in +func (_e *MockInterface_Expecter) Do(ctx interface{}, in interface{}) *MockInterface_Do_Call { + return &MockInterface_Do_Call{Call: _e.mock.On("Do", ctx, in)} +} + +func (_c *MockInterface_Do_Call) Run(run func(ctx context.Context, in clean.Input)) *MockInterface_Do_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(clean.Input)) + }) + return _c +} + +func (_c *MockInterface_Do_Call) Return(err error) *MockInterface_Do_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockInterface_Do_Call) RunAndReturn(run func(ctx context.Context, in clean.Input) error) *MockInterface_Do_Call { + _c.Call.Return(run) + return _c +} diff --git a/mocks/github.com/int128/kubelogin/pkg/usecases/credentialplugin_mock/mock_Interface.go b/mocks/github.com/int128/kubelogin/pkg/usecases/credentialplugin_mock/mocks.go similarity index 69% rename from mocks/github.com/int128/kubelogin/pkg/usecases/credentialplugin_mock/mock_Interface.go rename to mocks/github.com/int128/kubelogin/pkg/usecases/credentialplugin_mock/mocks.go index c41bb79..d3813c0 100644 --- a/mocks/github.com/int128/kubelogin/pkg/usecases/credentialplugin_mock/mock_Interface.go +++ b/mocks/github.com/int128/kubelogin/pkg/usecases/credentialplugin_mock/mocks.go @@ -1,74 +1,16 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package credentialplugin_mock import ( - context "context" + "context" - credentialplugin "github.com/int128/kubelogin/pkg/usecases/credentialplugin" + "github.com/int128/kubelogin/pkg/usecases/credentialplugin" mock "github.com/stretchr/testify/mock" ) -// MockInterface is an autogenerated mock type for the Interface type -type MockInterface struct { - mock.Mock -} - -type MockInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *MockInterface) EXPECT() *MockInterface_Expecter { - return &MockInterface_Expecter{mock: &_m.Mock} -} - -// Do provides a mock function with given fields: ctx, in -func (_m *MockInterface) Do(ctx context.Context, in credentialplugin.Input) error { - ret := _m.Called(ctx, in) - - if len(ret) == 0 { - panic("no return value specified for Do") - } - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, credentialplugin.Input) error); ok { - r0 = rf(ctx, in) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// MockInterface_Do_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Do' -type MockInterface_Do_Call struct { - *mock.Call -} - -// Do is a helper method to define mock.On call -// - ctx context.Context -// - in credentialplugin.Input -func (_e *MockInterface_Expecter) Do(ctx interface{}, in interface{}) *MockInterface_Do_Call { - return &MockInterface_Do_Call{Call: _e.mock.On("Do", ctx, in)} -} - -func (_c *MockInterface_Do_Call) Run(run func(ctx context.Context, in credentialplugin.Input)) *MockInterface_Do_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(credentialplugin.Input)) - }) - return _c -} - -func (_c *MockInterface_Do_Call) Return(_a0 error) *MockInterface_Do_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockInterface_Do_Call) RunAndReturn(run func(context.Context, credentialplugin.Input) error) *MockInterface_Do_Call { - _c.Call.Return(run) - return _c -} - // NewMockInterface creates a new instance of MockInterface. 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 NewMockInterface(t interface { @@ -82,3 +24,62 @@ func NewMockInterface(t interface { return mock } + +// MockInterface is an autogenerated mock type for the Interface type +type MockInterface struct { + mock.Mock +} + +type MockInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockInterface) EXPECT() *MockInterface_Expecter { + return &MockInterface_Expecter{mock: &_m.Mock} +} + +// Do provides a mock function for the type MockInterface +func (_mock *MockInterface) Do(ctx context.Context, in credentialplugin.Input) error { + ret := _mock.Called(ctx, in) + + if len(ret) == 0 { + panic("no return value specified for Do") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(context.Context, credentialplugin.Input) error); ok { + r0 = returnFunc(ctx, in) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockInterface_Do_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Do' +type MockInterface_Do_Call struct { + *mock.Call +} + +// Do is a helper method to define mock.On call +// - ctx +// - in +func (_e *MockInterface_Expecter) Do(ctx interface{}, in interface{}) *MockInterface_Do_Call { + return &MockInterface_Do_Call{Call: _e.mock.On("Do", ctx, in)} +} + +func (_c *MockInterface_Do_Call) Run(run func(ctx context.Context, in credentialplugin.Input)) *MockInterface_Do_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(credentialplugin.Input)) + }) + return _c +} + +func (_c *MockInterface_Do_Call) Return(err error) *MockInterface_Do_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockInterface_Do_Call) RunAndReturn(run func(ctx context.Context, in credentialplugin.Input) error) *MockInterface_Do_Call { + _c.Call.Return(run) + return _c +} diff --git a/mocks/github.com/int128/kubelogin/pkg/usecases/setup_mock/mock_Interface.go b/mocks/github.com/int128/kubelogin/pkg/usecases/setup_mock/mocks.go similarity index 70% rename from mocks/github.com/int128/kubelogin/pkg/usecases/setup_mock/mock_Interface.go rename to mocks/github.com/int128/kubelogin/pkg/usecases/setup_mock/mocks.go index 89b9aa6..ae143c1 100644 --- a/mocks/github.com/int128/kubelogin/pkg/usecases/setup_mock/mock_Interface.go +++ b/mocks/github.com/int128/kubelogin/pkg/usecases/setup_mock/mocks.go @@ -1,74 +1,16 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package setup_mock import ( - context "context" + "context" - setup "github.com/int128/kubelogin/pkg/usecases/setup" + "github.com/int128/kubelogin/pkg/usecases/setup" mock "github.com/stretchr/testify/mock" ) -// MockInterface is an autogenerated mock type for the Interface type -type MockInterface struct { - mock.Mock -} - -type MockInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *MockInterface) EXPECT() *MockInterface_Expecter { - return &MockInterface_Expecter{mock: &_m.Mock} -} - -// Do provides a mock function with given fields: ctx, in -func (_m *MockInterface) Do(ctx context.Context, in setup.Input) error { - ret := _m.Called(ctx, in) - - if len(ret) == 0 { - panic("no return value specified for Do") - } - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, setup.Input) error); ok { - r0 = rf(ctx, in) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// MockInterface_Do_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Do' -type MockInterface_Do_Call struct { - *mock.Call -} - -// Do is a helper method to define mock.On call -// - ctx context.Context -// - in setup.Input -func (_e *MockInterface_Expecter) Do(ctx interface{}, in interface{}) *MockInterface_Do_Call { - return &MockInterface_Do_Call{Call: _e.mock.On("Do", ctx, in)} -} - -func (_c *MockInterface_Do_Call) Run(run func(ctx context.Context, in setup.Input)) *MockInterface_Do_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(setup.Input)) - }) - return _c -} - -func (_c *MockInterface_Do_Call) Return(_a0 error) *MockInterface_Do_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockInterface_Do_Call) RunAndReturn(run func(context.Context, setup.Input) error) *MockInterface_Do_Call { - _c.Call.Return(run) - return _c -} - // NewMockInterface creates a new instance of MockInterface. 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 NewMockInterface(t interface { @@ -82,3 +24,62 @@ func NewMockInterface(t interface { return mock } + +// MockInterface is an autogenerated mock type for the Interface type +type MockInterface struct { + mock.Mock +} + +type MockInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockInterface) EXPECT() *MockInterface_Expecter { + return &MockInterface_Expecter{mock: &_m.Mock} +} + +// Do provides a mock function for the type MockInterface +func (_mock *MockInterface) Do(ctx context.Context, in setup.Input) error { + ret := _mock.Called(ctx, in) + + if len(ret) == 0 { + panic("no return value specified for Do") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(context.Context, setup.Input) error); ok { + r0 = returnFunc(ctx, in) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockInterface_Do_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Do' +type MockInterface_Do_Call struct { + *mock.Call +} + +// Do is a helper method to define mock.On call +// - ctx +// - in +func (_e *MockInterface_Expecter) Do(ctx interface{}, in interface{}) *MockInterface_Do_Call { + return &MockInterface_Do_Call{Call: _e.mock.On("Do", ctx, in)} +} + +func (_c *MockInterface_Do_Call) Run(run func(ctx context.Context, in setup.Input)) *MockInterface_Do_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(setup.Input)) + }) + return _c +} + +func (_c *MockInterface_Do_Call) Return(err error) *MockInterface_Do_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockInterface_Do_Call) RunAndReturn(run func(ctx context.Context, in setup.Input) error) *MockInterface_Do_Call { + _c.Call.Return(run) + return _c +} diff --git a/mocks/github.com/int128/kubelogin/pkg/usecases/standalone_mock/mock_Interface.go b/mocks/github.com/int128/kubelogin/pkg/usecases/standalone_mock/mocks.go similarity index 70% rename from mocks/github.com/int128/kubelogin/pkg/usecases/standalone_mock/mock_Interface.go rename to mocks/github.com/int128/kubelogin/pkg/usecases/standalone_mock/mocks.go index 3072de0..13af5c7 100644 --- a/mocks/github.com/int128/kubelogin/pkg/usecases/standalone_mock/mock_Interface.go +++ b/mocks/github.com/int128/kubelogin/pkg/usecases/standalone_mock/mocks.go @@ -1,74 +1,16 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package standalone_mock import ( - context "context" + "context" - standalone "github.com/int128/kubelogin/pkg/usecases/standalone" + "github.com/int128/kubelogin/pkg/usecases/standalone" mock "github.com/stretchr/testify/mock" ) -// MockInterface is an autogenerated mock type for the Interface type -type MockInterface struct { - mock.Mock -} - -type MockInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *MockInterface) EXPECT() *MockInterface_Expecter { - return &MockInterface_Expecter{mock: &_m.Mock} -} - -// Do provides a mock function with given fields: ctx, in -func (_m *MockInterface) Do(ctx context.Context, in standalone.Input) error { - ret := _m.Called(ctx, in) - - if len(ret) == 0 { - panic("no return value specified for Do") - } - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, standalone.Input) error); ok { - r0 = rf(ctx, in) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// MockInterface_Do_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Do' -type MockInterface_Do_Call struct { - *mock.Call -} - -// Do is a helper method to define mock.On call -// - ctx context.Context -// - in standalone.Input -func (_e *MockInterface_Expecter) Do(ctx interface{}, in interface{}) *MockInterface_Do_Call { - return &MockInterface_Do_Call{Call: _e.mock.On("Do", ctx, in)} -} - -func (_c *MockInterface_Do_Call) Run(run func(ctx context.Context, in standalone.Input)) *MockInterface_Do_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(standalone.Input)) - }) - return _c -} - -func (_c *MockInterface_Do_Call) Return(_a0 error) *MockInterface_Do_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockInterface_Do_Call) RunAndReturn(run func(context.Context, standalone.Input) error) *MockInterface_Do_Call { - _c.Call.Return(run) - return _c -} - // NewMockInterface creates a new instance of MockInterface. 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 NewMockInterface(t interface { @@ -82,3 +24,62 @@ func NewMockInterface(t interface { return mock } + +// MockInterface is an autogenerated mock type for the Interface type +type MockInterface struct { + mock.Mock +} + +type MockInterface_Expecter struct { + mock *mock.Mock +} + +func (_m *MockInterface) EXPECT() *MockInterface_Expecter { + return &MockInterface_Expecter{mock: &_m.Mock} +} + +// Do provides a mock function for the type MockInterface +func (_mock *MockInterface) Do(ctx context.Context, in standalone.Input) error { + ret := _mock.Called(ctx, in) + + if len(ret) == 0 { + panic("no return value specified for Do") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(context.Context, standalone.Input) error); ok { + r0 = returnFunc(ctx, in) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockInterface_Do_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Do' +type MockInterface_Do_Call struct { + *mock.Call +} + +// Do is a helper method to define mock.On call +// - ctx +// - in +func (_e *MockInterface_Expecter) Do(ctx interface{}, in interface{}) *MockInterface_Do_Call { + return &MockInterface_Do_Call{Call: _e.mock.On("Do", ctx, in)} +} + +func (_c *MockInterface_Do_Call) Run(run func(ctx context.Context, in standalone.Input)) *MockInterface_Do_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(standalone.Input)) + }) + return _c +} + +func (_c *MockInterface_Do_Call) Return(err error) *MockInterface_Do_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockInterface_Do_Call) RunAndReturn(run func(ctx context.Context, in standalone.Input) error) *MockInterface_Do_Call { + _c.Call.Return(run) + return _c +} diff --git a/mocks/io_mock/mock_Closer.go b/mocks/io_mock/mocks.go similarity index 77% rename from mocks/io_mock/mock_Closer.go rename to mocks/io_mock/mocks.go index c6fdd7d..3b2ab0d 100644 --- a/mocks/io_mock/mock_Closer.go +++ b/mocks/io_mock/mocks.go @@ -1,8 +1,26 @@ -// Code generated by mockery v2.53.3. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package io_mock -import mock "github.com/stretchr/testify/mock" +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewMockCloser creates a new instance of MockCloser. 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 NewMockCloser(t interface { + mock.TestingT + Cleanup(func()) +}) *MockCloser { + mock := &MockCloser{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} // MockCloser is an autogenerated mock type for the Closer type type MockCloser struct { @@ -17,21 +35,20 @@ func (_m *MockCloser) EXPECT() *MockCloser_Expecter { return &MockCloser_Expecter{mock: &_m.Mock} } -// Close provides a mock function with no fields -func (_m *MockCloser) Close() error { - ret := _m.Called() +// Close provides a mock function for the type MockCloser +func (_mock *MockCloser) Close() error { + ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for Close") } var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() + if returnFunc, ok := ret.Get(0).(func() error); ok { + r0 = returnFunc() } else { r0 = ret.Error(0) } - return r0 } @@ -52,8 +69,8 @@ func (_c *MockCloser_Close_Call) Run(run func()) *MockCloser_Close_Call { return _c } -func (_c *MockCloser_Close_Call) Return(_a0 error) *MockCloser_Close_Call { - _c.Call.Return(_a0) +func (_c *MockCloser_Close_Call) Return(err error) *MockCloser_Close_Call { + _c.Call.Return(err) return _c } @@ -61,17 +78,3 @@ func (_c *MockCloser_Close_Call) RunAndReturn(run func() error) *MockCloser_Clos _c.Call.Return(run) return _c } - -// NewMockCloser creates a new instance of MockCloser. 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 NewMockCloser(t interface { - mock.TestingT - Cleanup(func()) -}) *MockCloser { - mock := &MockCloser{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -}