diff options
author | Ethan Koenig <etk39@cornell.edu> | 2017-01-30 00:17:43 -0500 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2017-01-30 13:17:43 +0800 |
commit | 7765593018cf26e9d5c9b68374b981f24993cfae (patch) | |
tree | 482eb78e952a5fe37174e97e063c1c65b0a78346 | |
parent | 78535fb08ebe667f27da6b44a9af52aae1148434 (diff) | |
download | gitea-7765593018cf26e9d5c9b68374b981f24993cfae.tar.gz gitea-7765593018cf26e9d5c9b68374b981f24993cfae.zip |
Better settings for unit tests (#795)
-rw-r--r-- | models/setup_for_test.go | 4 | ||||
-rw-r--r-- | models/wiki_test.go | 12 |
2 files changed, 11 insertions, 5 deletions
diff --git a/models/setup_for_test.go b/models/setup_for_test.go index 0073e93456..c3e5c3aa54 100644 --- a/models/setup_for_test.go +++ b/models/setup_for_test.go @@ -30,8 +30,8 @@ func TestMain(m *testing.M) { setting.RunUser = "runuser" setting.SSH.Port = 3000 setting.SSH.Domain = "try.gitea.io" - setting.RepoRootPath = "/repos" - setting.AppDataPath = "/appdata" + setting.RepoRootPath = "/tmp/repos" + setting.AppDataPath = "/tmp/appdata" os.Exit(m.Run()) } diff --git a/models/wiki_test.go b/models/wiki_test.go index a662ff92f2..ed914d1e55 100644 --- a/models/wiki_test.go +++ b/models/wiki_test.go @@ -5,8 +5,11 @@ package models import ( + "path/filepath" "testing" + "code.gitea.io/gitea/modules/setting" + "github.com/stretchr/testify/assert" ) @@ -33,13 +36,15 @@ func TestRepository_WikiCloneLink(t *testing.T) { func TestWikiPath(t *testing.T) { assert.NoError(t, PrepareTestDatabase()) - assert.Equal(t, "/repos/user2/repo1.wiki.git", WikiPath("user2", "repo1")) + expected := filepath.Join(setting.RepoRootPath, "user2/repo1.wiki.git") + assert.Equal(t, expected, WikiPath("user2", "repo1")) } func TestRepository_WikiPath(t *testing.T) { assert.NoError(t, PrepareTestDatabase()) repo := AssertExistsAndLoadBean(t, &Repository{ID: 1}).(*Repository) - assert.Equal(t, "/repos/user2/repo1.wiki.git", repo.WikiPath()) + expected := filepath.Join(setting.RepoRootPath, "user2/repo1.wiki.git") + assert.Equal(t, expected, repo.WikiPath()) } // TODO TestRepository_HasWiki @@ -49,7 +54,8 @@ func TestRepository_WikiPath(t *testing.T) { func TestRepository_LocalWikiPath(t *testing.T) { assert.NoError(t, PrepareTestDatabase()) repo := AssertExistsAndLoadBean(t, &Repository{ID: 1}).(*Repository) - assert.Equal(t, "/appdata/tmp/local-wiki/1", repo.LocalWikiPath()) + expected := filepath.Join(setting.AppDataPath, "tmp/local-wiki/1") + assert.Equal(t, expected, repo.LocalWikiPath()) } // TODO TestRepository_UpdateLocalWiki |