From b8911fb45673fdc3fce587892c4d9215e7c15019 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Thu, 14 Apr 2022 21:58:21 +0800 Subject: Use a struct as test options (#19393) * Use a struct as test options * Fix name * Fix test --- routers/api/v1/repo/main_test.go | 4 +++- routers/web/admin/main_test.go | 4 +++- routers/web/auth/main_test.go | 4 +++- routers/web/repo/main_test.go | 4 +++- routers/web/user/main_test.go | 4 +++- routers/web/user/setting/main_test.go | 4 +++- 6 files changed, 18 insertions(+), 6 deletions(-) (limited to 'routers') diff --git a/routers/api/v1/repo/main_test.go b/routers/api/v1/repo/main_test.go index f9ed886999..19e524d014 100644 --- a/routers/api/v1/repo/main_test.go +++ b/routers/api/v1/repo/main_test.go @@ -12,5 +12,7 @@ import ( ) func TestMain(m *testing.M) { - unittest.MainTest(m, filepath.Join("..", "..", "..", "..")) + unittest.MainTest(m, &unittest.TestOptions{ + GiteaRootPath: filepath.Join("..", "..", "..", ".."), + }) } diff --git a/routers/web/admin/main_test.go b/routers/web/admin/main_test.go index e41d8fea75..4e6ad4d743 100644 --- a/routers/web/admin/main_test.go +++ b/routers/web/admin/main_test.go @@ -12,5 +12,7 @@ import ( ) func TestMain(m *testing.M) { - unittest.MainTest(m, filepath.Join("..", "..", "..")) + unittest.MainTest(m, &unittest.TestOptions{ + GiteaRootPath: filepath.Join("..", "..", ".."), + }) } diff --git a/routers/web/auth/main_test.go b/routers/web/auth/main_test.go index 2b16f3c405..71f522fb07 100644 --- a/routers/web/auth/main_test.go +++ b/routers/web/auth/main_test.go @@ -12,5 +12,7 @@ import ( ) func TestMain(m *testing.M) { - unittest.MainTest(m, filepath.Join("..", "..", "..")) + unittest.MainTest(m, &unittest.TestOptions{ + GiteaRootPath: filepath.Join("..", "..", ".."), + }) } diff --git a/routers/web/repo/main_test.go b/routers/web/repo/main_test.go index 81e3a8e281..a1ca3c3bc7 100644 --- a/routers/web/repo/main_test.go +++ b/routers/web/repo/main_test.go @@ -12,5 +12,7 @@ import ( ) func TestMain(m *testing.M) { - unittest.MainTest(m, filepath.Join("..", "..", "..")) + unittest.MainTest(m, &unittest.TestOptions{ + GiteaRootPath: filepath.Join("..", "..", ".."), + }) } diff --git a/routers/web/user/main_test.go b/routers/web/user/main_test.go index 77b48d89fb..517957a85c 100644 --- a/routers/web/user/main_test.go +++ b/routers/web/user/main_test.go @@ -12,5 +12,7 @@ import ( ) func TestMain(m *testing.M) { - unittest.MainTest(m, filepath.Join("..", "..", "..")) + unittest.MainTest(m, &unittest.TestOptions{ + GiteaRootPath: filepath.Join("..", "..", ".."), + }) } diff --git a/routers/web/user/setting/main_test.go b/routers/web/user/setting/main_test.go index b6ed7f5b18..d4df464abd 100644 --- a/routers/web/user/setting/main_test.go +++ b/routers/web/user/setting/main_test.go @@ -12,5 +12,7 @@ import ( ) func TestMain(m *testing.M) { - unittest.MainTest(m, filepath.Join("..", "..", "..", "..")) + unittest.MainTest(m, &unittest.TestOptions{ + GiteaRootPath: filepath.Join("..", "..", "..", ".."), + }) } -- cgit v1.2.3