forked from forgejo/forgejo
Backport #21011 When migrating add several more important sanity checks: * SHAs must be SHAs * Refs must be valid Refs * URLs must be reasonable Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
parent
bd1412c3af
commit
3aba72c613
24 changed files with 714 additions and 302 deletions
|
@ -391,7 +391,7 @@ func TestGiteaUploadUpdateGitForPullRequest(t *testing.T) {
|
|||
},
|
||||
},
|
||||
assertContent: func(t *testing.T, content string) {
|
||||
assert.Contains(t, content, "AddRemote failed")
|
||||
assert.Contains(t, content, "AddRemote")
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -440,7 +440,7 @@ func TestGiteaUploadUpdateGitForPullRequest(t *testing.T) {
|
|||
},
|
||||
},
|
||||
assertContent: func(t *testing.T, content string) {
|
||||
assert.Contains(t, content, "Empty reference, removing")
|
||||
assert.Contains(t, content, "Empty reference")
|
||||
assert.NotContains(t, content, "Cannot remove local head")
|
||||
},
|
||||
},
|
||||
|
@ -468,7 +468,6 @@ func TestGiteaUploadUpdateGitForPullRequest(t *testing.T) {
|
|||
},
|
||||
assertContent: func(t *testing.T, content string) {
|
||||
assert.Contains(t, content, "Deprecated local head")
|
||||
assert.Contains(t, content, "Cannot remove local head")
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -505,6 +504,8 @@ func TestGiteaUploadUpdateGitForPullRequest(t *testing.T) {
|
|||
logger.SetLogger("buffer", "buffer", "{}")
|
||||
defer logger.DelLogger("buffer")
|
||||
|
||||
testCase.pr.EnsuredSafe = true
|
||||
|
||||
head, err := uploader.updateGitForPullRequest(&testCase.pr)
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, testCase.head, head)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue