From e68b9d00a6e05b3a941f63ffb696f91e554ac5ec Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 18 Oct 2024 20:33:49 +0200 Subject: Adding upstream version 9.0.3. Signed-off-by: Daniel Baumann --- models/forgejo_migrations/v1_22/v8_test.go | 35 ++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 models/forgejo_migrations/v1_22/v8_test.go (limited to 'models/forgejo_migrations/v1_22/v8_test.go') diff --git a/models/forgejo_migrations/v1_22/v8_test.go b/models/forgejo_migrations/v1_22/v8_test.go new file mode 100644 index 0000000..128fd08 --- /dev/null +++ b/models/forgejo_migrations/v1_22/v8_test.go @@ -0,0 +1,35 @@ +// Copyright 2024 The Forgejo Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package v1_22 //nolint + +import ( + "testing" + + migration_tests "code.gitea.io/gitea/models/migrations/test" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func Test_RemoveSSHSignaturesFromReleaseNotes(t *testing.T) { + // A reduced mock of the `repo_model.Release` struct. + type Release struct { + ID int64 `xorm:"pk autoincr"` + Note string `xorm:"TEXT"` + } + + x, deferable := migration_tests.PrepareTestEnv(t, 0, new(Release)) + defer deferable() + + require.NoError(t, RemoveSSHSignaturesFromReleaseNotes(x)) + + var releases []Release + err := x.Table("release").OrderBy("id ASC").Find(&releases) + require.NoError(t, err) + assert.Len(t, releases, 3) + + assert.Equal(t, "", releases[0].Note) + assert.Equal(t, "A message.\n", releases[1].Note) + assert.Equal(t, "no signature present here", releases[2].Note) +} -- cgit v1.2.3