mirror of
https://github.com/go-gitea/gitea
synced 2024-12-23 00:54:28 +00:00
test: reduce testing time. (#3885)
This commit is contained in:
parent
0ca359cdb4
commit
c58e1e437b
@ -153,6 +153,7 @@ func TestRepository_LocalWikiPath(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRepository_AddWikiPage(t *testing.T) {
|
func TestRepository_AddWikiPage(t *testing.T) {
|
||||||
|
assert.NoError(t, PrepareTestDatabase())
|
||||||
const wikiContent = "This is the wiki content"
|
const wikiContent = "This is the wiki content"
|
||||||
const commitMsg = "Commit message"
|
const commitMsg = "Commit message"
|
||||||
repo := AssertExistsAndLoadBean(t, &Repository{ID: 1}).(*Repository)
|
repo := AssertExistsAndLoadBean(t, &Repository{ID: 1}).(*Repository)
|
||||||
@ -161,23 +162,30 @@ func TestRepository_AddWikiPage(t *testing.T) {
|
|||||||
"Another page",
|
"Another page",
|
||||||
"Here's a <tag> and a/slash",
|
"Here's a <tag> and a/slash",
|
||||||
} {
|
} {
|
||||||
PrepareTestEnv(t)
|
wikiName := wikiName
|
||||||
assert.NoError(t, repo.AddWikiPage(doer, wikiName, wikiContent, commitMsg))
|
t.Run("test wiki exist: "+wikiName, func(t *testing.T) {
|
||||||
expectedPath := path.Join(repo.LocalWikiPath(), WikiNameToFilename(wikiName))
|
t.Parallel()
|
||||||
assert.True(t, com.IsExist(expectedPath))
|
assert.NoError(t, repo.AddWikiPage(doer, wikiName, wikiContent, commitMsg))
|
||||||
|
expectedPath := path.Join(repo.LocalWikiPath(), WikiNameToFilename(wikiName))
|
||||||
|
assert.True(t, com.IsExist(expectedPath))
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// test for already-existing wiki name
|
t.Run("check wiki already exist", func(t *testing.T) {
|
||||||
PrepareTestEnv(t)
|
t.Parallel()
|
||||||
err := repo.AddWikiPage(doer, "Home", wikiContent, commitMsg)
|
// test for already-existing wiki name
|
||||||
assert.Error(t, err)
|
err := repo.AddWikiPage(doer, "Home", wikiContent, commitMsg)
|
||||||
assert.True(t, IsErrWikiAlreadyExist(err))
|
assert.Error(t, err)
|
||||||
|
assert.True(t, IsErrWikiAlreadyExist(err))
|
||||||
|
})
|
||||||
|
|
||||||
// test for reserved wiki name
|
t.Run("check wiki reserved name", func(t *testing.T) {
|
||||||
PrepareTestEnv(t)
|
t.Parallel()
|
||||||
err = repo.AddWikiPage(doer, "_edit", wikiContent, commitMsg)
|
// test for reserved wiki name
|
||||||
assert.Error(t, err)
|
err := repo.AddWikiPage(doer, "_edit", wikiContent, commitMsg)
|
||||||
assert.True(t, IsErrWikiReservedName(err))
|
assert.Error(t, err)
|
||||||
|
assert.True(t, IsErrWikiReservedName(err))
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRepository_EditWikiPage(t *testing.T) {
|
func TestRepository_EditWikiPage(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user