forked from forgejo/forgejo
[GITEA] Detect file rename and show in history
- Add a indication to the file history if the file has been renamed, this indication contains a link to browse the history of the file further. - Added unit testing. - Added integration testing. - Resolves https://codeberg.org/forgejo/forgejo/issues/1279 (cherry picked from commit72c297521b
) (cherry picked from commit283f964894
) Conflicts: options/locale/locale_en-US.ini https://codeberg.org/forgejo/forgejo/pulls/1550 (cherry picked from commit7c30af7fde
) (cherry picked from commitf3be6eb269
) (cherry picked from commit78e1755b94
) (cherry picked from commit73799479e0
) (cherry picked from commit938359b941
) (cherry picked from commitb168a9c081
) [GITEA] Detect file rename and show in history (squash) ctx.Locale (cherry picked from commit40447752ff
) (cherry picked from commitea23594cdb
) (cherry picked from commitcdc473850c
) (cherry picked from commit86e6641c29
) (cherry picked from commit2757de586b
) (cherry picked from commitdef4ae32dd
) (cherry picked from commit6dada09329
) (cherry picked from commit5d6d527251
) Conflicts: tests/integration/repo_test.go https://codeberg.org/forgejo/forgejo/pulls/2119 (cherry picked from commitd3c1bce7db
)
This commit is contained in:
parent
d6850bc308
commit
04bcb22d5c
22 changed files with 140 additions and 2 deletions
|
@ -473,6 +473,36 @@ func TestViewRepoDirectoryReadme(t *testing.T) {
|
|||
missing("symlink-loop", "/user2/readme-test/src/branch/symlink-loop/")
|
||||
}
|
||||
|
||||
func TestRenamedFileHistory(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
t.Run("Renamed file", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
|
||||
req := NewRequest(t, "GET", "/user2/repo59/commits/branch/master/license")
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||
|
||||
renameNotice := htmlDoc.doc.Find(".ui.bottom.attached.header")
|
||||
assert.Equal(t, 1, renameNotice.Length())
|
||||
assert.Contains(t, renameNotice.Text(), "Renamed from licnse (Browse further)")
|
||||
|
||||
oldFileHistoryLink, ok := renameNotice.Find("a").Attr("href")
|
||||
assert.True(t, ok)
|
||||
assert.Equal(t, "/user2/repo59/commits/commit/80b83c5c8220c3aa3906e081f202a2a7563ec879/licnse", oldFileHistoryLink)
|
||||
})
|
||||
|
||||
t.Run("Non renamed file", func(t *testing.T) {
|
||||
req := NewRequest(t, "GET", "/user2/repo59/commits/branch/master/README.md")
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||
|
||||
htmlDoc.AssertElement(t, ".ui.bottom.attached.header", false)
|
||||
})
|
||||
}
|
||||
|
||||
func TestMarkDownReadmeImage(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue