Skip to content

Commit

Permalink
chore(deps): bump github.com/ViBiOh/mailer from 1.26.2 to 1.26.4
Browse files Browse the repository at this point in the history
Bumps [github.com/ViBiOh/mailer](https://github.com/ViBiOh/mailer) from 1.26.2 to 1.26.4.
- [Release notes](https://github.com/ViBiOh/mailer/releases)
- [Commits](ViBiOh/mailer@v1.26.2...v1.26.4)

---
updated-dependencies:
- dependency-name: github.com/ViBiOh/mailer
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: Vincent Boutour <[email protected]>
  • Loading branch information
dependabot[bot] authored and ViBiOh committed Oct 17, 2021
1 parent d607e45 commit 93a7cf5
Show file tree
Hide file tree
Showing 15 changed files with 57 additions and 34 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Usage of ketchup:
-corsOrigin string
[cors] Access-Control-Allow-Origin {KETCHUP_CORS_ORIGIN} (default "*")
-csp string
[owasp] Content-Security-Policy {KETCHUP_CSP} (default "default-src 'self'; base-uri 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'")
[owasp] Content-Security-Policy {KETCHUP_CSP} (default "default-src 'self'; base-uri 'self'; script-src 'self' 'nonce'; style-src 'self' 'nonce'")
-dbHost string
[db] Host {KETCHUP_DB_HOST}
-dbMaxConn uint
Expand Down
2 changes: 1 addition & 1 deletion cmd/ketchup/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func main() {
alcotestConfig := alcotest.Flags(fs, "")
loggerConfig := logger.Flags(fs, "logger")
prometheusConfig := prometheus.Flags(fs, "prometheus", flags.NewOverride("Gzip", false))
owaspConfig := owasp.Flags(fs, "", flags.NewOverride("Csp", "default-src 'self'; base-uri 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'"))
owaspConfig := owasp.Flags(fs, "", flags.NewOverride("Csp", "default-src 'self'; base-uri 'self'; script-src 'self' 'nonce'; style-src 'self' 'nonce'"))
corsConfig := cors.Flags(fs, "cors")
rendererConfig := renderer.Flags(fs, "", flags.NewOverride("Title", "Ketchup"), flags.NewOverride("PublicURL", "https://ketchup.vibioh.fr"))

Expand Down
16 changes: 12 additions & 4 deletions cmd/ketchup/templates/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ define "main-style" }}
<style type="text/css">
<style type="text/css" nonce="{{ .nonce }}">
:root {
--primary: cornflowerblue;
--success: limegreen;
Expand Down Expand Up @@ -177,7 +177,6 @@

.header {
background-color: var(--grey);
margin-bottom: 0;
margin-top: 0;
padding: calc(var(--space-size) / 2) var(--space-size);
text-align: left;
Expand Down Expand Up @@ -260,7 +259,7 @@
{{ end }}

{{ define "main-script" }}
<script type="text/javascript">
<script type="text/javascript" nonce="{{ .nonce }}">
/**
* Go back from state.
*/
Expand All @@ -283,6 +282,15 @@
break;
}
};

const link = document.getElementById("go-back");
if (link) {
link.setAttribute("href", document.referrer);
link.addEventListener("click", () => {
history.back();
return false;
});
}
</script>
{{ end }}

Expand Down Expand Up @@ -353,7 +361,7 @@ <h1 class="no-margin no-padding">
{{ end }}

<h3 class="center">
<a href="javascript:history.back()">Go Back</a>
<a id="go-back" href="#">Go Back</a>
</h3>

{{ template "footer" . }}
Expand Down
6 changes: 3 additions & 3 deletions cmd/ketchup/templates/ketchup.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ <h2 class="header">Create ketchup</h2>
</div>
</div>

<script type="text/javascript">
<script type="text/javascript" nonce="{{ .nonce }}">
const repositoryInput = document.getElementById('create-name');
const nameInput = document.getElementById('create-part-wrapper');

Expand Down Expand Up @@ -208,7 +208,7 @@ <h2 class="header">Confirmation</h2>
{{ end }}

{{ define "ketchups" }}
<style type="text/css">
<style type="text/css" nonce="{{ .nonce }}">
{{ range .Ketchups }}
#delete-modal-{{ .ID }}:target,
#edit-modal-{{ .ID }}:target,
Expand Down Expand Up @@ -312,7 +312,7 @@ <h2 class="header">Confirmation</h2>
}
</style>

{{ template "create-modal" }}
{{ template "create-modal" . }}

{{ $ketchupType := "" }}

Expand Down
2 changes: 1 addition & 1 deletion cmd/ketchup/templates/public.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
{{ end }}

{{ define "signup" }}
<style type="text/css">
<style type="text/css" nonce="{{ .nonce }}">
.active-link {
color: var(--primary);
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/ketchup/templates/suggest.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{ define "suggests" }}
{{ if .Suggests }}
<style type="text/css">
<style type="text/css" nonce="{{ .nonce }}">
.ketchups {
align-items: center;
display: flex;
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.17
require (
github.com/ViBiOh/auth/v2 v2.11.15
github.com/ViBiOh/httputils/v4 v4.27.0
github.com/ViBiOh/mailer v1.26.2
github.com/ViBiOh/mailer v1.26.4
github.com/golang/mock v1.6.0
github.com/jackc/pgconn v1.10.0
github.com/jackc/pgproto3/v2 v2.1.1
Expand Down
9 changes: 2 additions & 7 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,10 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
github.com/ViBiOh/auth/v2 v2.11.15 h1:S8YP6AYsEbY95efUNDxGYlrZsrYGQ1p1bKbOKsdxuGU=
github.com/ViBiOh/auth/v2 v2.11.15/go.mod h1:/8cIttMH6PCN4OpCKXhJAjkdIOClydLqgnmWHAzY01Q=
github.com/ViBiOh/httputils/v4 v4.25.3/go.mod h1:y4waNFK8VE1B96OFIWQfBZKSCKUQkCSsz2T5gXcUGbw=
github.com/ViBiOh/httputils/v4 v4.27.0 h1:Ov258QHxTtlQB7nKIgko+jtbvaRtqLASJ/x8QjWI9Tg=
github.com/ViBiOh/httputils/v4 v4.27.0/go.mod h1:/3tDDPDH7DyT/Fd9ulT/F46Cbcawc+TLs6e54sDewrg=
github.com/ViBiOh/mailer v1.26.2 h1:9rN3CzvS5B2ZfEs9eKfD41Q3WxVS6ZQrnXcqJIOrL4Q=
github.com/ViBiOh/mailer v1.26.2/go.mod h1:h1XN26Pz1wJelDVCQZnprq59pvTkhXRb/fhGj8QrA1c=
github.com/ViBiOh/mailer v1.26.4 h1:KIdb4KXly9SP7Mkg6Jl8Na9vhR5fLiWA2P/LxWFP9yw=
github.com/ViBiOh/mailer v1.26.4/go.mod h1:ufSO5iJ+egJH2C4ZrxMGf+pVjA8YgJiqJklzSTwOJ30=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
Expand Down Expand Up @@ -89,7 +88,6 @@ github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vb
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
github.com/go-redis/redis/v8 v8.11.3/go.mod h1:xNJ9xDG09FsIPwh3bWdk+0oDWHbtF9rPN0F/oD9XeKc=
github.com/go-redis/redis/v8 v8.11.4 h1:kHoYkfZP6+pe04aFTnhDH6GDROa5yJdHJVNxV3F46Tg=
github.com/go-redis/redis/v8 v8.11.4/go.mod h1:2Z2wHZXdQpCDXEGzqMockDpNyYvi2l4Pxt6RJr792+w=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
Expand Down Expand Up @@ -157,7 +155,6 @@ github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0=
github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo=
github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk=
github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8=
Expand All @@ -178,7 +175,6 @@ github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65 h1:DadwsjnMwFjfWc9y5W
github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65/go.mod h1:5R2h2EEX+qri8jOWMbJCtaPWkrrNc7OHwsp2TCqp7ak=
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
github.com/jackc/pgproto3 v1.1.0 h1:FYYE4yRw+AgI8wXIinMlNjBbp/UitDJwfj5LqqewP1A=
github.com/jackc/pgproto3 v1.1.0/go.mod h1:eR5FA3leWg7p9aeAqi37XOTgTIbkABlvcPB3E5rlc78=
github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190420180111-c116219b62db/go.mod h1:bhq50y+xrl9n5mRYyCBFKkpRVTLYJVWeCc+mEAI3yXA=
github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190609003834-432c2951c711/go.mod h1:uH0AWtUmuShn0bcesswc4aBTWGvw0cAxIJp+6OB//Wg=
Expand Down Expand Up @@ -252,7 +248,6 @@ github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc=
github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/onsi/gomega v1.15.0/go.mod h1:cIuvLEne0aoVhAgh/O6ac0Op8WWw9H6eYCriF+tEHG0=
github.com/onsi/gomega v1.16.0 h1:6gjqkI8iiRHMvdccRJM8rVKjCWk6ZIm6FTm3ddIe4/c=
github.com/onsi/gomega v1.16.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
Expand Down
19 changes: 19 additions & 0 deletions pkg/mocks/database.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pkg/model/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ type Database interface {
Get(context.Context, func(pgx.Row) error, string, ...interface{}) error
Create(context.Context, string, ...interface{}) (uint64, error)
Exec(context.Context, string, ...interface{}) error
One(context.Context, string, ...interface{}) error
DoAtomic(context.Context, func(context.Context) error) error
}
6 changes: 3 additions & 3 deletions pkg/store/ketchup/ketchup.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ WHERE

// Update a ketchup
func (a App) Update(ctx context.Context, o model.Ketchup, oldPattern string) error {
return a.db.Exec(ctx, updateQuery, o.Repository.ID, model.ReadUser(ctx).ID, oldPattern, o.Pattern, o.Version, strings.ToLower(o.Frequency.String()), o.UpdateWhenNotify)
return a.db.One(ctx, updateQuery, o.Repository.ID, model.ReadUser(ctx).ID, oldPattern, o.Pattern, o.Version, strings.ToLower(o.Frequency.String()), o.UpdateWhenNotify)
}

const updateAllQuery = `
Expand Down Expand Up @@ -368,7 +368,7 @@ WHERE

// UpdateVersion of a ketchup
func (a App) UpdateVersion(ctx context.Context, userID, repositoryID uint64, pattern, version string) error {
return a.db.Exec(ctx, updateVersionQuery, repositoryID, userID, pattern, version)
return a.db.One(ctx, updateVersionQuery, repositoryID, userID, pattern, version)
}

const deleteQuery = `
Expand All @@ -382,5 +382,5 @@ WHERE

// Delete a ketchup
func (a App) Delete(ctx context.Context, o model.Ketchup) error {
return a.db.Exec(ctx, deleteQuery, o.Repository.ID, model.ReadUser(ctx).ID, o.Pattern)
return a.db.One(ctx, deleteQuery, o.Repository.ID, model.ReadUser(ctx).ID, o.Pattern)
}
4 changes: 2 additions & 2 deletions pkg/store/ketchup/ketchup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ func TestUpdate(t *testing.T) {

switch tc.intention {
case "simple":
mockDatabase.EXPECT().Exec(gomock.Any(), gomock.Any(), uint64(1), uint64(3), model.DefaultPattern, model.DefaultPattern, "0.9.0", "daily", gomock.Any()).Return(nil)
mockDatabase.EXPECT().One(gomock.Any(), gomock.Any(), uint64(1), uint64(3), model.DefaultPattern, model.DefaultPattern, "0.9.0", "daily", gomock.Any()).Return(nil)
}

gotErr := instance.Update(testCtx, tc.args.o, tc.args.oldPattern)
Expand Down Expand Up @@ -534,7 +534,7 @@ func TestDelete(t *testing.T) {

switch tc.intention {
case "simple":
mockDatabase.EXPECT().Exec(gomock.Any(), gomock.Any(), uint64(1), uint64(3), model.DefaultPattern).Return(nil)
mockDatabase.EXPECT().One(gomock.Any(), gomock.Any(), uint64(1), uint64(3), model.DefaultPattern).Return(nil)
}

gotErr := instance.Delete(testCtx, tc.args.o)
Expand Down
2 changes: 1 addition & 1 deletion pkg/store/repository/repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ func TestCreate(t *testing.T) {
mockDatabase.EXPECT().Get(gomock.Any(), gomock.Any(), gomock.Any(), "github", ketchupRepository, "").Return(nil)
mockDatabase.EXPECT().Create(gomock.Any(), gomock.Any(), "github", ketchupRepository, "").Return(uint64(1), nil)
mockDatabase.EXPECT().List(gomock.Any(), gomock.Any(), gomock.Any(), uint64(1)).Return(nil)
mockDatabase.EXPECT().Exec(gomock.Any(), gomock.Any(), uint64(1), model.DefaultPattern, "1.0.0").Return(nil)
mockDatabase.EXPECT().One(gomock.Any(), gomock.Any(), uint64(1), model.DefaultPattern, "1.0.0").Return(nil)
}

got, gotErr := instance.Create(context.Background(), tc.args.o)
Expand Down
6 changes: 3 additions & 3 deletions pkg/store/repository/repository_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (a App) UpdateVersions(ctx context.Context, o model.Repository) error {
for pattern, version := range patterns {
repositoryVersion, ok := o.Versions[pattern]
if !ok {
if err := a.db.Exec(ctx, deleteRepositoryVersionQuery, o.ID, pattern); err != nil {
if err := a.db.One(ctx, deleteRepositoryVersionQuery, o.ID, pattern); err != nil {
return fmt.Errorf("unable to delete repository version: %w", err)
}
continue
Expand All @@ -116,7 +116,7 @@ func (a App) UpdateVersions(ctx context.Context, o model.Repository) error {
continue
}

if err := a.db.Exec(ctx, updateRepositoryVersionQuery, o.ID, pattern, repositoryVersion); err != nil {
if err := a.db.One(ctx, updateRepositoryVersionQuery, o.ID, pattern, repositoryVersion); err != nil {
return fmt.Errorf("unable to update repository version: %w", err)
}
}
Expand All @@ -126,7 +126,7 @@ func (a App) UpdateVersions(ctx context.Context, o model.Repository) error {
continue
}

if err := a.db.Exec(ctx, createRepositoryVersionQuery, o.ID, pattern, version); err != nil {
if err := a.db.One(ctx, createRepositoryVersionQuery, o.ID, pattern, version); err != nil {
return fmt.Errorf("unable to create repository version: %w", err)
}
}
Expand Down
12 changes: 6 additions & 6 deletions pkg/store/repository/repository_version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ func TestUpdateVersions(t *testing.T) {
mockDatabase.EXPECT().List(gomock.Any(), gomock.Any(), gomock.Any(), uint64(0)).Return(nil)
case "create error":
mockDatabase.EXPECT().List(gomock.Any(), gomock.Any(), gomock.Any(), uint64(0)).Return(nil)
mockDatabase.EXPECT().Exec(gomock.Any(), gomock.Any(), uint64(0), model.DefaultPattern, "1.0.0").Return(errFailed)
mockDatabase.EXPECT().One(gomock.Any(), gomock.Any(), uint64(0), model.DefaultPattern, "1.0.0").Return(errFailed)
case "create":
mockDatabase.EXPECT().List(gomock.Any(), gomock.Any(), gomock.Any(), uint64(0)).Return(nil)
mockDatabase.EXPECT().Exec(gomock.Any(), gomock.Any(), uint64(0), model.DefaultPattern, "1.0.0").Return(nil)
mockDatabase.EXPECT().One(gomock.Any(), gomock.Any(), uint64(0), model.DefaultPattern, "1.0.0").Return(nil)
case "no update":
mockRows := mocks.NewRows(ctrl)
mockRows.EXPECT().Scan(gomock.Any(), gomock.Any()).DoAndReturn(func(pointers ...interface{}) error {
Expand All @@ -125,7 +125,7 @@ func TestUpdateVersions(t *testing.T) {
return scanner(mockRows)
}
mockDatabase.EXPECT().List(gomock.Any(), gomock.Any(), gomock.Any(), uint64(0)).DoAndReturn(dummyFn)
mockDatabase.EXPECT().Exec(gomock.Any(), gomock.Any(), uint64(0), model.DefaultPattern, "1.0.0").Return(errFailed)
mockDatabase.EXPECT().One(gomock.Any(), gomock.Any(), uint64(0), model.DefaultPattern, "1.0.0").Return(errFailed)
case "update":
mockRows := mocks.NewRows(ctrl)
mockRows.EXPECT().Scan(gomock.Any(), gomock.Any()).DoAndReturn(func(pointers ...interface{}) error {
Expand All @@ -138,7 +138,7 @@ func TestUpdateVersions(t *testing.T) {
return scanner(mockRows)
}
mockDatabase.EXPECT().List(gomock.Any(), gomock.Any(), gomock.Any(), uint64(0)).DoAndReturn(dummyFn)
mockDatabase.EXPECT().Exec(gomock.Any(), gomock.Any(), uint64(0), model.DefaultPattern, "1.0.0").Return(nil)
mockDatabase.EXPECT().One(gomock.Any(), gomock.Any(), uint64(0), model.DefaultPattern, "1.0.0").Return(nil)
case "delete error":
mockRows := mocks.NewRows(ctrl)
mockRows.EXPECT().Scan(gomock.Any(), gomock.Any()).DoAndReturn(func(pointers ...interface{}) error {
Expand All @@ -151,7 +151,7 @@ func TestUpdateVersions(t *testing.T) {
return scanner(mockRows)
}
mockDatabase.EXPECT().List(gomock.Any(), gomock.Any(), gomock.Any(), uint64(0)).DoAndReturn(dummyFn)
mockDatabase.EXPECT().Exec(gomock.Any(), gomock.Any(), uint64(0), model.DefaultPattern).Return(errFailed)
mockDatabase.EXPECT().One(gomock.Any(), gomock.Any(), uint64(0), model.DefaultPattern).Return(errFailed)
case "delete":
mockRows := mocks.NewRows(ctrl)
mockRows.EXPECT().Scan(gomock.Any(), gomock.Any()).DoAndReturn(func(pointers ...interface{}) error {
Expand All @@ -164,7 +164,7 @@ func TestUpdateVersions(t *testing.T) {
return scanner(mockRows)
}
mockDatabase.EXPECT().List(gomock.Any(), gomock.Any(), gomock.Any(), uint64(0)).DoAndReturn(dummyFn)
mockDatabase.EXPECT().Exec(gomock.Any(), gomock.Any(), uint64(0), model.DefaultPattern).Return(nil)
mockDatabase.EXPECT().One(gomock.Any(), gomock.Any(), uint64(0), model.DefaultPattern).Return(nil)
}

gotErr := instance.UpdateVersions(context.Background(), tc.args.o)
Expand Down

0 comments on commit 93a7cf5

Please sign in to comment.